diff --git a/static/js/message_list_view.js b/static/js/message_list_view.js index 87e4999780..31ba00e053 100644 --- a/static/js/message_list_view.js +++ b/static/js/message_list_view.js @@ -393,6 +393,17 @@ MessageListView.prototype = { return message_actions; }, + _put_row: function (dom_row) { + var row = $(dom_row); + + // Save DOM elements by id into self._rows for O(1) lookup. + // These can be used by get_row later, which re-wraps them + // inside jQuery objects. + if (row.hasClass('message_row')) { + this._rows[row.attr('zid')] = dom_row; + } + }, + _post_process: function ($message_rows) { // $message_rows wraps one or more message rows @@ -403,6 +414,8 @@ MessageListView.prototype = { var self = this; _.each($message_rows, function (dom_row) { + self._put_row(dom_row); + var row = $(dom_row); var content = row.find('.message_content'); @@ -411,11 +424,6 @@ MessageListView.prototype = { content.addClass('rtl'); } - // Save DOM elements by id into self._rows for O(1) lookup - if (row.hasClass('message_row')) { - self._rows[row.attr('zid')] = dom_row; - } - if (row.hasClass('mention')) { row.find('.user-mention').each(function () { // We give special highlights to the mention buttons