diff --git a/app/soapbox/actions/moderation.tsx b/app/soapbox/actions/moderation.tsx index 5b0a4a5f2..c236a2986 100644 --- a/app/soapbox/actions/moderation.tsx +++ b/app/soapbox/actions/moderation.tsx @@ -112,27 +112,6 @@ const deleteUserModal = (intl: IntlShape, accountId: string, afterConfirm = () = })); }; -const rejectUserModal = (intl: IntlShape, accountId: string, afterConfirm = () => {}) => - (dispatch: AppDispatch, getState: () => RootState) => { - const state = getState(); - const acct = state.accounts.get(accountId)!.acct; - const name = state.accounts.get(accountId)!.username; - - dispatch(openModal('CONFIRM', { - icon: require('@tabler/icons/user-off.svg'), - heading: intl.formatMessage(messages.rejectUserHeading, { acct }), - message: intl.formatMessage(messages.rejectUserPrompt, { acct }), - confirm: intl.formatMessage(messages.rejectUserConfirm, { name }), - onConfirm: () => { - dispatch(deleteUsers([accountId])) - .then(() => { - afterConfirm(); - }) - .catch(() => {}); - }, - })); - }; - const toggleStatusSensitivityModal = (intl: IntlShape, statusId: string, sensitive: boolean, afterConfirm = () => {}) => (dispatch: AppDispatch, getState: () => RootState) => { const state = getState(); @@ -178,7 +157,6 @@ const deleteStatusModal = (intl: IntlShape, statusId: string, afterConfirm = () export { deactivateUserModal, deleteUserModal, - rejectUserModal, toggleStatusSensitivityModal, deleteStatusModal, }; diff --git a/app/soapbox/features/admin/components/unapproved-account.tsx b/app/soapbox/features/admin/components/unapproved-account.tsx index 26f4b661e..cf99baa6e 100644 --- a/app/soapbox/features/admin/components/unapproved-account.tsx +++ b/app/soapbox/features/admin/components/unapproved-account.tsx @@ -1,18 +1,10 @@ import React, { useCallback } from 'react'; -import { defineMessages, useIntl } from 'react-intl'; -import { approveUsers } from 'soapbox/actions/admin'; -import { rejectUserModal } from 'soapbox/actions/moderation'; +import { approveUsers, deleteUsers } from 'soapbox/actions/admin'; import { AuthorizeRejectButtons } from 'soapbox/components/authorize-reject-buttons'; import { Stack, HStack, Text } from 'soapbox/components/ui'; import { useAppSelector, useAppDispatch } from 'soapbox/hooks'; import { makeGetAccount } from 'soapbox/selectors'; -import toast from 'soapbox/toast'; - -const messages = defineMessages({ - approved: { id: 'admin.awaiting_approval.approved_message', defaultMessage: '{acct} was approved!' }, - rejected: { id: 'admin.awaiting_approval.rejected_message', defaultMessage: '{acct} was rejected.' }, -}); interface IUnapprovedAccount { accountId: string @@ -20,7 +12,6 @@ interface IUnapprovedAccount { /** Displays an unapproved account for moderation purposes. */ const UnapprovedAccount: React.FC = ({ accountId }) => { - const intl = useIntl(); const dispatch = useAppDispatch(); const getAccount = useCallback(makeGetAccount(), []); @@ -29,23 +20,8 @@ const UnapprovedAccount: React.FC = ({ accountId }) => { if (!account) return null; - const handleApprove = () => { - return dispatch(approveUsers([account.id])) - .then(() => { - const message = intl.formatMessage(messages.approved, { acct: `@${account.acct}` }); - toast.success(message); - }); - }; - - const handleReject = () => { - return new Promise((resolve) => { - dispatch(rejectUserModal(intl, account.id, () => { - const message = intl.formatMessage(messages.rejected, { acct: `@${account.acct}` }); - toast.info(message); - resolve(); - })); - }); - }; + const handleApprove = () => dispatch(approveUsers([account.id])); + const handleReject = () => dispatch(deleteUsers([account.id])); return ( @@ -62,6 +38,7 @@ const UnapprovedAccount: React.FC = ({ accountId }) => {