Skip to content

Commit

Permalink
fix: review
Browse files Browse the repository at this point in the history
  • Loading branch information
dougfabris authored Jan 2, 2024
1 parent 5db7320 commit d8288b8
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions apps/meteor/client/startup/actionButtons/pinMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,28 @@ Meteor.startup(() => {
context: ['pinned', 'message', 'message-mobile', 'threads', 'direct', 'videoconf', 'videoconf-threads'],
async action(_, props) {
const { message = messageArgs(this).msg } = props;
const onCloseModal = () => {
imperativeModal.close();
};
const onConfirm = async (): Promise<void> => {

const handleConfirm = async () => {
message.pinned = true;
try {
await sdk.call('pinMessage', message);
queryClient.invalidateQueries(['rooms', message.rid, 'pinned-messages']);
} catch (error) {
dispatchToastMessage({ type: 'error', message: error });
}
onCloseModal();
imperativeModal.close();
};

imperativeModal.open({
component: GenericModal,
props: {
title: 'Are you sure you want to pin this message?',
variant: 'info',
variant: 'warning',
icon: null,
confirmText: 'Yes pin it',
onConfirm,
onClose: onCloseModal,
onCancel: onCloseModal,
onConfirm: handleConfirm,
onClose: () => imperativeModal.close(),
onCancel: () => imperativeModal.close(),
},
});
},
Expand Down

0 comments on commit d8288b8

Please sign in to comment.