mirror of
https://github.com/discourse/discourse.git
synced 2024-12-05 09:43:53 +08:00
fcc2e7ebbf
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.
16 lines
305 B
Ruby
16 lines
305 B
Ruby
# frozen_string_literal: true
|
|
|
|
module BookmarkGuardian
|
|
def can_delete_bookmark?(bookmark)
|
|
@user == bookmark.user
|
|
end
|
|
|
|
def can_edit_bookmark?(bookmark)
|
|
@user == bookmark.user
|
|
end
|
|
|
|
def can_see_bookmarkable?(bookmark)
|
|
bookmark.registered_bookmarkable.can_see?(self, bookmark)
|
|
end
|
|
end
|