mirror of https://github.com/zulip/zulip.git
Handle undefined keys in muting.is_topic_muted
(imported from commit 96a9f0253e1c0e72a2b05577118dac438d190994)
This commit is contained in:
parent
f616148181
commit
c6131b630b
|
@ -21,6 +21,9 @@ exports.unmute_topic = function (stream, topic) {
|
|||
};
|
||||
|
||||
exports.is_topic_muted = function (stream, topic) {
|
||||
if (stream === undefined) {
|
||||
return false;
|
||||
}
|
||||
var sub_dict = muted_topics.get(stream);
|
||||
return sub_dict && sub_dict.get(topic);
|
||||
};
|
||||
|
|
|
@ -11,6 +11,14 @@ set_global('page_params', {
|
|||
|
||||
var muting = require('js/muting.js');
|
||||
|
||||
(function test_edge_cases() {
|
||||
// private messages
|
||||
assert(!muting.is_topic_muted(undefined, undefined));
|
||||
|
||||
// defensive
|
||||
assert(!muting.is_topic_muted('nonexistent', undefined));
|
||||
}());
|
||||
|
||||
(function test_basics() {
|
||||
assert(!muting.is_topic_muted('devel', 'java'));
|
||||
muting.mute_topic('devel', 'java');
|
||||
|
|
Loading…
Reference in New Issue