There was a new feature added in May Selective dismissal of New and Unread topics. We recently just upgraded to the latest discourse, and looking at the code and our DB logs, it seems like when users “Dismiss New” without selecting (ie. just bulk dismiss) we pass in tracked = false and nothing else in the request parameters to reset-new.
Inspecting the PR changes I think we end up here when we try to figure out our topic_scope FEATURE: Allow selective dismissal of new and unread topics (#12976) · discourse/discourse@7a79bd7 · GitHub
and because we don’t pass in any topic_ids we skip the if statement and automatically jump to L989
We run a fairly large discourse server, and I think the notion of just having all Topics is pretty expensive as the query basically generates
LEFT JOIN topic_users ON topic_users.topic_id = topics.id AND topic_users.user_id = xxx WHERE "topics"."deleted_at" IS NULL AND "topics"."id" IN (1, ... 1000000) AND (topics.created_at >= 'date') AND (topic_users.last_read_post_number IS NULL) AND (topics.archetype <> 'private_message') ORDER BY topics.created_at DESC LIMIT 500
the IN clause has I believe almost every single topic in the 1M+ range.
Can we default the bulk select to just pass in the topic ids instead of defaulting to all possible Topics?