mirror of
https://github.com/zulip/zulip.git
synced 2025-11-21 15:09:34 +00:00
message_edit: Fix message editing for messages that threw a backend error.
Changes editibility type from NONE to FULL, and makes Save and Cancel buttons work. Exposes a new bug, which is that changing the topic changes the topic for the recipient row, rather than the message. See #2278.
This commit is contained in:
@@ -18,8 +18,16 @@ exports.editability_types = editability_types;
|
|||||||
|
|
||||||
function get_editability (message, edit_limit_seconds_buffer) {
|
function get_editability (message, edit_limit_seconds_buffer) {
|
||||||
edit_limit_seconds_buffer = edit_limit_seconds_buffer || 0;
|
edit_limit_seconds_buffer = edit_limit_seconds_buffer || 0;
|
||||||
if (!message || !message.sent_by_me || message.local_id !== undefined ||
|
if (!(message && message.sent_by_me)) {
|
||||||
!page_params.realm_allow_message_editing) {
|
return editability_types.NO;
|
||||||
|
}
|
||||||
|
if (message.failed_request) {
|
||||||
|
return editability_types.FULL;
|
||||||
|
}
|
||||||
|
if (message.local_id !== undefined) {
|
||||||
|
return editability_types.NO;
|
||||||
|
}
|
||||||
|
if (!page_params.realm_allow_message_editing) {
|
||||||
return editability_types.NO;
|
return editability_types.NO;
|
||||||
}
|
}
|
||||||
if (page_params.realm_message_content_edit_limit_seconds === 0) {
|
if (page_params.realm_message_content_edit_limit_seconds === 0) {
|
||||||
@@ -68,6 +76,7 @@ exports.save = function (row, from_topic_edited_only) {
|
|||||||
if (message.local_id !== undefined) {
|
if (message.local_id !== undefined) {
|
||||||
if (new_content !== message.raw_content || topic_changed) {
|
if (new_content !== message.raw_content || topic_changed) {
|
||||||
echo.edit_locally(message, new_content, topic_changed ? new_topic : undefined);
|
echo.edit_locally(message, new_content, topic_changed ? new_topic : undefined);
|
||||||
|
row = current_msg_list.get_row(message_id);
|
||||||
}
|
}
|
||||||
message_edit.end(row);
|
message_edit.end(row);
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user