FEATURE: Bookmark pinning (#12431)

Users can now pin bookmarks from their bookmark list. This will anchor the bookmark to the top of the list, and show a pin icon next to it. This also applies in the nav bookmarks panel. If there are multiple pinned bookmarks they sort by last updated order.
This commit is contained in:
Martin Brennan
2021-03-22 09:50:22 +10:00
committed by GitHub
parent 56a573ab4b
commit 49f4c548ef
16 changed files with 189 additions and 26 deletions

View File

@@ -54,4 +54,17 @@ class BookmarksController < ApplicationController
render json: failed_json.merge(errors: bookmark_manager.errors.full_messages), status: 400
end
def toggle_pin
params.require(:bookmark_id)
bookmark_manager = BookmarkManager.new(current_user)
bookmark_manager.toggle_pin(bookmark_id: params[:bookmark_id])
if bookmark_manager.errors.empty?
return render json: success_json
end
render json: failed_json.merge(errors: bookmark_manager.errors.full_messages), status: 400
end
end