kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
AccountHeader: remove promote/demote menu options
rodzic
6ecb715a71
commit
6f99be6c3d
|
@ -6,7 +6,7 @@ import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
||||||
import { Link, useHistory } from 'react-router-dom';
|
import { Link, useHistory } from 'react-router-dom';
|
||||||
|
|
||||||
import { blockAccount, followAccount, pinAccount, removeFromFollowers, unblockAccount, unmuteAccount, unpinAccount } from 'soapbox/actions/accounts';
|
import { blockAccount, followAccount, pinAccount, removeFromFollowers, unblockAccount, unmuteAccount, unpinAccount } from 'soapbox/actions/accounts';
|
||||||
import { verifyUser, unverifyUser, setDonor, removeDonor, promoteToAdmin, promoteToModerator, demoteToUser, suggestUsers, unsuggestUsers } from 'soapbox/actions/admin';
|
import { verifyUser, unverifyUser, setDonor, removeDonor, suggestUsers, unsuggestUsers } from 'soapbox/actions/admin';
|
||||||
import { launchChat } from 'soapbox/actions/chats';
|
import { launchChat } from 'soapbox/actions/chats';
|
||||||
import { mentionCompose, directCompose } from 'soapbox/actions/compose';
|
import { mentionCompose, directCompose } from 'soapbox/actions/compose';
|
||||||
import { blockDomain, unblockDomain } from 'soapbox/actions/domain_blocks';
|
import { blockDomain, unblockDomain } from 'soapbox/actions/domain_blocks';
|
||||||
|
@ -26,10 +26,7 @@ import ActionButton from 'soapbox/features/ui/components/action-button';
|
||||||
import SubscriptionButton from 'soapbox/features/ui/components/subscription-button';
|
import SubscriptionButton from 'soapbox/features/ui/components/subscription-button';
|
||||||
import { useAppDispatch, useFeatures, useOwnAccount } from 'soapbox/hooks';
|
import { useAppDispatch, useFeatures, useOwnAccount } from 'soapbox/hooks';
|
||||||
import { Account } from 'soapbox/types/entities';
|
import { Account } from 'soapbox/types/entities';
|
||||||
import {
|
import { isRemote } from 'soapbox/utils/accounts';
|
||||||
isLocal,
|
|
||||||
isRemote,
|
|
||||||
} from 'soapbox/utils/accounts';
|
|
||||||
|
|
||||||
import type { Menu as MenuType } from 'soapbox/components/dropdown_menu';
|
import type { Menu as MenuType } from 'soapbox/components/dropdown_menu';
|
||||||
|
|
||||||
|
@ -246,31 +243,6 @@ const Header: React.FC<IHeader> = ({ account }) => {
|
||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
};
|
};
|
||||||
|
|
||||||
const onPromoteToAdmin = () => {
|
|
||||||
const message = intl.formatMessage(messages.promotedToAdmin, { acct: account.acct });
|
|
||||||
|
|
||||||
dispatch(promoteToAdmin(account.id))
|
|
||||||
.then(() => dispatch(snackbar.success(message)))
|
|
||||||
.catch(() => {});
|
|
||||||
};
|
|
||||||
|
|
||||||
const onPromoteToModerator = () => {
|
|
||||||
const messageType = account.admin ? messages.demotedToModerator : messages.promotedToModerator;
|
|
||||||
const message = intl.formatMessage(messageType, { acct: account.acct });
|
|
||||||
|
|
||||||
dispatch(promoteToModerator(account.id))
|
|
||||||
.then(() => dispatch(snackbar.success(message)))
|
|
||||||
.catch(() => {});
|
|
||||||
};
|
|
||||||
|
|
||||||
const onDemoteToUser = () => {
|
|
||||||
const message = intl.formatMessage(messages.demotedToUser, { acct: account.acct });
|
|
||||||
|
|
||||||
dispatch(demoteToUser(account.id))
|
|
||||||
.then(() => dispatch(snackbar.success(message)))
|
|
||||||
.catch(() => {});
|
|
||||||
};
|
|
||||||
|
|
||||||
const onSuggestUser = () => {
|
const onSuggestUser = () => {
|
||||||
const message = intl.formatMessage(messages.userSuggested, { acct: account.acct });
|
const message = intl.formatMessage(messages.userSuggested, { acct: account.acct });
|
||||||
|
|
||||||
|
@ -544,43 +516,6 @@ const Header: React.FC<IHeader> = ({ account }) => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (account.id !== ownAccount?.id && isLocal(account) && ownAccount.admin) {
|
|
||||||
if (account.admin) {
|
|
||||||
menu.push({
|
|
||||||
text: intl.formatMessage(messages.demoteToModerator, { name: account.username }),
|
|
||||||
action: onPromoteToModerator,
|
|
||||||
icon: require('@tabler/icons/arrow-up-circle.svg'),
|
|
||||||
});
|
|
||||||
menu.push({
|
|
||||||
text: intl.formatMessage(messages.demoteToUser, { name: account.username }),
|
|
||||||
action: onDemoteToUser,
|
|
||||||
icon: require('@tabler/icons/arrow-down-circle.svg'),
|
|
||||||
});
|
|
||||||
} else if (account.moderator) {
|
|
||||||
menu.push({
|
|
||||||
text: intl.formatMessage(messages.promoteToAdmin, { name: account.username }),
|
|
||||||
action: onPromoteToAdmin,
|
|
||||||
icon: require('@tabler/icons/arrow-up-circle.svg'),
|
|
||||||
});
|
|
||||||
menu.push({
|
|
||||||
text: intl.formatMessage(messages.demoteToUser, { name: account.username }),
|
|
||||||
action: onDemoteToUser,
|
|
||||||
icon: require('@tabler/icons/arrow-down-circle.svg'),
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
menu.push({
|
|
||||||
text: intl.formatMessage(messages.promoteToAdmin, { name: account.username }),
|
|
||||||
action: onPromoteToAdmin,
|
|
||||||
icon: require('@tabler/icons/arrow-up-circle.svg'),
|
|
||||||
});
|
|
||||||
menu.push({
|
|
||||||
text: intl.formatMessage(messages.promoteToModerator, { name: account.username }),
|
|
||||||
action: onPromoteToModerator,
|
|
||||||
icon: require('@tabler/icons/arrow-up-circle.svg'),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (account.verified) {
|
if (account.verified) {
|
||||||
menu.push({
|
menu.push({
|
||||||
text: intl.formatMessage(messages.unverifyUser, { name: account.username }),
|
text: intl.formatMessage(messages.unverifyUser, { name: account.username }),
|
||||||
|
|
Ładowanie…
Reference in New Issue