Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixup! web/timeline: render MSC4144 per-message profiles
Browse files Browse the repository at this point in the history
Signed-off-by: Sumner Evans <[email protected]>
sumnerevans committed Jan 3, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 02894a9 commit 4ff73a0
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions web/src/ui/timeline/ReplyBody.tsx
Original file line number Diff line number Diff line change
@@ -103,6 +103,15 @@ export const ReplyBody = ({
classNames.push("small")
}
const perMessageSender = getPerMessageProfile(event)
let renderMemberEvtContent = memberEvtContent
if (perMessageSender) {
renderMemberEvtContent = {
membership: "join",
displayname: perMessageSender.displayname ?? memberEvtContent?.displayname,
avatar_url: perMessageSender.avatar_url ?? memberEvtContent?.avatar_url,
avatar_file: perMessageSender.avatar_file ?? memberEvtContent?.avatar_file,
}
}
const userColorIndex = getUserColorIndex(perMessageSender?.id ?? event.sender)
classNames.push(`sender-color-${userColorIndex}`)
return <blockquote data-reply-to={event.event_id} className={classNames.join(" ")} onClick={onClickReply}>
@@ -115,15 +124,15 @@ export const ReplyBody = ({
<img
className="small avatar"
loading="lazy"
src={getAvatarURL(perMessageSender?.id ?? event.sender, perMessageSender ?? memberEvtContent)}
src={getAvatarURL(perMessageSender?.id ?? event.sender, renderMemberEvtContent)}
alt=""
/>
</div>
<span
className={`event-sender sender-color-${userColorIndex}`}
title={perMessageSender ? perMessageSender.id : event.sender}
>
{getDisplayname(event.sender, perMessageSender ?? memberEvtContent)}
{getDisplayname(event.sender, renderMemberEvtContent)}
</span>
{perMessageSender && <div className="per-message-event-sender">
<span className="via">via</span>
2 changes: 1 addition & 1 deletion web/src/ui/timeline/TimelineEvent.tsx
Original file line number Diff line number Diff line change
@@ -114,7 +114,6 @@ const TimelineEvent = ({ evt, prevEvt, disableMenu, smallReplies, isFocused }: T
}
const memberEvt = useRoomMember(client, roomCtx.store, evt.sender)
const memberEvtContent = memberEvt?.content as MemberEventContent | undefined
let renderMemberEvtContent = memberEvtContent
const BodyType = getBodyType(evt)
const eventTS = new Date(evt.timestamp)
const editEventTS = evt.last_edit ? new Date(evt.last_edit.timestamp) : null
@@ -173,6 +172,7 @@ const TimelineEvent = ({ evt, prevEvt, disableMenu, smallReplies, isFocused }: T
}
const perMessageSender = getPerMessageProfile(evt)
const prevPerMessageSender = getPerMessageProfile(prevEvt)
let renderMemberEvtContent = memberEvtContent
if (perMessageSender) {
renderMemberEvtContent = {
membership: "join",

0 comments on commit 4ff73a0

Please sign in to comment.