Always show 'Add or Remove from lists' menu item for Pleroma users

This commit is contained in:
Bárbara de Castro Fernandes 2020-05-26 09:49:05 -03:00
parent 438d8009d4
commit 6c07579ab2
1 changed files with 7 additions and 1 deletions

View File

@ -8,6 +8,7 @@ import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import Button from 'gabsocial/components/button'; import Button from 'gabsocial/components/button';
import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePureComponent from 'react-immutable-pure-component';
import { isStaff } from 'gabsocial/utils/accounts'; import { isStaff } from 'gabsocial/utils/accounts';
import { parseVersion } from 'gabsocial/utils/features';
import classNames from 'classnames'; import classNames from 'classnames';
import Avatar from 'gabsocial/components/avatar'; import Avatar from 'gabsocial/components/avatar';
import { shortNumberFormat } from 'gabsocial/utils/numbers'; import { shortNumberFormat } from 'gabsocial/utils/numbers';
@ -54,6 +55,7 @@ const mapStateToProps = state => {
me, me,
isStaff: isStaff(state.getIn(['accounts', me])), isStaff: isStaff(state.getIn(['accounts', me])),
autoPlayGif: getSettings(state).get('autoPlayGif'), autoPlayGif: getSettings(state).get('autoPlayGif'),
version: parseVersion(state.getIn(['instance','version'])),
}; };
}; };
@ -70,6 +72,7 @@ class Header extends ImmutablePureComponent {
username: PropTypes.string, username: PropTypes.string,
autoPlayGif: PropTypes.bool, autoPlayGif: PropTypes.bool,
isStaff: PropTypes.bool.isRequired, isStaff: PropTypes.bool.isRequired,
version: PropTypes.node,
}; };
static defaultProps = { static defaultProps = {
@ -103,7 +106,7 @@ class Header extends ImmutablePureComponent {
}); });
makeMenu() { makeMenu() {
const { account, intl, me, isStaff } = this.props; const { account, intl, me, isStaff, version } = this.props;
let menu = []; let menu = [];
@ -138,6 +141,9 @@ class Header extends ImmutablePureComponent {
menu.push({ text: intl.formatMessage(account.getIn(['relationship', 'endorsed']) ? messages.unendorse : messages.endorse), action: this.props.onEndorseToggle }); menu.push({ text: intl.formatMessage(account.getIn(['relationship', 'endorsed']) ? messages.unendorse : messages.endorse), action: this.props.onEndorseToggle });
menu.push(null); menu.push(null);
} }
else if (version.software === 'Pleroma') {
menu.push({ text: intl.formatMessage(messages.add_or_remove_from_list), action: this.props.onAddToList });
}
if (account.getIn(['relationship', 'muting'])) { if (account.getIn(['relationship', 'muting'])) {
menu.push({ text: intl.formatMessage(messages.unmute, { name: account.get('username') }), action: this.props.onMute }); menu.push({ text: intl.formatMessage(messages.unmute, { name: account.get('username') }), action: this.props.onMute });