DEV: Bookmark cleanup (#16899)

Gets rid of old bookmark app event and deletes anything
leftover from polymorphic bookmark changeover.
This commit is contained in:
Martin Brennan
2022-05-24 13:52:42 +10:00
committed by GitHub
parent 3f79b1c0f3
commit a5779a7d0b
5 changed files with 3 additions and 195 deletions

View File

@@ -208,17 +208,9 @@ class Topic < ActiveRecord::Base
has_many :category_users, through: :category
has_many :posts
# TODO (martin):
#
# When we are ready we can add as: :bookmarkable here to use the
# polymorphic association.
#
# At that time we may also want to make another association for example
# :topic_bookmarks that get all of the bookmarks for that topic's bookmarkable id
# and type, because this one gets all of the post bookmarks.
#
# Note: We can use Bookmark#for_user_in_topic for this.
has_many :bookmarks, through: :posts
# NOTE: To get all Post _and_ Topic bookmarks for a topic by user,
# use the Bookmark.for_user_in_topic scope.
has_many :bookmarks, as: :bookmarkable
has_many :ordered_posts, -> { order(post_number: :asc) }, class_name: "Post"
has_many :topic_allowed_users