Skip to content

Commit 7e1a196

Browse files
committed
Readded Delete Message Button for own user and outBox, and ensured delete message is avaliable for all roles above admin
1 parent e4d162c commit 7e1a196

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

src/action-sheets/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,7 @@ export const constructMessageActionButtons = (args: {|
692692
|}): Button<MessageArgs>[] => {
693693
const { backgroundData, message, narrow, canStartQuoteAndReply } = args;
694694
const { ownUser, flags } = backgroundData;
695+
const { role } = ownUser;
695696
const buttons = [];
696697

697698
if (message.isOutbox === true) {
@@ -730,6 +731,9 @@ export const constructMessageActionButtons = (args: {|
730731
// TODO(#2793): Don't show if message isn't deletable.
731732
buttons.push(deleteMessage);
732733
}
734+
if (roleIsAtLeast(role, Role.Admin) && messageNotDeleted(message)) {
735+
buttons.push(deleteMessage);
736+
}
733737
if (
734738
// When do we offer "Mark as unread from here"? This logic parallels
735739
// `should_display_mark_as_unread` in web's static/js/popovers.js .

src/chat/ChatScreen.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ export default function ChatScreen(props: Props): Node {
164164
() => undefined,
165165
);
166166

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

src/compose/ComposeBox.js

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

524-
if (messageInputValue.trim().length === 0) {
524+
if (messageInputValue.trim().length === 0 && !isEditing) {
525525
result.push('message-empty');
526526
}
527527

@@ -540,6 +540,7 @@ const ComposeBox: React$AbstractComponent<Props, ImperativeHandle> = forwardRef(
540540
numUploading,
541541
anyQuoteAndReplyInProgress,
542542
messageInputState,
543+
isEditing,
543544
]);
544545

545546
const submitButtonDisabled = validationErrors.length > 0;

0 commit comments

Comments
 (0)