Happily handle empty text messages (#6825)
This commig refactors the message-deletion modal and reuses it for case of removing the entire message and trying to send it, which should trigger removal flow instead. Fix vector-im/element-web#18873
This commit is contained in:
parent
e95e59e2eb
commit
8331d4c7b7
4 changed files with 57 additions and 31 deletions
|
@ -42,6 +42,7 @@ import ErrorDialog from "../dialogs/ErrorDialog";
|
|||
import QuestionDialog from "../dialogs/QuestionDialog";
|
||||
import { ActionPayload } from "../../../dispatcher/payloads";
|
||||
import AccessibleButton from '../elements/AccessibleButton';
|
||||
import { createRedactEventDialog } from '../dialogs/ConfirmRedactDialog';
|
||||
import SettingsStore from "../../../settings/SettingsStore";
|
||||
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
|
@ -331,6 +332,14 @@ export default class EditMessageComposer extends React.Component<IProps, IState>
|
|||
|
||||
let shouldSend = true;
|
||||
|
||||
if (newContent?.body === '') {
|
||||
this.cancelPreviousPendingEdit();
|
||||
createRedactEventDialog({
|
||||
mxEvent: editedEvent,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// If content is modified then send an updated event into the room
|
||||
if (this.isContentModified(newContent)) {
|
||||
const roomId = editedEvent.getRoomId();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue