diff --git a/app/soapbox/features/ui/components/features_panel.js b/app/soapbox/features/ui/components/features_panel.js index 5776e0169..f9d971331 100644 --- a/app/soapbox/features/ui/components/features_panel.js +++ b/app/soapbox/features/ui/components/features_panel.js @@ -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 (
@@ -32,6 +46,10 @@ class FeaturesPanel extends React.PureComponent { {intl.formatMessage(messages.edit_profile)} + {(isLocked || followRequestsCount > 0) && + + {intl.formatMessage(messages.follow_requests)} + } diff --git a/app/soapbox/features/ui/components/link_footer.js b/app/soapbox/features/ui/components/link_footer.js index dcdbf70a2..6e12f46d2 100644 --- a/app/soapbox/features/ui/components/link_footer.js +++ b/app/soapbox/features/ui/components/link_footer.js @@ -41,6 +41,7 @@ const LinkFooter = ({ onOpenHotkeys, account, onClickLogOut }) => (
  • +
  • {isStaff(account) && <>
  • diff --git a/app/soapbox/features/ui/index.js b/app/soapbox/features/ui/index.js index 8b5c1318c..31131a757 100644 --- a/app/soapbox/features/ui/index.js +++ b/app/soapbox/features/ui/index.js @@ -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(); }