Skip to content

Commit

Permalink
Rerender and build_message both format /me messages. Fixes zulip#163
Browse files Browse the repository at this point in the history
  • Loading branch information
cnguye11 committed Oct 25, 2015
1 parent dd2ccff commit c280fce
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions static/js/message_list_view.js
Expand Up @@ -196,15 +196,7 @@ MessageListView.prototype = {

message_container.contains_mention = notifications.speaking_at_me(message_container.msg);
message_container.msg.unread = unread.message_unread(message_container.msg);

if (message_container.msg.is_me_message) {
// Slice the '<p>/me ' off the front, and '</p>' off the end
message_container.status_message = message_container.msg.content.slice(4 + 3, -4);
message_container.include_sender = true;
}
else {
message_container.status_message = false;
}
self._maybe_format_me_message(message_container);

prev = message_container;
});
Expand All @@ -214,6 +206,17 @@ MessageListView.prototype = {
return new_message_groups;
},

_maybe_format_me_message: function MessageListView___maybe_format_me_message(message_container){
if (message_container.msg.is_me_message) {
// Slice the '<p>/me ' off the front, and '</p>' off the end
message_container.status_message = message_container.msg.content.slice(4 + 3, -4);
message_container.include_sender = true;
}
else {
message_container.status_message = false;
}
},

join_message_groups: function MessageListView__join_message_groups(first_group, second_group) {
// join_message_groups will combine groups if they have the
// same_recipient on the same_day and the view supports collapsing
Expand Down Expand Up @@ -744,6 +747,7 @@ MessageListView.prototype = {

// Re-render just this one message
this._add_msg_timestring(message_container);
this._maybe_format_me_message(message_container);

var msg_to_render = _.extend(message_container, {table_name: this.table_name});
var rendered_msg = $(templates.render('single_message', msg_to_render));
Expand Down

0 comments on commit c280fce

Please sign in to comment.