mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user