2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-10 21:01:33 +08:00

FEATURE: Featured topic for user profile & card (#8461)

This commit is contained in:
Mark VanLandingham 2019-12-09 11:15:47 -08:00 committed by GitHub
parent b5236591e9
commit 14cb386f1e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 418 additions and 95 deletions

View file

@ -127,6 +127,7 @@ class Topic < ActiveRecord::Base
has_many :invites, through: :topic_invites, source: :invite
has_many :topic_timers, dependent: :destroy
has_many :reviewables
has_many :user_profiles
has_one :user_warning
has_one :first_post, -> { where post_number: 1 }, class_name: 'Post'
@ -238,6 +239,8 @@ class Topic < ActiveRecord::Base
after_update do
if saved_changes[:category_id] && self.tags.present?
CategoryTagStat.topic_moved(self, *saved_changes[:category_id])
elsif saved_changes[:category_id] && self.category&.read_restricted?
UserProfile.remove_featured_topic_from_all_profiles(self)
end
end