mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 23:02:43 +08:00
FEATURE: Featured topic for user profile & card (#8461)
This commit is contained in:

committed by
GitHub

parent
b5236591e9
commit
14cb386f1e
@ -221,5 +221,15 @@ describe TopicConverter do
|
||||
expect(topic.reload.archetype).to eq("private_message")
|
||||
end
|
||||
end
|
||||
|
||||
context 'user_profiles with newly converted PM as featured topic' do
|
||||
it "sets all matching user_profile featured topic ids to nil" do
|
||||
author.user_profile.update(featured_topic: topic)
|
||||
topic.convert_to_private_message(admin)
|
||||
|
||||
expect(author.user_profile.reload.featured_topic).to eq(nil)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
@ -2503,4 +2503,17 @@ describe Topic do
|
||||
expect(topic.access_topic_via_group).to eq(open_group)
|
||||
end
|
||||
end
|
||||
|
||||
describe "#after_update" do
|
||||
fab!(:topic) { Fabricate(:topic, user: user) }
|
||||
fab!(:category) { Fabricate(:category_with_definition, read_restricted: true) }
|
||||
|
||||
it "removes the topic as featured from user profiles if new category is read_restricted" do
|
||||
user.user_profile.update(featured_topic: topic)
|
||||
expect(user.user_profile.featured_topic).to eq(topic)
|
||||
|
||||
topic.update(category: category)
|
||||
expect(user.user_profile.reload.featured_topic).to eq(nil)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user