From e81d24e0ea0c03545129aaeed784433af205bf3e Mon Sep 17 00:00:00 2001 From: 7w1 Date: Mon, 16 Mar 2026 23:32:00 -0500 Subject: [PATCH] fix colors and threads --- .changeset/fix-color-parser.md | 5 +++++ .changeset/fix-thread-replies.md | 5 +++++ src/app/features/room/ThreadDrawer.tsx | 10 ++++++++-- src/app/hooks/useUserProfile.ts | 3 ++- 4 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 .changeset/fix-color-parser.md create mode 100644 .changeset/fix-thread-replies.md diff --git a/.changeset/fix-color-parser.md b/.changeset/fix-color-parser.md new file mode 100644 index 00000000..0abdd893 --- /dev/null +++ b/.changeset/fix-color-parser.md @@ -0,0 +1,5 @@ +--- +default: patch +--- + +Fix opacity rendering in name colors. diff --git a/.changeset/fix-thread-replies.md b/.changeset/fix-thread-replies.md new file mode 100644 index 00000000..d10cf9d9 --- /dev/null +++ b/.changeset/fix-thread-replies.md @@ -0,0 +1,5 @@ +--- +default: patch +--- + +Fix threads rendering fallback replies. diff --git a/src/app/features/room/ThreadDrawer.tsx b/src/app/features/room/ThreadDrawer.tsx index fd7075bf..fb32d3bb 100644 --- a/src/app/features/room/ThreadDrawer.tsx +++ b/src/app/features/room/ThreadDrawer.tsx @@ -482,7 +482,12 @@ export function ThreadDrawer({ room, threadRootId, onClose, overlay }: ThreadDra const thread = room.getThread(threadRootId); const fromThread = thread?.events ?? []; if (fromThread.length > 0) { - return fromThread.filter((ev) => ev.getId() !== threadRootId && !reactionOrEditEvent(ev)); + return fromThread.filter( + (ev) => + ev.getId() !== threadRootId && + !reactionOrEditEvent(ev) && + ev.getContent()?.['m.relates_to']?.is_falling_back !== true + ); } return room .getUnfilteredTimelineSet() @@ -492,7 +497,8 @@ export function ThreadDrawer({ room, threadRootId, onClose, overlay }: ThreadDra (ev) => ev.threadRootId === threadRootId && ev.getId() !== threadRootId && - !reactionOrEditEvent(ev) + !reactionOrEditEvent(ev) && + ev.getContent()?.['m.relates_to']?.is_falling_back !== true ); })(); diff --git a/src/app/hooks/useUserProfile.ts b/src/app/hooks/useUserProfile.ts index 22ffa5b2..8de5da05 100644 --- a/src/app/hooks/useUserProfile.ts +++ b/src/app/hooks/useUserProfile.ts @@ -69,7 +69,8 @@ const isValidHex = (c: any): string | undefined => { if (typeof c !== 'string') return undefined; // silly tuwunel smh const cleaned = c.replaceAll(/["']/g, '').trim(); - return /^#([0-9A-F]{3,6})$/i.test(cleaned) ? cleaned : undefined; + // Strictly allow only 3 or 6 digit hex codes, aka no opacity + return /^#([0-9A-F]{3}|[0-9A-F]{6})$/i.test(cleaned) ? cleaned : undefined; }; const sanitizeFont = (f: string) => f.replaceAll(/[;{}<>]/g, '').slice(0, 32);