Add follow request nav item when account is locked

merge-requests/451/head
Alex Gleason 4 years ago
parent 582649538c
commit f728491ad0
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7

@ -1,8 +1,11 @@
import React from 'react';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import Icon from 'soapbox/components/icon';
import IconWithCounter from 'soapbox/components/icon_with_counter';
import { NavLink } from 'react-router-dom';
import { injectIntl, defineMessages } from 'react-intl';
import { OrderedSet as ImmutableOrderedSet } from 'immutable';
const messages = defineMessages({
edit_profile: { id: 'account.edit_profile', defaultMessage: 'Edit Profile' },
@ -10,18 +13,29 @@ const messages = defineMessages({
security: { id: 'navigation_bar.security', defaultMessage: 'Security' },
lists: { id: 'column.lists', defaultMessage: 'Lists' },
bookmarks: { id: 'column.bookmarks', defaultMessage: 'Bookmarks' },
follow_requests: { id: 'navigation_bar.follow_requests', defaultMessage: 'Follow requests' },
});
export default
const mapStateToProps = state => {
const me = state.get('me');
return {
isLocked: state.getIn(['accounts', me, 'locked']),
followRequestsCount: state.getIn(['user_lists', 'follow_requests', 'items'], ImmutableOrderedSet()).count(),
};
};
export default @connect(mapStateToProps)
@injectIntl
class FeaturesPanel extends React.PureComponent {
static propTypes = {
intl: PropTypes.object.isRequired,
isLocked: PropTypes.bool,
followRequestsCount: PropTypes.number,
};
render() {
const { intl } = this.props;
const { intl, isLocked, followRequestsCount } = this.props;
return (
<div className='wtf-panel promo-panel'>
@ -32,6 +46,10 @@ class FeaturesPanel extends React.PureComponent {
{intl.formatMessage(messages.edit_profile)}
</NavLink>
{(isLocked || followRequestsCount > 0) && <NavLink className='promo-panel-item' to='/follow_requests'>
<IconWithCounter icon='user-plus' count={followRequestsCount} fixedWidth />
{intl.formatMessage(messages.follow_requests)}
</NavLink>}
<NavLink className='promo-panel-item' to='/bookmarks'>
<Icon id='bookmark' className='promo-panel-item__icon' fixedWidth />

@ -41,6 +41,7 @@ const LinkFooter = ({ onOpenHotkeys, account, onClickLogOut }) => (
<li><Link to='/mutes'><FormattedMessage id='navigation_bar.mutes' defaultMessage='Muted users' /></Link></li>
<li><Link to='/filters'><FormattedMessage id='navigation_bar.filters' defaultMessage='Muted words' /></Link></li>
<li><Link to='/domain_blocks'><FormattedMessage id='navigation_bar.domain_blocks' defaultMessage='Hidden domains' /></Link></li>
<li><Link to='/follow_requests'><FormattedMessage id='navigation_bar.follow_requests' defaultMessage='Follow requests' /></Link></li>
{isStaff(account) && <>
<li><a href='/pleroma/admin'><FormattedMessage id='navigation_bar.admin_settings' defaultMessage='Admin settings' /></a></li>
<li><Link to='/soapbox/config'><FormattedMessage id='navigation_bar.soapbox_config' defaultMessage='Soapbox config' /></Link></li>

@ -21,6 +21,7 @@ import { fetchFilters } from '../../actions/filters';
import { fetchChats } from 'soapbox/actions/chats';
import { clearHeight } from '../../actions/height_cache';
import { openModal } from '../../actions/modal';
import { fetchFollowRequests } from '../../actions/accounts';
import { WrappedRoute } from './util/react_router_helpers';
import UploadArea from './components/upload_area';
import TabsBar from './components/tabs_bar';
@ -459,7 +460,7 @@ class UI extends React.PureComponent {
this.props.dispatch(expandHomeTimeline());
this.props.dispatch(expandNotifications());
this.props.dispatch(fetchChats());
// this.props.dispatch(fetchGroups('member'));
if (isStaff(account)) {
this.props.dispatch(fetchReports({ state: 'open' }));
this.props.dispatch(fetchUsers({ page: 1, filters: 'local,need_approval' }));
@ -467,6 +468,10 @@ class UI extends React.PureComponent {
}
setTimeout(() => this.props.dispatch(fetchFilters()), 500);
if (account.get('locked')) {
setTimeout(() => this.props.dispatch(fetchFollowRequests()), 700);
}
}
this.connectStreaming();
}

Loading…
Cancel
Save