Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3354151
D7971.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
947 B
Referenced Files
None
Subscribers
None
D7971.diff
View Options
diff --git a/web/chat/edit-text-message.react.js b/web/chat/edit-text-message.react.js
--- a/web/chat/edit-text-message.react.js
+++ b/web/chat/edit-text-message.react.js
@@ -45,6 +45,11 @@
[threadColor],
);
+ const isMessageEmpty = React.useMemo(
+ () => trimMessage(editedMessageDraft) === '',
+ [editedMessageDraft],
+ );
+
const isMessageEdited = React.useMemo(() => {
const { messageInfo } = item;
if (!messageInfo || !messageInfo.text || !editState) {
@@ -59,6 +64,9 @@
const checkAndEdit = async () => {
const { id: messageInfoID } = item.messageInfo;
+ if (isMessageEmpty) {
+ return;
+ }
if (!isMessageEdited) {
clearEditModal();
return;
@@ -149,6 +157,7 @@
variant="filled"
buttonColor={saveButtonColor}
onClick={checkAndEdit}
+ disabled={isMessageEmpty}
>
Save (enter)
</Button>
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 24, 12:03 PM (20 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2575501
Default Alt Text
D7971.diff (947 B)
Attached To
Mode
D7971: [web] Disabled edit button if edited message is empty
Attached
Detach File
Event Timeline
Log In to Comment