mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 16:01:20 +08:00
FEATURE: Promote polymorphic bookmarks to default and migrate (#16729)
This commit migrates all bookmarks to be polymorphic (using the bookmarkable_id and bookmarkable_type) columns. It also deletes all the old code guarded behind the use_polymorphic_bookmarks setting and changes that setting to true for all sites and by default for the sake of plugins. No data is deleted in the migrations, the old post_id and for_topic columns for bookmarks will be dropped later on.
This commit is contained in:
@ -539,7 +539,11 @@ class PostsController < ApplicationController
|
||||
def destroy_bookmark
|
||||
params.require(:post_id)
|
||||
|
||||
bookmark_id = Bookmark.where(post_id: params[:post_id], user_id: current_user.id).pluck_first(:id)
|
||||
bookmark_id = Bookmark.where(
|
||||
bookmarkable_id: params[:post_id],
|
||||
bookmarkable_type: "Post",
|
||||
user_id: current_user.id
|
||||
).pluck_first(:id)
|
||||
destroyed_bookmark = BookmarkManager.new(current_user).destroy(bookmark_id)
|
||||
|
||||
render json: success_json.merge(BookmarkManager.bookmark_metadata(destroyed_bookmark, current_user))
|
||||
|
Reference in New Issue
Block a user