Skip to content

Commit c5cd6a7

Browse files
committed
Removed delete message option for message and allowed empty content during editing message
1 parent 77b7e9c commit c5cd6a7

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

src/action-sheets/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ export const constructMessageActionButtons = (args: {|
697697
if (message.isOutbox === true) {
698698
buttons.push(copyToClipboard);
699699
buttons.push(shareMessage);
700-
buttons.push(deleteMessage);
700+
// buttons.push(deleteMessage);
701701
buttons.push(cancel);
702702
return buttons;
703703
}
@@ -728,6 +728,9 @@ export const constructMessageActionButtons = (args: {|
728728
}
729729
if (message.sender_id === ownUser.user_id && messageNotDeleted(message)) {
730730
// TODO(#2793): Don't show if message isn't deletable.
731+
// buttons.push(deleteMessage);
732+
}
733+
if (ownUser.role === 200 && messageNotDeleted(message)) {
731734
buttons.push(deleteMessage);
732735
}
733736
if (

src/chat/ChatScreen.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,9 @@ export default function ChatScreen(props: Props): Node {
131131

132132
const { narrow, editMessage } = route.params;
133133
const setEditMessage = useCallback(
134-
(value: EditMessage | null) => navigation.setParams({ editMessage: value }),
134+
(value: EditMessage | null) => {
135+
navigation.setParams({ editMessage: value });
136+
},
135137
[navigation],
136138
);
137139

@@ -164,7 +166,7 @@ export default function ChatScreen(props: Props): Node {
164166
() => undefined,
165167
);
166168

167-
if ((content !== undefined && content !== '') || (topic !== undefined && topic !== '')) {
169+
if (content !== undefined || (topic !== undefined && topic !== '')) {
168170
api.updateMessage(auth, editMessage.id, { content, subject: topic }).catch(error => {
169171
showErrorAlert(_('Failed to edit message'), error.message);
170172
});

src/compose/ComposeBox.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ const ComposeBox: React$AbstractComponent<Props, ImperativeHandle> = forwardRef(
548548
result.push('mandatory-topic-empty');
549549
}
550550

551-
if (messageInputValue.trim().length === 0) {
551+
if (messageInputValue.trim().length === 0 && !isEditing) {
552552
result.push('message-empty');
553553
}
554554

@@ -567,6 +567,7 @@ const ComposeBox: React$AbstractComponent<Props, ImperativeHandle> = forwardRef(
567567
numUploading,
568568
anyQuoteAndReplyInProgress,
569569
messageInputState,
570+
isEditing,
570571
]);
571572

572573
const submitButtonDisabled = validationErrors.length > 0;

0 commit comments

Comments
 (0)