mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
filters: Refactor filter_with_new_topic to expand its functionality.
This intent is that we'll be able to reuse this when editing streams as well. * Rename method: filter_with_new_topic to filter_with_new_param. * Fix tests and method calls.
This commit is contained in:
committed by
Tim Abbott
parent
1c6435d4cc
commit
40a6602b09
@@ -486,11 +486,11 @@ Filter.prototype = {
|
||||
return operators_mixed_case.map(tuple => Filter.canonicalize_term(tuple));
|
||||
},
|
||||
|
||||
filter_with_new_topic: function (new_topic) {
|
||||
filter_with_new_params: function (params) {
|
||||
const terms = this._operators.map(term => {
|
||||
const new_term = { ...term };
|
||||
if (new_term.operator === 'topic' && !new_term.negated) {
|
||||
new_term.operand = new_topic;
|
||||
if (new_term.operator === params.operator && !new_term.negated) {
|
||||
new_term.operand = params.operand;
|
||||
}
|
||||
return new_term;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user