mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: change **default** notification state when a topic is recategorized within 5 days of creation
This commit is contained in:
@@ -52,8 +52,8 @@ describe CategoryUser do
|
||||
end
|
||||
|
||||
it "watches categories that have been changed" do
|
||||
watched_category = Fabricate(:category)
|
||||
user = Fabricate(:user)
|
||||
watched_category = Fabricate(:category)
|
||||
CategoryUser.create!(user: user, category: watched_category, notification_level: CategoryUser.notification_levels[:watching])
|
||||
|
||||
post = create_post
|
||||
@@ -65,6 +65,21 @@ describe CategoryUser do
|
||||
expect(tu.notification_level).to eq TopicUser.notification_levels[:watching]
|
||||
end
|
||||
|
||||
it "unwatches categories that have been changed" do
|
||||
user = Fabricate(:user)
|
||||
watched_category = Fabricate(:category)
|
||||
CategoryUser.create!(user: user, category: watched_category, notification_level: CategoryUser.notification_levels[:watching])
|
||||
|
||||
post = create_post(category: watched_category)
|
||||
tu = TopicUser.get(post.topic, user)
|
||||
expect(tu.notification_level).to eq TopicUser.notification_levels[:watching]
|
||||
|
||||
# Now, change the topic's category
|
||||
unwatched_category = Fabricate(:category)
|
||||
post.topic.change_category_to_id(unwatched_category.id)
|
||||
expect(TopicUser.get(post.topic, user)).to be_blank
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user