diff --git a/app/models/reaction.rb b/app/models/reaction.rb index 0cbd17d1b..e6c56254e 100644 --- a/app/models/reaction.rb +++ b/app/models/reaction.rb @@ -2,6 +2,8 @@ class Reaction < ApplicationRecord include AlgoliaSearch CATEGORIES = %w[like readinglist unicorn thinking hands thumbsdown vomit].freeze + REACTABLE_TYPES = %w[Comment Article User].freeze + STATUSES = %w[valid invalid confirmed archived].freeze belongs_to :reactable, polymorphic: true belongs_to :user @@ -13,8 +15,8 @@ class Reaction < ApplicationRecord counter_culture :user validates :category, inclusion: { in: CATEGORIES } - validates :reactable_type, inclusion: { in: %w[Comment Article] } - validates :status, inclusion: { in: %w[valid invalid confirmed archived] } + validates :reactable_type, inclusion: { in: REACTABLE_TYPES } + validates :status, inclusion: { in: STATUSES } validates :user_id, uniqueness: { scope: %i[reactable_id reactable_type category] } validate :permissions diff --git a/app/models/user.rb b/app/models/user.rb index 53d0e98e3..825bc115e 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -478,6 +478,10 @@ class User < ApplicationRecord email_follower_notifications end + def title + name + end + private def index_id @@ -603,10 +607,6 @@ class User < ApplicationRecord errors.add(:mastodon_url, "is not an allowed Mastodon instance") end - def title - name - end - def tag_list "" # Unused but necessary for search index end