fix(captions): harden caption editing after review
Address findings from 2 review agents (core edit path was verified correct — media preservation incl. encrypted, threading, no-op guard): - Require a filename (utils/room.ts): canEditCaption now also checks the MSC2530 `filename` exists. Fixes media from clients that omit filename, where the editor prefilled the filename as a caption and clearing it wrote an empty body. Such media simply isn't caption-editable (matches renderCaption never showing a caption for it). - Carry m.mentions (MessageEditor): a caption edit now unions typed @-mentions with prior mentions like the text-edit path, so mentioning someone in a caption edit notifies them. - Double caption: revert to the editor replacing the content while editing (as text edits do) instead of rendering the media + its caption above an editor prefilled with the same caption — removes the confusing duplicate. - Removed-caption "(edited)" marker (RenderMessageContent): when a media message is edited but has no caption (e.g. the caption was removed), render the standalone "(edited)" affordance so Edit History stays reachable (previously it lived only inside the caption and vanished). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,7 @@ import React from 'react';
|
||||
import { MsgType } from 'matrix-js-sdk';
|
||||
import { HTMLReactParserOptions } from 'html-react-parser';
|
||||
import { Opts } from 'linkifyjs';
|
||||
import { config } from 'folds';
|
||||
import { config, Text } from 'folds';
|
||||
import {
|
||||
AudioContent,
|
||||
DownloadFile,
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
MAudio,
|
||||
MBadEncrypted,
|
||||
MEmote,
|
||||
MessageEditedContent,
|
||||
MFile,
|
||||
MImage,
|
||||
MLocation,
|
||||
@@ -119,6 +120,15 @@ export function RenderMessageContent({
|
||||
/>
|
||||
);
|
||||
}
|
||||
// No caption, but the media was edited (e.g. a caption was removed): keep the
|
||||
// "(edited)" affordance so Edit History stays reachable.
|
||||
if (edited) {
|
||||
return (
|
||||
<Text style={{ marginTop: config.space.S200 }} size="T200">
|
||||
<MessageEditedContent onEditHistoryClick={onEditHistoryClick} />
|
||||
</Text>
|
||||
);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user