mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
FEATURE: Add "delete on owner reply" bookmark functionality (#10231)
This adds an option to "delete on owner reply" to bookmarks. If you select this option in the modal, then reply to the topic the bookmark is in, the bookmark will be deleted on reply. This PR also changes the checkboxes for these additional bookmark options to an Integer column in the DB with a combobox to select the option you want. The use cases are: * Sometimes I will bookmark the topics to read it later. In this case we definitely don’t need to keep the bookmark after I replied to it. * Sometimes I will read the topic in mobile and I will prefer to reply in PC later. Or I may have to do some research before reply. So I will bookmark it for reply later.
This commit is contained in:
@ -202,6 +202,7 @@ class PostCreator
|
||||
create_embedded_topic
|
||||
@post.link_post_uploads
|
||||
update_uploads_secure_status
|
||||
delete_owned_bookmarks
|
||||
ensure_in_allowed_users if guardian.is_staff?
|
||||
unarchive_message if !@opts[:import_mode]
|
||||
DraftSequence.next!(@user, draft_key) if !@opts[:import_mode]
|
||||
@ -402,6 +403,14 @@ class PostCreator
|
||||
@post.update_uploads_secure_status
|
||||
end
|
||||
|
||||
def delete_owned_bookmarks
|
||||
return if !@post.topic_id
|
||||
@user.bookmarks.where(
|
||||
topic_id: @post.topic_id,
|
||||
auto_delete_preference: Bookmark.auto_delete_preferences[:on_owner_reply]
|
||||
).destroy_all
|
||||
end
|
||||
|
||||
def handle_spam
|
||||
if @spam
|
||||
GroupMessage.create(Group[:moderators].name,
|
||||
|
Reference in New Issue
Block a user