From 081ae7771ad80c22ccb8022696d893db6107221a Mon Sep 17 00:00:00 2001 From: Jessica McKellar Date: Thu, 22 Aug 2013 13:57:48 -0400 Subject: [PATCH] Add a MessageList method to update message recipients. (imported from commit 3c24f045aa5726fcab8b9acd91105044e7783b63) --- static/js/message_list.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/static/js/message_list.js b/static/js/message_list.js index d0865f5c8b..480b0d9add 100644 --- a/static/js/message_list.js +++ b/static/js/message_list.js @@ -334,6 +334,18 @@ MessageList.prototype = { get_row: function (id) { return this.view.get_row(id); + }, + + change_display_recipient: function MessageList_change_display_recipient(old_recipient, + new_recipient) { + // This method only works for streams. + _.each(this._items, function (item) { + if (item.display_recipient === old_recipient) { + item.display_recipient = new_recipient; + item.stream = new_recipient; + } + }); + this.view.rerender_the_whole_thing(); } };