FEATURE: improved tag and category watching and tracking

- present tags watched on the user prefs page
- automatically watch or unwatch old topics based on watch status

New watching and tracking logic takes care of handling old topics
(either with or without read state)

When you watch a topic you now watch historically

Also removes confusing warnings from user.
This commit is contained in:
Sam
2016-07-08 12:58:30 +10:00
parent 58c2389a7b
commit 4161ee210a
19 changed files with 583 additions and 224 deletions
+22
View File
@@ -39,6 +39,28 @@ describe UserUpdater do
expect(user.reload.name).to eq 'Jim Tom'
end
it 'can update categories and tags' do
category = Fabricate(:category)
tag = Fabricate(:tag)
user = Fabricate(:user)
updater = UserUpdater.new(acting_user, user)
updater.update(watched_tags: [tag.name], muted_category_ids: [category.id])
expect(TagUser.where(
user_id: user.id,
tag_id: tag.id,
notification_level: TagUser.notification_levels[:watching]
).count).to eq(1)
expect(CategoryUser.where(
user_id: user.id,
category_id: category.id,
notification_level: CategoryUser.notification_levels[:muted]
).count).to eq(1)
end
it 'updates various fields' do
user = Fabricate(:user)
updater = UserUpdater.new(acting_user, user)