mirror of
https://github.com/discourse/discourse.git
synced 2025-06-02 02:15:31 +08:00
BUGFIX: tracking categories was not implemented
This commit is contained in:
@ -31,15 +31,24 @@ describe CategoryUser do
|
||||
it 'should operate correctly' do
|
||||
watched_category = Fabricate(:category)
|
||||
muted_category = Fabricate(:category)
|
||||
tracked_category = Fabricate(:category)
|
||||
|
||||
user = Fabricate(:user)
|
||||
|
||||
CategoryUser.create!(user: user, category: watched_category, notification_level: CategoryUser.notification_levels[:watching])
|
||||
CategoryUser.create!(user: user, category: muted_category, notification_level: CategoryUser.notification_levels[:muted])
|
||||
CategoryUser.create!(user: user, category: tracked_category, notification_level: CategoryUser.notification_levels[:tracking])
|
||||
|
||||
watched_post = create_post(category: watched_category)
|
||||
muted_post = create_post(category: muted_category)
|
||||
tracked_post = create_post(category: tracked_category)
|
||||
|
||||
Notification.where(user_id: user.id, topic_id: watched_post.topic_id).count.should == 1
|
||||
Notification.where(user_id: user.id, topic_id: tracked_post.topic_id).count.should == 0
|
||||
|
||||
tu = TopicUser.get(tracked_post.topic, user)
|
||||
tu.notification_level.should == TopicUser.notification_levels[:tracking]
|
||||
tu.notifications_reason_id.should == TopicUser.notification_reasons[:auto_track_category]
|
||||
|
||||
tu = TopicUser.get(muted_post.topic, user)
|
||||
tu.notification_level.should == TopicUser.notification_levels[:muted]
|
||||
|
Reference in New Issue
Block a user