FIX: when category or tag is muted, update user (#9456)

Currently, when category or tag is muted, only after hard refresh, these new muted categories are really muted. Without a hard refresh, you will still receive "new topic" messages.

Therefore, when tag or category is muted, we should update the user object right away.
This commit is contained in:
Krzysztof Kotlarek
2020-04-21 08:33:55 +10:00
committed by GitHub
parent 74e4102093
commit e9f7262813
5 changed files with 41 additions and 2 deletions

View File

@ -104,3 +104,10 @@ QUnit.test("resolvedTimezone", assert => {
);
stub.restore();
});
QUnit.test("muted ids", assert => {
let user = User.create({ username: "chuck", muted_category_ids: [] });
assert.deepEqual(user.calculateMutedIds(0, 1, "muted_category_ids"), [1]);
assert.deepEqual(user.calculateMutedIds(1, 1, "muted_category_ids"), []);
});