message edit: Only enable left-arrow-editing for content.

We no longer let the left arrow put you into the message edit
UI for a message where you can only edit topics, since that is
just confusing to most users.

This change also improves error handling a bit, and it removes
an unnecessary call to rows.id().

Finally, it moves some logic out of message_list.js, so that we
don't have a circular dependency for this codepath.

Fixes #4259
This commit is contained in:
Steve Howell
2017-03-27 09:00:31 -07:00
parent c0a6038a95
commit 293c89ba94
2 changed files with 31 additions and 19 deletions

View File

@@ -645,18 +645,13 @@ exports.MessageList.prototype = {
}, 0);
},
get_last_own_editable_message: function MessageList_get_last_own_editable_message() {
get_last_message_sent_by_me: function () {
var msg_index = _.findLastIndex(this._items, {sender_id: page_params.user_id});
if (msg_index === -1) {
return;
}
var msg = this._items[msg_index];
var msg_editability_type = message_edit.get_editability(msg, 5);
if (msg_editability_type !== message_edit.editability_types.NO &&
msg_editability_type !== message_edit.editability_types.NO_LONGER) {
return msg;
}
return;
return msg;
},
};