mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
muting: Replace muted_topics Dict with IntDict.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
committed by
Tim Abbott
parent
e10da9c85f
commit
052497de1c
@@ -6,9 +6,6 @@ set_global('page_params', {});
|
|||||||
run_test('edge_cases', () => {
|
run_test('edge_cases', () => {
|
||||||
// private messages
|
// private messages
|
||||||
assert(!muting.is_topic_muted(undefined, undefined));
|
assert(!muting.is_topic_muted(undefined, undefined));
|
||||||
|
|
||||||
// defensive
|
|
||||||
assert(!muting.is_topic_muted('nonexistent', undefined));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const design = {
|
const design = {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
const Dict = require('./dict').Dict;
|
|
||||||
const FoldDict = require('./fold_dict').FoldDict;
|
const FoldDict = require('./fold_dict').FoldDict;
|
||||||
|
const IntDict = require('./int_dict').IntDict;
|
||||||
|
|
||||||
let muted_topics = new Dict();
|
const muted_topics = new IntDict();
|
||||||
|
|
||||||
exports.add_muted_topic = function (stream_id, topic) {
|
exports.add_muted_topic = function (stream_id, topic) {
|
||||||
let sub_dict = muted_topics.get(stream_id);
|
let sub_dict = muted_topics.get(stream_id);
|
||||||
@@ -38,7 +38,7 @@ exports.get_muted_topics = function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
exports.set_muted_topics = function (tuples) {
|
exports.set_muted_topics = function (tuples) {
|
||||||
muted_topics = new Dict();
|
muted_topics.clear();
|
||||||
|
|
||||||
_.each(tuples, function (tuple) {
|
_.each(tuples, function (tuple) {
|
||||||
const stream_name = tuple[0];
|
const stream_name = tuple[0];
|
||||||
|
|||||||
Reference in New Issue
Block a user