mirror of
https://github.com/zulip/zulip.git
synced 2025-11-11 09:27:43 +00:00
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:
@@ -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();
|
||||
|
||||
@@ -173,7 +173,6 @@ function set_timestr(message_container) {
|
||||
}
|
||||
|
||||
function set_topic_edit_properties(group, message) {
|
||||
group.realm_allow_message_editing = page_params.realm_allow_message_editing;
|
||||
group.always_visible_topic_edit = false;
|
||||
group.on_hover_topic_edit = false;
|
||||
// if a user who can edit a topic, can resolve it as well
|
||||
|
||||
@@ -18,7 +18,6 @@ import * as emoji_picker from "./emoji_picker";
|
||||
import * as giphy from "./giphy";
|
||||
import * as hotspots from "./hotspots";
|
||||
import * as linkifiers from "./linkifiers";
|
||||
import * as message_edit from "./message_edit";
|
||||
import * as message_events from "./message_events";
|
||||
import * as message_flags from "./message_flags";
|
||||
import * as message_lists from "./message_lists";
|
||||
@@ -260,9 +259,6 @@ export function dispatch_normal_event(event) {
|
||||
case "default":
|
||||
for (const [key, value] of Object.entries(event.data)) {
|
||||
page_params["realm_" + key] = value;
|
||||
if (key === "allow_message_editing") {
|
||||
message_edit.update_message_topic_editing_pencil();
|
||||
}
|
||||
if (Object.hasOwn(realm_settings, key)) {
|
||||
settings_org.sync_realm_settings(key);
|
||||
}
|
||||
|
||||
@@ -273,7 +273,6 @@ function update_message_edit_sub_settings(is_checked) {
|
||||
"id_realm_message_content_edit_limit_minutes",
|
||||
true,
|
||||
);
|
||||
settings_ui.disable_sub_setting_onchange(is_checked, "id_realm_edit_topic_policy", true);
|
||||
}
|
||||
|
||||
function update_custom_value_input(property_name) {
|
||||
|
||||
Reference in New Issue
Block a user