Add filter.is_pm_with_only().

This commit is contained in:
Steve Howell
2018-05-02 11:31:51 +00:00
committed by Tim Abbott
parent 2a70f0dba4
commit 0232e92038
2 changed files with 33 additions and 0 deletions

View File

@@ -419,6 +419,20 @@ Filter.prototype = {
return this.has_operator('stream') && this.has_operator('topic');
},
is_pm_with_only: function () {
if (this._operators.length !== 1) {
return false;
}
var term = this._operators[0];
if (term.negated) {
return false;
}
return (term.operator === 'pm-with');
},
update_email: function (user_id, new_email) {
_.each(this._operators, function (term) {
switch (term.operator) {