From 6ec661bb0642810a0e2ba73a38ab65982c6c5711 Mon Sep 17 00:00:00 2001 From: Tasso Evangelista Date: Fri, 3 Jan 2025 19:24:52 -0300 Subject: [PATCH] refactor: Correct call of `setModal` (#34871) --- apps/meteor/client/apps/gameCenter/GameCenterList.tsx | 2 +- .../meteor/client/providers/CallProvider/CallProvider.tsx | 2 +- .../client/sidebar/header/hooks/useCreateRoomModal.tsx | 2 +- .../client/sidebarv2/header/hooks/useCreateRoomModal.tsx | 2 +- .../client/views/account/profile/AccountProfilePage.tsx | 8 ++++---- .../client/views/admin/customEmoji/EditCustomEmoji.tsx | 6 +++--- apps/meteor/client/views/admin/customSounds/EditSound.tsx | 6 +++--- .../views/admin/customUserStatus/CustomUserStatusForm.tsx | 6 +++--- apps/meteor/client/views/admin/oauthApps/EditOauthApp.tsx | 6 +++--- .../actions/useChangeModeratorAction.tsx | 6 +++--- .../useUserInfoActions/actions/useChangeOwnerAction.tsx | 4 ++-- 11 files changed, 25 insertions(+), 25 deletions(-) diff --git a/apps/meteor/client/apps/gameCenter/GameCenterList.tsx b/apps/meteor/client/apps/gameCenter/GameCenterList.tsx index 32537f75a3cd..0318ab701c50 100644 --- a/apps/meteor/client/apps/gameCenter/GameCenterList.tsx +++ b/apps/meteor/client/apps/gameCenter/GameCenterList.tsx @@ -24,7 +24,7 @@ const GameCenterList = ({ handleClose, handleOpenGame, games, isLoading }: IGame const handleClose = (): void => { setModal(null); }; - setModal(() => ); + setModal(); }, [setModal], ); diff --git a/apps/meteor/client/providers/CallProvider/CallProvider.tsx b/apps/meteor/client/providers/CallProvider/CallProvider.tsx index 6110cf217fbb..02d508e544a2 100644 --- a/apps/meteor/client/providers/CallProvider/CallProvider.tsx +++ b/apps/meteor/client/providers/CallProvider/CallProvider.tsx @@ -94,7 +94,7 @@ export const CallProvider = ({ children }: CallProviderProps) => { ); const openWrapUpModal = useCallback((): void => { - setModal(() => ); + setModal(); }, [closeRoom, setModal]); const changeAudioOutputDevice = useMutableCallback((selectedAudioDevice: Device): void => { diff --git a/apps/meteor/client/sidebar/header/hooks/useCreateRoomModal.tsx b/apps/meteor/client/sidebar/header/hooks/useCreateRoomModal.tsx index 38c858d0d6f5..a1581c404850 100644 --- a/apps/meteor/client/sidebar/header/hooks/useCreateRoomModal.tsx +++ b/apps/meteor/client/sidebar/header/hooks/useCreateRoomModal.tsx @@ -10,6 +10,6 @@ export const useCreateRoomModal = (Component: ElementType<{ onClose: () => void setModal(null); }; - setModal(() => ); + setModal(); }); }; diff --git a/apps/meteor/client/sidebarv2/header/hooks/useCreateRoomModal.tsx b/apps/meteor/client/sidebarv2/header/hooks/useCreateRoomModal.tsx index a5e26cf8227b..d1af9eb35599 100644 --- a/apps/meteor/client/sidebarv2/header/hooks/useCreateRoomModal.tsx +++ b/apps/meteor/client/sidebarv2/header/hooks/useCreateRoomModal.tsx @@ -10,6 +10,6 @@ export const useCreateRoomModal = (Component: FC): (() => void) => { setModal(null); }; - setModal(() => ); + setModal(); }); }; diff --git a/apps/meteor/client/views/account/profile/AccountProfilePage.tsx b/apps/meteor/client/views/account/profile/AccountProfilePage.tsx index 730ff507e545..bc8a267165f7 100644 --- a/apps/meteor/client/views/account/profile/AccountProfilePage.tsx +++ b/apps/meteor/client/views/account/profile/AccountProfilePage.tsx @@ -76,7 +76,7 @@ const AccountProfilePage = (): ReactElement => { } }; - return setModal(() => ( + return setModal( setModal(null)} @@ -84,8 +84,8 @@ const AccountProfilePage = (): ReactElement => { confirmText={t('Delete')} shouldChangeOwner={shouldChangeOwner} shouldBeRemoved={shouldBeRemoved} - /> - )); + />, + ); }, [erasureType, setModal, t, deleteOwnAccount, dispatchToastMessage, logout], ); @@ -106,7 +106,7 @@ const AccountProfilePage = (): ReactElement => { } }; - return setModal(() => setModal(null)} isPassword={hasLocalPassword} />); + return setModal( setModal(null)} isPassword={hasLocalPassword} />); }, [dispatchToastMessage, hasLocalPassword, setModal, handleConfirmOwnerChange, deleteOwnAccount, logout, t]); const profileFormId = useUniqueId(); diff --git a/apps/meteor/client/views/admin/customEmoji/EditCustomEmoji.tsx b/apps/meteor/client/views/admin/customEmoji/EditCustomEmoji.tsx index 16ac6670d5bb..431f5671aeff 100644 --- a/apps/meteor/client/views/admin/customEmoji/EditCustomEmoji.tsx +++ b/apps/meteor/client/views/admin/customEmoji/EditCustomEmoji.tsx @@ -115,11 +115,11 @@ const EditCustomEmoji = ({ close, onChange, data, ...props }: EditCustomEmojiPro setModal(null); }; - setModal(() => ( + setModal( {t('Custom_Emoji_Delete_Warning')} - - )); + , + ); }, [setModal, deleteAction, _id, dispatchToastMessage, t, onChange, close]); const handleChangeAliases = useCallback( diff --git a/apps/meteor/client/views/admin/customSounds/EditSound.tsx b/apps/meteor/client/views/admin/customSounds/EditSound.tsx index 2c0e82061b3d..f98ddd5ae8ff 100644 --- a/apps/meteor/client/views/admin/customSounds/EditSound.tsx +++ b/apps/meteor/client/views/admin/customSounds/EditSound.tsx @@ -115,11 +115,11 @@ function EditSound({ close, onChange, data, ...props }: EditSoundProps): ReactEl const handleCancel = (): void => setModal(null); - setModal(() => ( + setModal( {t('Custom_Sound_Delete_Warning')} - - )); + , + ); }, [_id, close, deleteCustomSound, dispatchToastMessage, onChange, setModal, t]); const [clickUpload] = useSingleFileInput(handleChangeFile, 'audio/mp3'); diff --git a/apps/meteor/client/views/admin/customUserStatus/CustomUserStatusForm.tsx b/apps/meteor/client/views/admin/customUserStatus/CustomUserStatusForm.tsx index 22ad9517f338..29adabce787d 100644 --- a/apps/meteor/client/views/admin/customUserStatus/CustomUserStatusForm.tsx +++ b/apps/meteor/client/views/admin/customUserStatus/CustomUserStatusForm.tsx @@ -74,11 +74,11 @@ const CustomUserStatusForm = ({ onClose, onReload, status }: CustomUserStatusFor } }; - setModal(() => ( + setModal( {t('Custom_User_Status_Delete_Warning')} - - )); + , + ); }, [_id, route, deleteStatus, dispatchToastMessage, onReload, setModal, t]); const presenceOptions: SelectOption[] = [ diff --git a/apps/meteor/client/views/admin/oauthApps/EditOauthApp.tsx b/apps/meteor/client/views/admin/oauthApps/EditOauthApp.tsx index b1b4e27d4380..d27aad6f7d7e 100644 --- a/apps/meteor/client/views/admin/oauthApps/EditOauthApp.tsx +++ b/apps/meteor/client/views/admin/oauthApps/EditOauthApp.tsx @@ -87,7 +87,7 @@ const EditOauthApp = ({ onChange, data, ...props }: EditOauthAppProps): ReactEle }, [data._id, close, deleteApp, dispatchToastMessage, setModal, t]); const openConfirmDelete = (): void => - setModal(() => ( + setModal( {t('Application_delete_warning')} - - )); + , + ); return ( diff --git a/apps/meteor/client/views/room/hooks/useUserInfoActions/actions/useChangeModeratorAction.tsx b/apps/meteor/client/views/room/hooks/useUserInfoActions/actions/useChangeModeratorAction.tsx index e5c0f1d4824e..594f2800a15a 100644 --- a/apps/meteor/client/views/room/hooks/useUserInfoActions/actions/useChangeModeratorAction.tsx +++ b/apps/meteor/client/views/room/hooks/useUserInfoActions/actions/useChangeModeratorAction.tsx @@ -107,7 +107,7 @@ export const useChangeModeratorAction = (user: Pick, const changingOwnRole = userId === loggedUserId; if (changingOwnRole && loggedUserIsModerator) { - return setModal(() => + return setModal( getWarningModalForFederatedRooms( closeModal, handleConfirm, @@ -119,7 +119,7 @@ export const useChangeModeratorAction = (user: Pick, } if (changingOwnRole && loggedUserIsOwner) { - return setModal(() => + return setModal( getWarningModalForFederatedRooms( closeModal, handleConfirm, @@ -131,7 +131,7 @@ export const useChangeModeratorAction = (user: Pick, } if (!changingOwnRole && loggedUserIsModerator) { - return setModal(() => + return setModal( getWarningModalForFederatedRooms( closeModal, handleConfirm, diff --git a/apps/meteor/client/views/room/hooks/useUserInfoActions/actions/useChangeOwnerAction.tsx b/apps/meteor/client/views/room/hooks/useUserInfoActions/actions/useChangeOwnerAction.tsx index 2206f3da263d..a247fc7d0047 100644 --- a/apps/meteor/client/views/room/hooks/useUserInfoActions/actions/useChangeOwnerAction.tsx +++ b/apps/meteor/client/views/room/hooks/useUserInfoActions/actions/useChangeOwnerAction.tsx @@ -106,7 +106,7 @@ export const useChangeOwnerAction = (user: Pick, rid: }; if (changingOwnRole && loggedUserIsOwner) { - return setModal(() => + return setModal( getWarningModalForFederatedRooms( closeModal, handleConfirm, @@ -118,7 +118,7 @@ export const useChangeOwnerAction = (user: Pick, rid: } if (!changingOwnRole && loggedUserIsOwner) { - return setModal(() => + return setModal( getWarningModalForFederatedRooms( closeModal, handleConfirm,