message_edit_notice_tooltip: Rewrite to fix inverted check.

Apparently, abece73c5a had misconverted
the case where edit history is disabled.
This commit is contained in:
Tim Abbott 2024-09-23 17:29:49 -07:00
parent aeebbbb825
commit 08e04e2195
2 changed files with 13 additions and 8 deletions

View File

@ -364,15 +364,16 @@ export function initialize(): void {
}, },
onShow(instance) { onShow(instance) {
const $elem = $(instance.reference); const $elem = $(instance.reference);
assert(message_lists.current !== undefined);
const message_id = Number($elem.closest(".message_row").attr("data-message-id")); const message_id = Number($elem.closest(".message_row").attr("data-message-id"));
assert(message_lists.current !== undefined);
const message_container = message_lists.current.view.message_containers.get(message_id); const message_container = message_lists.current.view.message_containers.get(message_id);
assert(message_container !== undefined); assert(message_container !== undefined);
const last_edit_timestr = get_last_edit_timestr(message_container.msg); const last_edit_timestr = get_last_edit_timestr(message_container.msg);
instance.setContent( instance.setContent(
parse_html( parse_html(
render_message_edit_notice_tooltip({ render_message_edit_notice_tooltip({
message_container, moved: message_container.moved,
last_edit_timestr, last_edit_timestr,
realm_allow_edit_history: realm.realm_allow_edit_history, realm_allow_edit_history: realm.realm_allow_edit_history,
}), }),

View File

@ -1,11 +1,15 @@
<div> <div>
<div>{{t "View edit history"}}</div>
{{#if realm_allow_edit_history}} {{#if realm_allow_edit_history}}
{{#if message_container/moved}} <div>{{t "View edit history"}}</div>
<div class="tooltip-inner-content italic">{{t 'Last moved {last_edit_timestr}.'}}</div>
{{else}}
<div class="tooltip-inner-content italic">{{t 'Last edited {last_edit_timestr}.'}}</div>
{{/if}}
{{/if}} {{/if}}
<div class="tooltip-inner-content italic">
{{#if moved}}
{{t 'Last moved {last_edit_timestr}.'}}
{{else}}
{{t 'Last edited {last_edit_timestr}.'}}
{{/if}}
</div>
</div> </div>
{{#if realm_allow_edit_history}}
{{tooltip_hotkey_hints "Shift" "H"}} {{tooltip_hotkey_hints "Shift" "H"}}
{{/if}}