message_edit: Show save button correctly in message edit form.

Previously the logic to show save button considered only topic
and content edit. This commit fixes it to show the save button
when only stream edit is possible and content and topic edits
are not.

This commit only introduces a simple fix, in long-term we would
want to change the logic of get_editability to include stream
edits as well but it would also require discussion on when to
show the edit icons at different places, so it is better to do
it in a separate commit later.
This commit is contained in:
sahil839 2021-05-26 14:40:05 +05:30 committed by Tim Abbott
parent 7c7e81e662
commit 10e9789179
1 changed files with 4 additions and 2 deletions

View File

@ -336,8 +336,6 @@ function edit_message(row, raw_content) {
// zerver.lib.actions.check_update_message
const seconds_left_buffer = 5;
const editability = get_editability(message, seconds_left_buffer);
const is_editable =
editability === editability_types.TOPIC_ONLY || editability === editability_types.FULL;
const max_file_upload_size = page_params.max_file_upload_size_mib;
let file_upload_enabled = false;
@ -347,6 +345,10 @@ function edit_message(row, raw_content) {
const is_stream_editable =
message.is_stream && settings_data.user_can_move_messages_between_streams();
const is_editable =
editability === editability_types.TOPIC_ONLY ||
editability === editability_types.FULL ||
is_stream_editable;
// current message's stream has been already been added and selected in handlebar
const available_streams = is_stream_editable
? stream_data.subscribed_subs().filter((s) => s.stream_id !== message.stream_id)