FIX: mark topics in sub categories as unread when dismissing parent

Previously we would only dismiss the parent category and leave the
child categories unread
This commit is contained in:
Sam Saffron
2019-06-27 13:26:07 +10:00
parent 79d657203d
commit 5bc5c02af6
6 changed files with 54 additions and 14 deletions

View File

@@ -68,12 +68,12 @@ class TopicsBulkAction
end
def dismiss_posts
sql = "
UPDATE topic_users tu
SET highest_seen_post_number = t.highest_post_number , last_read_post_number = highest_post_number
FROM topics t
WHERE t.id = tu.topic_id AND tu.user_id = :user_id AND t.id IN (:topic_ids)
"
sql = <<~SQL
UPDATE topic_users tu
SET highest_seen_post_number = t.highest_post_number , last_read_post_number = highest_post_number
FROM topics t
WHERE t.id = tu.topic_id AND tu.user_id = :user_id AND t.id IN (:topic_ids)
SQL
DB.exec(sql, user_id: @user.id, topic_ids: @topic_ids)
@changed_ids.concat @topic_ids