mirror of
https://github.com/zulip/zulip.git
synced 2026-06-24 21:08:25 +08:00
Add muting.unmute_topic
(imported from commit c3aa08b7d50c70cba86b43c12d618ba1d96832b4)
This commit is contained in:
parent
3560ecf429
commit
8626276dc3
@ -13,6 +13,13 @@ exports.mute_topic = function (stream, topic) {
|
||||
sub_dict.set(topic, true);
|
||||
};
|
||||
|
||||
exports.unmute_topic = function (stream, topic) {
|
||||
var sub_dict = muted_topics.get(stream);
|
||||
if (sub_dict) {
|
||||
sub_dict.del(topic);
|
||||
}
|
||||
};
|
||||
|
||||
exports.is_topic_muted = function (stream, topic) {
|
||||
var sub_dict = muted_topics.get(stream);
|
||||
return sub_dict && sub_dict.get(topic);
|
||||
|
||||
@ -19,4 +19,16 @@ var muting = require('js/muting.js');
|
||||
// test idempotentcy
|
||||
muting.mute_topic('devel', 'java');
|
||||
assert(muting.is_topic_muted('devel', 'java'));
|
||||
|
||||
muting.unmute_topic('devel', 'java');
|
||||
assert(!muting.is_topic_muted('devel', 'java'));
|
||||
|
||||
// test idempotentcy
|
||||
muting.unmute_topic('devel', 'java');
|
||||
assert(!muting.is_topic_muted('devel', 'java'));
|
||||
|
||||
// test unknown stream is harmless too
|
||||
muting.unmute_topic('unknown', 'java');
|
||||
assert(!muting.is_topic_muted('unknown', 'java'));
|
||||
|
||||
}());
|
||||
|
||||
Loading…
Reference in New Issue
Block a user