Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fix-color-parser.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
default: patch
---

Fix opacity rendering in name colors.
5 changes: 5 additions & 0 deletions .changeset/fix-delated-file-uploads.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
default: patch
---

Fix sending scheduled file attachments.
5 changes: 5 additions & 0 deletions .changeset/fix-reply-rendering.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
default: patch
---

Fix replies rendering new lines when messages have lists.
5 changes: 5 additions & 0 deletions .changeset/fix-thread-replies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
default: patch
---

Fix threads rendering fallback replies.
2 changes: 2 additions & 0 deletions src/app/components/message/Reply.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ export const Reply = as<'div', ReplyProps>(
.replaceAll(/<br\s*\/?>/gi, ' ')
.replaceAll(/<\/p>\s*<p[^>]*>/gi, ' ')
.replaceAll(/<\/?p[^>]*>/gi, '')
.replaceAll(/<\/li>\s*<li[^>]*>/gi, ' ')
.replaceAll(/<\/?(ul|ol|li|blockquote|h[1-6]|pre|div)[^>]*>/gi, '')
.replaceAll(/(?:\r\n|\r|\n)/g, ' ');
const parserOpts = getReactCustomHtmlParser(mx, room.roomId, {
linkifyOpts: LINKIFY_OPTS,
Expand Down
88 changes: 67 additions & 21 deletions src/app/features/room/RoomInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -512,28 +512,74 @@ export const RoomInput = forwardRef<HTMLDivElement, RoomInputProps>(
}
}

await Promise.all(
contents.map((content) =>
mx
.sendMessage(roomId, threadRootId ?? null, content as any)
.then((res) => {
debugLog.info('message', 'Uploaded file message sent', {
roomId,
eventId: res.event_id,
msgtype: content.msgtype,
});
return res;
})
.catch((error: unknown) => {
debugLog.error('message', 'Failed to send uploaded file message', {
roomId,
error: error instanceof Error ? error.message : String(error),
});
log.error('failed to send uploaded message', { roomId }, error);
throw error;
const invalidate = () =>
queryClient.invalidateQueries({ queryKey: ['delayedEvents', roomId] });

if (scheduledTime) {
try {
const delayMs = computeDelayMs(scheduledTime);
if (editingScheduledDelayId) {
await cancelDelayedEvent(mx, editingScheduledDelayId);
}

await Promise.all(
contents.map((content) => {
if (isEncrypted) {
return sendDelayedMessageE2EE(mx, roomId, room, content, delayMs);
}
return sendDelayedMessage(mx, roomId, content, delayMs);
})
)
);
);

invalidate();
setEditingScheduledDelayId(null);
setScheduledTime(null);
} catch (error) {
debugLog.error('message', 'Failed to schedule uploaded file message', {
roomId,
error: error instanceof Error ? error.message : String(error),
});
log.error('failed to schedule uploaded message', { roomId }, error);
throw error;
}
} else {
if (editingScheduledDelayId) {
try {
await cancelDelayedEvent(mx, editingScheduledDelayId);
invalidate();
setEditingScheduledDelayId(null);
} catch {
debugLog.error(
'message',
'Failed to cancel scheduled event before immediate file send',
{ roomId }
);
}
}

await Promise.all(
contents.map((content) =>
mx
.sendMessage(roomId, threadRootId ?? null, content as any)
.then((res) => {
debugLog.info('message', 'Uploaded file message sent', {
roomId,
eventId: res.event_id,
msgtype: content.msgtype,
});
return res;
})
.catch((error: unknown) => {
debugLog.error('message', 'Failed to send uploaded file message', {
roomId,
error: error instanceof Error ? error.message : String(error),
});
log.error('failed to send uploaded message', { roomId }, error);
throw error;
})
)
);
}
};

const handleCloseAutocomplete = useCallback(() => {
Expand Down
8 changes: 7 additions & 1 deletion src/app/features/room/ThreadDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,11 @@ function ThreadMessage({

const { replyEventId } = mEvent;

const relation = mEvent.getRelation();
const contentRelatesTo = mEvent.getContent()?.['m.relates_to'];
const isFallback =
relation?.is_falling_back === true || contentRelatesTo?.is_falling_back === true;

return (
<Message
key={mEvent.getId()}
Expand Down Expand Up @@ -214,7 +219,8 @@ function ThreadMessage({
hideReadReceipts={showHideReads}
showDeveloperTools={showDeveloperTools}
reply={
replyEventId && (
replyEventId &&
!isFallback && (
<Reply
room={room}
timelineSet={timelineSet}
Expand Down
3 changes: 2 additions & 1 deletion src/app/hooks/useUserProfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Loading