FIX: when a post is moved copy notifications level (PR #9311)

This is a revert of FIX: Move notification level only when user posted · discourse/discourse@2c01125 · GitHub

More information on meta: When a reply is moved to a new topic, the followers of the previous topic are automatically follower of the new topic as well - feature - Discourse Meta

GitHub

doesn’t this need deleting?

 LEFT OUTER JOIN
           (
             SELECT DISTINCT user_id
             FROM posts
             WHERE topic_id = :new_topic_id
           ) p ON (p.user_id = tu.user_id)

I don’t think so, it is still used here https://github.com/discourse/discourse/blob/444744dc665d5ada5e58040342eb72ac3221e6fd/app/models/post_mover.rb#L345

we can move it back as select instead of join FIX: Move notification level only when user posted · discourse/discourse@2c01125 · GitHub

I think having it in the SELECT was a little bit faster than doing the JOIN. It might be worth looking at the explain plan of both queries and use the faster one.

I think it auto optimises, but you might as well do a limit 1

once done feel free to merge

yes, EXISTS aborts the subquery as soon as one row is found

The subquery will generally only be executed long enough to determine whether at least one row is returned

1 Like