message_list_view: Remove always_visible_topic_edit.

We no longer have "(no topic)" placeholder for empty string topic,
so there's no need to push for configuring a topic.
This commit is contained in:
Prakhar Pratyush
2025-02-20 11:15:58 +05:30
committed by Tim Abbott
parent 995724225f
commit 7cfe3b7828
5 changed files with 2 additions and 31 deletions

View File

@@ -322,7 +322,7 @@ export function initialize(): void {
); );
e.stopPropagation(); e.stopPropagation();
}); });
$("body").on("click", ".always_visible_topic_edit,.on_hover_topic_edit", function (e) { $("body").on("click", ".on_hover_topic_edit", function (e) {
const $recipient_row = $(this).closest(".recipient_row"); const $recipient_row = $(this).closest(".recipient_row");
message_edit.start_inline_topic_edit($recipient_row); message_edit.start_inline_topic_edit($recipient_row);
e.stopPropagation(); e.stopPropagation();

View File

@@ -542,7 +542,6 @@ export class MessageList {
$recipient_row.find(".on_hover_topic_edit").hide(); $recipient_row.find(".on_hover_topic_edit").hide();
$recipient_row.find(".stream_topic").hide(); $recipient_row.find(".stream_topic").hide();
$recipient_row.find(".topic_edit").show(); $recipient_row.find(".topic_edit").show();
$recipient_row.find(".always_visible_topic_edit").hide();
$recipient_row.find(".on_hover_topic_resolve").hide(); $recipient_row.find(".on_hover_topic_resolve").hide();
$recipient_row.find(".on_hover_topic_unresolve").hide(); $recipient_row.find(".on_hover_topic_unresolve").hide();
} }
@@ -552,7 +551,6 @@ export class MessageList {
$recipient_row.find(".on_hover_topic_edit").show(); $recipient_row.find(".on_hover_topic_edit").show();
$recipient_row.find(".topic_edit_form").empty(); $recipient_row.find(".topic_edit_form").empty();
$recipient_row.find(".topic_edit").hide(); $recipient_row.find(".topic_edit").hide();
$recipient_row.find(".always_visible_topic_edit").show();
$recipient_row.find(".on_hover_topic_resolve").show(); $recipient_row.find(".on_hover_topic_resolve").show();
$recipient_row.find(".on_hover_topic_unresolve").show(); $recipient_row.find(".on_hover_topic_unresolve").show();
} }

View File

@@ -14,7 +14,6 @@ import render_single_message from "../templates/single_message.hbs";
import * as activity from "./activity.ts"; import * as activity from "./activity.ts";
import * as blueslip from "./blueslip.ts"; import * as blueslip from "./blueslip.ts";
import * as compose_fade from "./compose_fade.ts"; import * as compose_fade from "./compose_fade.ts";
import * as compose_state from "./compose_state.ts";
import * as condense from "./condense.ts"; import * as condense from "./condense.ts";
import * as hash_util from "./hash_util.ts"; import * as hash_util from "./hash_util.ts";
import {$t} from "./i18n.ts"; import {$t} from "./i18n.ts";
@@ -88,7 +87,6 @@ export type MessageGroup = {
| { | {
is_stream: true; is_stream: true;
all_visibility_policies: AllVisibilityPolicies; all_visibility_policies: AllVisibilityPolicies;
always_visible_topic_edit: boolean;
display_recipient: string; display_recipient: string;
invite_only: boolean; invite_only: boolean;
is_subscribed: boolean; is_subscribed: boolean;
@@ -96,7 +94,6 @@ export type MessageGroup = {
is_web_public: boolean; is_web_public: boolean;
just_unsubscribed?: boolean; just_unsubscribed?: boolean;
match_topic: string | undefined; match_topic: string | undefined;
on_hover_topic_edit: boolean;
recipient_bar_color: string; recipient_bar_color: string;
stream_id: number; stream_id: number;
stream_name?: string; stream_name?: string;
@@ -300,35 +297,14 @@ function get_timestr(message: Message): string {
} }
function get_topic_edit_properties(message: Message): { function get_topic_edit_properties(message: Message): {
always_visible_topic_edit: boolean;
on_hover_topic_edit: boolean;
is_topic_editable: boolean; is_topic_editable: boolean;
user_can_resolve_topic: boolean; user_can_resolve_topic: boolean;
} { } {
let always_visible_topic_edit = false;
let on_hover_topic_edit = false;
const is_topic_editable = message_edit.is_topic_editable(message); const is_topic_editable = message_edit.is_topic_editable(message);
// if a user who can edit a topic, can resolve it as well // if a user who can edit a topic, can resolve it as well
const user_can_resolve_topic = is_topic_editable; const user_can_resolve_topic = is_topic_editable;
if (is_topic_editable) {
// Messages with no topics should always have an edit icon visible
// to encourage updating them. Admins can also edit any topic.
if (
message.type === "stream" &&
message.topic === compose_state.empty_topic_placeholder()
) {
always_visible_topic_edit = true;
} else {
on_hover_topic_edit = true;
}
}
return { return {
always_visible_topic_edit,
on_hover_topic_edit,
is_topic_editable, is_topic_editable,
user_can_resolve_topic, user_can_resolve_topic,
}; };

View File

@@ -267,7 +267,6 @@
} }
} }
.always_visible_topic_edit,
.on_hover_topic_read { .on_hover_topic_read {
opacity: 0.7; opacity: 0.7;

View File

@@ -48,9 +48,7 @@
{{/each}} {{/each}}
{{! edit topic pencil icon }} {{! edit topic pencil icon }}
{{#if always_visible_topic_edit}} {{#if is_topic_editable}}
<i class="fa fa-pencil always_visible_topic_edit recipient_bar_icon hidden-for-spectators" data-tippy-content="{{t 'Edit topic'}}" role="button" tabindex="0" aria-label="{{t 'Edit topic' }}"></i>
{{else if on_hover_topic_edit}}
<i class="fa fa-pencil on_hover_topic_edit recipient_bar_icon hidden-for-spectators" data-tippy-content="{{t 'Edit topic'}}" role="button" tabindex="0" aria-label="{{t 'Edit topic' }}"></i> <i class="fa fa-pencil on_hover_topic_edit recipient_bar_icon hidden-for-spectators" data-tippy-content="{{t 'Edit topic'}}" role="button" tabindex="0" aria-label="{{t 'Edit topic' }}"></i>
{{/if}} {{/if}}