mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: Edit bookmark reminders from post and explicit delete button (#9455)
There is now an explicit "Delete Bookmark" button in the edit modal. A confirmation is shown before deleting. Along with this, when the bookmarked post icon is clicked the modal is now shown instead of just deleting the bookmark. Also, the "Delete Bookmark" button from the user bookmark list now confirms the action. Add a `d d` shortcut in the modal to delete the bookmark.
This commit is contained in:
@@ -51,7 +51,9 @@ class PostSerializer < BasicPostSerializer
|
||||
:bookmarked,
|
||||
:bookmarked_with_reminder,
|
||||
:bookmark_reminder_at,
|
||||
:bookmark_id,
|
||||
:bookmark_reminder_type,
|
||||
:bookmark_name,
|
||||
:raw,
|
||||
:actions_summary,
|
||||
:moderator?,
|
||||
@@ -334,6 +336,14 @@ class PostSerializer < BasicPostSerializer
|
||||
include_bookmarked_with_reminder?
|
||||
end
|
||||
|
||||
def include_bookmark_name?
|
||||
include_bookmarked_with_reminder?
|
||||
end
|
||||
|
||||
def include_bookmark_id?
|
||||
include_bookmarked_with_reminder?
|
||||
end
|
||||
|
||||
def post_bookmark
|
||||
return nil if !SiteSetting.enable_bookmarks_with_reminders? || @topic_view.blank?
|
||||
@post_bookmark ||= @topic_view.user_post_bookmarks.find { |bookmark| bookmark.post_id == object.id }
|
||||
@@ -348,6 +358,14 @@ class PostSerializer < BasicPostSerializer
|
||||
Bookmark.reminder_types[post_bookmark.reminder_type].to_s
|
||||
end
|
||||
|
||||
def bookmark_name
|
||||
post_bookmark&.name
|
||||
end
|
||||
|
||||
def bookmark_id
|
||||
post_bookmark&.id
|
||||
end
|
||||
|
||||
def include_display_username?
|
||||
SiteSetting.enable_names?
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user