mirror of https://github.com/zulip/zulip.git
Make muting case insensitive for streams and topics
(imported from commit 6e731a5305a6d19896c61300aedf0fb4a387e148)
This commit is contained in:
parent
0641e693fa
commit
f616148181
|
@ -2,12 +2,12 @@ var muting = (function () {
|
|||
|
||||
var exports = {};
|
||||
|
||||
var muted_topics = new Dict();
|
||||
var muted_topics = new Dict({fold_case: true});
|
||||
|
||||
exports.mute_topic = function (stream, topic) {
|
||||
var sub_dict = muted_topics.get(stream);
|
||||
if (!sub_dict) {
|
||||
sub_dict = new Dict();
|
||||
sub_dict = new Dict({fold_case: true});
|
||||
muted_topics.set(stream, sub_dict);
|
||||
}
|
||||
sub_dict.set(topic, true);
|
||||
|
@ -36,7 +36,7 @@ exports.get_muted_topics = function () {
|
|||
};
|
||||
|
||||
exports.set_muted_topics = function (tuples) {
|
||||
muted_topics = new Dict();
|
||||
muted_topics = new Dict({fold_case: true});
|
||||
|
||||
_.each(tuples, function (tuple) {
|
||||
var stream = tuple[0];
|
||||
|
|
|
@ -50,3 +50,14 @@ var muting = require('js/muting.js');
|
|||
['social', 'breakfast']
|
||||
]);
|
||||
}());
|
||||
|
||||
(function test_case_insensitivity() {
|
||||
muting.set_muted_topics([]);
|
||||
assert(!muting.is_topic_muted('SOCial', 'breakfast'));
|
||||
muting.set_muted_topics([
|
||||
['SOCial', 'breakfast']
|
||||
]);
|
||||
assert(muting.is_topic_muted('SOCial', 'breakfast'));
|
||||
assert(muting.is_topic_muted('social', 'breakfast'));
|
||||
assert(muting.is_topic_muted('social', 'breakFAST'));
|
||||
}());
|
||||
|
|
Loading…
Reference in New Issue