mirror of
https://github.com/discourse/discourse.git
synced 2025-05-28 12:02:05 +08: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:
@ -511,15 +511,10 @@ class PostsController < ApplicationController
|
||||
def destroy_bookmark
|
||||
params.require(:post_id)
|
||||
|
||||
existing_bookmark = Bookmark.find_by(post_id: params[:post_id], user_id: current_user.id)
|
||||
topic_bookmarked = false
|
||||
bookmark_id = Bookmark.where(post_id: params[:post_id], user_id: current_user.id).pluck_first(:id)
|
||||
result = BookmarkManager.new(current_user).destroy(bookmark_id)
|
||||
|
||||
if existing_bookmark.present?
|
||||
topic_bookmarked = Bookmark.exists?(topic_id: existing_bookmark.topic_id, user_id: current_user.id)
|
||||
existing_bookmark.destroy
|
||||
end
|
||||
|
||||
render json: success_json.merge(topic_bookmarked: topic_bookmarked)
|
||||
render json: success_json.merge(result)
|
||||
end
|
||||
|
||||
def wiki
|
||||
|
Reference in New Issue
Block a user