mirror of
https://github.com/zulip/zulip.git
synced 2025-11-07 15:33:30 +00:00
message_edit: Apply topic edit restrictions to "(no topic)" messages.
Previously, editing topic of "(no topic)" messages was allowed irrespective of time limit or the "edit_topic_policy" setting. Since we are working in the direction of having "no topic" messages feel reasonable, this commit changes the code to not consider them as a special case and topic editing restrictions apply to them as well now like all other messages. We still highlight the topic edit icon in recipient bar without hovering for "no topic" messages, but it is only shown when user has permission to edit topics.
This commit is contained in:
@@ -156,14 +156,21 @@ function set_timestr(message_container) {
|
||||
function set_topic_edit_properties(group, message) {
|
||||
group.always_visible_topic_edit = false;
|
||||
group.on_hover_topic_edit = false;
|
||||
|
||||
const is_topic_editable = message_edit.is_topic_editable(message);
|
||||
|
||||
// if a user who can edit a topic, can resolve it as well
|
||||
group.user_can_resolve_topic = message_edit.is_topic_editable(message);
|
||||
group.user_can_resolve_topic = is_topic_editable;
|
||||
|
||||
if (!is_topic_editable) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Messages with no topics should always have an edit icon visible
|
||||
// to encourage updating them. Admins can also edit any topic.
|
||||
if (message.topic === compose.empty_topic_placeholder()) {
|
||||
group.always_visible_topic_edit = true;
|
||||
} else if (message_edit.is_topic_editable(message)) {
|
||||
} else {
|
||||
group.on_hover_topic_edit = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user