message_list_view: Extract `_get_msg_timestring` method.

This method gets the timestring for the message container when the
message was last edited.
This commit is contained in:
Vaibhav 2019-03-13 15:49:45 +05:30 committed by Tim Abbott
parent d93f5b2977
commit 860406d1ad
1 changed files with 10 additions and 5 deletions

View File

@ -191,14 +191,19 @@ MessageListView.prototype = {
// trigger a re-render
_RENDER_THRESHOLD: 50,
_add_msg_timestring: function (message_container) {
_get_msg_timestring: function (message_container) {
if (message_container.msg.last_edit_timestamp !== undefined) {
// Add or update the last_edit_timestr
var last_edit_time = new XDate(message_container.msg.last_edit_timestamp * 1000);
var today = new XDate();
message_container.last_edit_timestr =
timerender.render_date(last_edit_time, undefined, today)[0].textContent
+ " at " + timerender.stringify_time(last_edit_time);
return timerender.render_date(last_edit_time, undefined, today)[0].textContent +
" at " + timerender.stringify_time(last_edit_time);
}
},
_add_msg_timestring: function (message_container) {
var last_edit_timestr = this._get_msg_timestring(message_container);
if (last_edit_timestr !== undefined) {
message_container.last_edit_timestr = last_edit_timestr;
}
},