message_edit: Make topic editing independent of allow_message_editing.

We now allow editing stream and topic of message even if
allow_message_editing if False using webapp given that is
allowed as per other topic and stream edit specific settings.

Fixes a part of #21739.
This commit is contained in:
Sahil Batra
2022-08-26 12:47:01 +05:30
committed by Tim Abbott
parent 815bf609fa
commit e6ec2badb5
8 changed files with 10 additions and 29 deletions

View File

@@ -61,11 +61,6 @@ export function is_topic_editable(message, edit_limit_seconds_buffer = 0) {
return false;
}
if (!page_params.realm_allow_message_editing) {
// If message editing is disabled, so is topic editing.
return false;
}
// message senders can edit message topics indefinitely.
if (message.sent_by_me) {
return true;
@@ -140,6 +135,9 @@ export function get_editability(message, edit_limit_seconds_buffer = 0) {
}
if (!page_params.realm_allow_message_editing) {
if (message.type === "stream") {
return editability_types.TOPIC_ONLY;
}
return editability_types.NO;
}
@@ -200,10 +198,6 @@ export function get_deletability(message) {
}
export function can_move_message(message) {
if (!page_params.realm_allow_message_editing) {
return false;
}
if (!message.is_stream) {
return false;
}
@@ -265,14 +259,6 @@ export function stream_and_topic_exist_in_edit_history(message, stream_id, topic
return false;
}
export function update_message_topic_editing_pencil() {
if (page_params.realm_allow_message_editing) {
$(".on_hover_topic_edit, .always_visible_topic_edit").show();
} else {
$(".on_hover_topic_edit, .always_visible_topic_edit").hide();
}
}
export function hide_message_edit_spinner($row) {
$row.find(".loader").hide();
$row.find(".message_edit_save span").show();