Add frontend to show message edit history.

Fixes #268.

Modified significantly by tabbott to:
* improve code cleanliness / repetition
* add missing translation tags
* move code into message_edit.js
* correspond with the new backend.
* not display the option for messages only topic-edited
This commit is contained in:
Kartik Maji
2017-02-19 17:37:58 -08:00
committed by Tim Abbott
parent 0cf6c292d8
commit 1a697b6e02
9 changed files with 135 additions and 0 deletions

View File

@@ -192,6 +192,10 @@ exports.toggle_actions_popover = function (element, id) {
message.subject &&
muting.is_topic_muted(message.stream, message.subject);
var should_display_edit_history_option = _.any(message.edit_history, function (entry) {
return entry.prev_content !== undefined;
});
var args = {
message: message,
use_edit_icon: use_edit_icon,
@@ -199,6 +203,7 @@ exports.toggle_actions_popover = function (element, id) {
can_mute_topic: can_mute_topic,
can_unmute_topic: can_unmute_topic,
should_display_add_reaction_option: message.sent_by_me,
should_display_edit_history_option: should_display_edit_history_option,
conversation_time_uri: narrow.by_conversation_and_time_uri(message),
narrowed: narrow.active(),
};
@@ -825,6 +830,16 @@ exports.register_click_handlers = function () {
e.stopPropagation();
e.preventDefault();
});
$('body').on('click', '.view_edit_history', function (e) {
var msgid = $(e.currentTarget).data('msgid');
var row = current_msg_list.get_row(msgid);
var message = current_msg_list.get(rows.id(row));
popovers.hide_actions_popover();
message_edit.show_history(message);
e.stopPropagation();
e.preventDefault();
});
$('body').on('click', '.popover_mute_topic', function (e) {
var stream = $(e.currentTarget).data('msg-stream');