mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Bookmark topics were not being updated when the post moved (#12542)
Because bookmarks have both topic and post ID, when the post was moved into another topic the bookmark was still attached to the post but did not show in the UI. This PR makes it so the all topic IDs for bookmarks attached to a post are updated when a post is moved. Also included is a migration to fix affected records (e.g. on Meta there are 20 affected records). See: https://meta.discourse.org/t/improved-bookmarks-with-reminders/144542/203
This commit is contained in:
@@ -76,6 +76,7 @@ class PostMover
|
||||
update_user_actions
|
||||
update_last_post_stats
|
||||
update_upload_security_status
|
||||
update_bookmarks
|
||||
|
||||
if moving_all_posts
|
||||
@original_topic.update_status('closed', true, @user)
|
||||
@@ -491,6 +492,10 @@ class PostMover
|
||||
end
|
||||
end
|
||||
|
||||
def update_bookmarks
|
||||
Bookmark.where(post_id: post_ids).update_all(topic_id: @destination_topic.id)
|
||||
end
|
||||
|
||||
def watch_new_topic
|
||||
if @destination_topic.archetype == Archetype.private_message
|
||||
if @original_topic.archetype == Archetype.private_message
|
||||
|
||||
Reference in New Issue
Block a user