Skip to content

Commit e857201

Browse files
committed
fix(MessageForwarding): removed null from forwarding metadata
1 parent 0fcc38c commit e857201

2 files changed

Lines changed: 14 additions & 7 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
default: patch
3+
---
4+
5+
fix forwarding metadata by removing the `null` value

src/app/components/message/modals/MessageForward.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ type ForwardMeta = {
9393

9494
// see https://github.com/hummlbach/matrix-doc/blob/acea0854a1c9489599295a858b068ce02a6b2b20/proposals/2723-add-forward-info.md
9595
type MSC2723ForwardMeta = {
96-
event_id: string;
97-
room_id: string;
98-
sender: string | null; // we won't set this field
96+
event_id?: string;
97+
room_id?: string;
98+
sender?: string; // we won't set this field
9999
origin_server_ts: number;
100100
};
101101

@@ -205,9 +205,9 @@ export function MessageForwardInternal({
205205
newBodyPlain = originalBody.length > 0 ? `${bodyModifText}\n\n${quotedBody}` : bodyModifText;
206206

207207
const safeHtml =
208-
originalFormattedBody !== undefined
209-
? sanitizeCustomHtml(originalFormattedBody)
210-
: sanitizeCustomHtml(originalBody).replaceAll('\n', '<br>');
208+
originalFormattedBody === undefined
209+
? sanitizeCustomHtml(originalBody).replaceAll('\n', '<br>')
210+
: sanitizeCustomHtml(originalFormattedBody);
211211

212212
newBodyHtml =
213213
`<div data-forward-marker>` +
@@ -241,6 +241,9 @@ export function MessageForwardInternal({
241241
original_timestamp: mEvent.getTs(),
242242
original_event_private: true,
243243
} satisfies ForwardMeta,
244+
'com.famedly.app.forwarded': {
245+
origin_server_ts: mEvent.getTs(),
246+
} satisfies MSC2723ForwardMeta,
244247
};
245248
} else {
246249
content = {
@@ -261,7 +264,6 @@ export function MessageForwardInternal({
261264
'com.famedly.app.forwarded': {
262265
event_id: eventId,
263266
room_id: room.roomId,
264-
sender: null, // we won't set this field, as a design decision to avoid potential privacy issues and since the sender can be inferred from the event_id and room_id if needed
265267
origin_server_ts: mEvent.getTs(),
266268
} satisfies MSC2723ForwardMeta,
267269
};

0 commit comments

Comments
 (0)