Attach composer IRelation to slash commands content (#7125)

This commit is contained in:
Germain 2021-11-12 12:43:52 +00:00 committed by GitHub
parent 1e50636520
commit 77c79467c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -64,7 +64,6 @@ function addReplyToMessageContent(
content: IContent,
replyToEvent: MatrixEvent,
permalinkCreator: RoomPermalinkCreator,
relation?: IEventRelation,
): void {
const replyContent = ReplyChain.makeReplyMixIn(replyToEvent);
Object.assign(content, replyContent);
@ -78,7 +77,12 @@ function addReplyToMessageContent(
}
content.body = nestedReply.body + content.body;
}
}
export function attachRelation(
content: IContent,
relation?: IEventRelation,
): void {
if (relation) {
content['m.relates_to'] = {
...relation, // the composer can have a default
@ -417,9 +421,9 @@ export class SendMessageComposer extends React.Component<ISendMessageComposerPro
content,
replyToEvent,
this.props.permalinkCreator,
this.props.relation,
);
}
attachRelation(content, this.props.relation);
} else {
this.runSlashCommand(cmd, args);
shouldSend = false;