Add admin links to status and account menus (fixes #673)

If the current logged-in user is an admin, add quick links to the admin
interface in account and toot dropdown menu. Suggestion by @ashkitten
This commit is contained in:
Thibaut Girka
2018-08-31 12:33:32 +02:00
committed by ThibG
parent 7ea4c793d6
commit bd437f8077
3 changed files with 23 additions and 3 deletions

View File

@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
import DropdownMenuContainer from 'flavours/glitch/containers/dropdown_menu_container';
import { Link } from 'react-router-dom';
import { defineMessages, injectIntl, FormattedMessage, FormattedNumber } from 'react-intl';
import { me } from 'flavours/glitch/util/initial_state';
import { me, isStaff } from 'flavours/glitch/util/initial_state';
const messages = defineMessages({
mention: { id: 'account.mention', defaultMessage: 'Mention @{name}' },
@ -25,6 +25,7 @@ const messages = defineMessages({
showReblogs: { id: 'account.show_reblogs', defaultMessage: 'Show boosts from @{name}' },
endorse: { id: 'account.endorse', defaultMessage: 'Feature on profile' },
unendorse: { id: 'account.unendorse', defaultMessage: 'Don\'t feature on profile' },
admin_account: { id: 'status.admin_account', defaultMessage: 'Open moderation interface for @{name}' },
});
@injectIntl
@ -120,6 +121,11 @@ export default class ActionBar extends React.PureComponent {
}
}
if (account.get('id') !== me && isStaff) {
menu.push(null);
menu.push({ text: intl.formatMessage(messages.admin_account, { name: account.get('username') }), href: `/admin/accounts/${account.get('id')}` });
}
return (
<div>
{extraInfo}