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:
parent
b5236591e9
commit
14cb386f1e
34 changed files with 418 additions and 95 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue