[FIX] Can't copy or edit media's description (#2885)

* [FIX] Image descriptions issues

* shorten the condition string

* fix selectedMessage state

Co-authored-by: Diego Mello <diegolmello@gmail.com>
This commit is contained in:
Gung Wah 2021-02-24 01:24:05 +08:00 committed by GitHub
parent 450aca4d7c
commit 5b518b4207
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -171,7 +171,7 @@ const MessageActions = React.memo(forwardRef(({
const handleCopy = async(message) => {
logEvent(events.ROOM_MSG_ACTION_COPY);
await Clipboard.setString(message.msg);
await Clipboard.setString(message?.attachments?.[0]?.description || message.msg);
EventEmitter.emit(LISTENER, { message: I18n.t('Copied_to_clipboard') });
};

View File

@ -533,7 +533,14 @@ class RoomView extends React.Component {
}
onEditInit = (message) => {
this.setState({ selectedMessage: message, editing: true });
const newMessage = {
id: message.id,
subscription: {
id: message.subscription.id
},
msg: message?.attachments?.[0]?.description || message.msg
};
this.setState({ selectedMessage: newMessage, editing: true });
}
onEditCancel = () => {