message_edit: Refactor .save and .end to separate inline topic edits.

This commit makes it so that inline (recipient bar) topic edits follow
a different path from full message row edits in `message_edit.js`.
This commit:
- deletes `.save()` endpoint and replaces all calls to it with
 `.save_message_row_edit()` and  `.save_inline_topic_edit()`
- deletes `.end()` endpoint and replaces all calls to it with calls to
  either ".end_message_row_edit()" and ".end_inline_topic_edit()".
This commit is contained in:
YashRE42
2020-04-13 19:16:41 +05:30
committed by Tim Abbott
parent 53dde9af68
commit f18ef0469a
4 changed files with 68 additions and 34 deletions

View File

@@ -252,37 +252,37 @@ exports.initialize = function () {
$("body").on("click", ".topic_edit_save", function (e) {
const recipient_row = $(this).closest(".recipient_row");
message_edit.show_topic_edit_spinner(recipient_row);
message_edit.save(recipient_row, true);
message_edit.save_inline_topic_edit(recipient_row);
e.stopPropagation();
popovers.hide_all();
});
$("body").on("click", ".topic_edit_cancel", function (e) {
const recipient_row = $(this).closest(".recipient_row");
current_msg_list.hide_edit_topic_on_recipient_row(recipient_row);
message_edit.end_inline_topic_edit(recipient_row);
e.stopPropagation();
popovers.hide_all();
});
$("body").on("click", ".message_edit_save", function (e) {
const row = $(this).closest(".message_row");
message_edit.save(row, false);
message_edit.save_message_row_edit(row);
e.stopPropagation();
popovers.hide_all();
});
$("body").on("click", ".message_edit_cancel", function (e) {
const row = $(this).closest(".message_row");
message_edit.end(row);
message_edit.end_message_row_edit(row);
e.stopPropagation();
popovers.hide_all();
});
$("body").on("click", ".message_edit_close", function (e) {
const row = $(this).closest(".message_row");
message_edit.end(row);
message_edit.end_message_row_edit(row);
e.stopPropagation();
popovers.hide_all();
});
$("body").on("click", ".copy_message", function (e) {
const row = $(this).closest(".message_row");
message_edit.end(row);
message_edit.end_message_row_edit(row);
row.find(".alert-msg").text(i18n.t("Copied!"));
row.find(".alert-msg").css("display", "block");
row.find(".alert-msg").delay(1000).fadeOut(300);