Create narrow.update_email().

This commit is contained in:
Steve Howell
2017-02-13 12:42:57 -08:00
committed by Tim Abbott
parent 0eeb023a03
commit 0bd3af2bc8
2 changed files with 28 additions and 0 deletions

View File

@@ -200,3 +200,24 @@ function set_filter(operators) {
assert.equal(hide_id,'.empty_feed_notice');
assert.equal(show_id, '#empty_search_narrow_message');
}());
(function test_update_email() {
var steve = {
email: 'steve@foo.com',
user_id: 43,
full_name: 'Steve',
};
people.add(steve);
set_filter([
['pm-with', 'steve@foo.com'],
['sender', 'steve@foo.com'],
['stream', 'steve@foo.com'], // try to be tricky
]);
narrow.update_email(steve.user_id, 'showell@foo.com');
var filter = narrow.filter();
assert.deepEqual(filter.operands('pm-with'), ['showell@foo.com']);
assert.deepEqual(filter.operands('sender'), ['showell@foo.com']);
assert.deepEqual(filter.operands('stream'), ['steve@foo.com']);
}());

View File

@@ -32,6 +32,13 @@ exports.operators = function () {
return current_filter.operators();
};
exports.update_email = function (user_id, new_email) {
if (current_filter !== undefined) {
current_filter.update_email(user_id, new_email);
}
};
/* Operators we should send to the server. */
exports.public_operators = function () {
if (current_filter === undefined) {