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:
Martin Brennan
2020-04-20 13:30:04 +10:00
committed by GitHub
parent c6b411f6c1
commit 344ef5226c
15 changed files with 192 additions and 105 deletions

View File

@ -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