Skip to content

Commit

Permalink
I have hidden the edit option for the audio/video message, and revert…
Browse files Browse the repository at this point in the history
…ed previous approach of showing popup message
  • Loading branch information
dhairyashiil committed Dec 19, 2024
1 parent 884dab4 commit 0b2ef3e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 19 deletions.
25 changes: 7 additions & 18 deletions packages/react/src/views/Message/Message.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,23 +114,6 @@ const Message = ({
}
};

const handleEditMessage = () => {

if(message.msg == '' && message.files[0]) {
dispatchToastMessage({
type: 'error',
message: 'Editing Audio/Video/File messages is not supported at the moment.',
});
return;
}

if (editMessage._id === message._id) {
setEditMessage({});
} else {
setEditMessage(message);
}
};

const handleDeleteMessage = async (msg) => {
const res = await RCInstance.deleteMessage(msg._id);

Expand Down Expand Up @@ -230,7 +213,13 @@ const Message = ({
handleDeleteMessage={handleDeleteMessage}
handleStarMessage={handleStarMessage}
handlePinMessage={handlePinMessage}
handleEditMessage={handleEditMessage}
handleEditMessage={() => {
if (editMessage._id === message._id) {
setEditMessage({});
} else {
setEditMessage(message);
}
}}
handleQuoteMessage={() => addQuoteMessage(message)}
handleEmojiClick={handleEmojiClick}
handlerReportMessage={() => {
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/views/Message/MessageToolbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export const MessageToolbox = ({
id: 'edit',
onClick: () => handleEditMessage(message),
iconName: 'edit',
visible: message.u._id === authenticatedUserId,
visible: (message.u._id === authenticatedUserId) && (message.files?.[0].type !== 'audio/mpeg') && (message.files?.[0].type !== 'video/mp4'),
color: isEditing ? 'secondary' : 'default',
ghost: !isEditing,
},
Expand Down

0 comments on commit 0b2ef3e

Please sign in to comment.