Add replied-to username to reply previews in DMs

This commit is contained in:
Alessio 2024-11-06 19:44:08 -08:00
parent c7a6b5b321
commit 212c1b4e50
2 changed files with 11 additions and 1 deletions

View File

@ -1463,7 +1463,7 @@ main {
} }
} }
.dm-replying-to__preview-text { .dm-replying-to__preview-text, .dm-replying-to__username {
cursor: pointer; cursor: pointer;
} }
} }

View File

@ -12,6 +12,12 @@
<div class="dm-replying-to__label labelled-icon"> <div class="dm-replying-to__label labelled-icon">
<img class="svg-icon" src="/static/icons/replying_to.svg" width="24" height="24" /> <img class="svg-icon" src="/static/icons/replying_to.svg" width="24" height="24" />
<label>Replying to</label> <label>Replying to</label>
<span class="dm-replying-to__username"
data-replying-to-message-id="{{ .InReplyToID }}"
onclick="handleReplyingToClicked(this)"
>
{{ (user (dm_message .InReplyToID).SenderID).DisplayName }}
</span>
</div> </div>
<div class="dm-replying-to__preview-text" <div class="dm-replying-to__preview-text"
data-replying-to-message-id="{{ .InReplyToID }}" data-replying-to-message-id="{{ .InReplyToID }}"
@ -312,6 +318,10 @@
/** /**
* Define callback on-click handler for 'replying-to' previews; they should scroll the replied-to * Define callback on-click handler for 'replying-to' previews; they should scroll the replied-to
* message into view, if possible. * message into view, if possible.
*
* Takes an element holding the data instead of the data itself, because the composer box and
* actual messages share this function; the composer box's "data-replying-to-message-id" can
* change.
*/ */
function handleReplyingToClicked(replying_to_box) { function handleReplyingToClicked(replying_to_box) {
const replied_to_id = replying_to_box.getAttribute("data-replying-to-message-id"); const replied_to_id = replying_to_box.getAttribute("data-replying-to-message-id");