message_history: Improve overlay header.

If users are only allowed to view move history, the header
is 'Message move history.' If users are allowed to view edit
and move history and the message is edited and moved, the header
is 'Message edit and move history.' Otherwise, it shows 'Message
edit history.' If the message is only moved (and not edited), it
shows 'Message move history.'

Fixes #34005.
This commit is contained in:
minhphung152
2025-03-18 11:02:29 -04:00
committed by Tim Abbott
parent f8bedf3e3a
commit b4435ac4f3
2 changed files with 17 additions and 2 deletions

View File

@@ -114,11 +114,18 @@ function hide_loading_indicator(): void {
}
export function fetch_and_render_message_history(message: Message): void {
assert(message_lists.current !== undefined);
const message_container = message_lists.current.view.message_containers.get(message.id);
assert(message_container !== undefined);
const move_history_only =
realm.realm_message_edit_history_visibility_policy ===
message_edit_history_visibility_policy_values.moves_only.code;
$("#message-edit-history-overlay-container").html(
render_message_history_overlay({move_history_only}),
render_message_history_overlay({
moved: message_container.moved,
edited: message_container.edited,
move_history_only,
}),
);
open_overlay();
show_loading_indicator();

View File

@@ -5,8 +5,16 @@
{{#if move_history_only}}
<h1>{{t "Message move history" }}</h1>
{{else}}
{{#if edited}}
{{#if moved}}
<h1>{{t "Message edit and move history" }}</h1>
{{else}}
<h1>{{t "Message edit history" }}</h1>
{{/if}}
{{else if moved}}
<h1>{{t "Message move history" }}</h1>
{{/if}}
{{/if}}
<div class="exit">
<span class="exit-sign">&times;</span>
</div>