kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
Add follow request nav item when account is locked
rodzic
582649538c
commit
f728491ad0
|
@ -1,8 +1,11 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { connect } from 'react-redux';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import Icon from 'soapbox/components/icon';
|
import Icon from 'soapbox/components/icon';
|
||||||
|
import IconWithCounter from 'soapbox/components/icon_with_counter';
|
||||||
import { NavLink } from 'react-router-dom';
|
import { NavLink } from 'react-router-dom';
|
||||||
import { injectIntl, defineMessages } from 'react-intl';
|
import { injectIntl, defineMessages } from 'react-intl';
|
||||||
|
import { OrderedSet as ImmutableOrderedSet } from 'immutable';
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
edit_profile: { id: 'account.edit_profile', defaultMessage: 'Edit Profile' },
|
edit_profile: { id: 'account.edit_profile', defaultMessage: 'Edit Profile' },
|
||||||
|
@ -10,18 +13,29 @@ const messages = defineMessages({
|
||||||
security: { id: 'navigation_bar.security', defaultMessage: 'Security' },
|
security: { id: 'navigation_bar.security', defaultMessage: 'Security' },
|
||||||
lists: { id: 'column.lists', defaultMessage: 'Lists' },
|
lists: { id: 'column.lists', defaultMessage: 'Lists' },
|
||||||
bookmarks: { id: 'column.bookmarks', defaultMessage: 'Bookmarks' },
|
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
|
@injectIntl
|
||||||
class FeaturesPanel extends React.PureComponent {
|
class FeaturesPanel extends React.PureComponent {
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
intl: PropTypes.object.isRequired,
|
intl: PropTypes.object.isRequired,
|
||||||
|
isLocked: PropTypes.bool,
|
||||||
|
followRequestsCount: PropTypes.number,
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { intl } = this.props;
|
const { intl, isLocked, followRequestsCount } = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='wtf-panel promo-panel'>
|
<div className='wtf-panel promo-panel'>
|
||||||
|
@ -32,6 +46,10 @@ class FeaturesPanel extends React.PureComponent {
|
||||||
{intl.formatMessage(messages.edit_profile)}
|
{intl.formatMessage(messages.edit_profile)}
|
||||||
</NavLink>
|
</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'>
|
<NavLink className='promo-panel-item' to='/bookmarks'>
|
||||||
<Icon id='bookmark' className='promo-panel-item__icon' fixedWidth />
|
<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='/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='/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='/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) && <>
|
{isStaff(account) && <>
|
||||||
<li><a href='/pleroma/admin'><FormattedMessage id='navigation_bar.admin_settings' defaultMessage='Admin settings' /></a></li>
|
<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>
|
<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 { fetchChats } from 'soapbox/actions/chats';
|
||||||
import { clearHeight } from '../../actions/height_cache';
|
import { clearHeight } from '../../actions/height_cache';
|
||||||
import { openModal } from '../../actions/modal';
|
import { openModal } from '../../actions/modal';
|
||||||
|
import { fetchFollowRequests } from '../../actions/accounts';
|
||||||
import { WrappedRoute } from './util/react_router_helpers';
|
import { WrappedRoute } from './util/react_router_helpers';
|
||||||
import UploadArea from './components/upload_area';
|
import UploadArea from './components/upload_area';
|
||||||
import TabsBar from './components/tabs_bar';
|
import TabsBar from './components/tabs_bar';
|
||||||
|
@ -459,7 +460,7 @@ class UI extends React.PureComponent {
|
||||||
this.props.dispatch(expandHomeTimeline());
|
this.props.dispatch(expandHomeTimeline());
|
||||||
this.props.dispatch(expandNotifications());
|
this.props.dispatch(expandNotifications());
|
||||||
this.props.dispatch(fetchChats());
|
this.props.dispatch(fetchChats());
|
||||||
// this.props.dispatch(fetchGroups('member'));
|
|
||||||
if (isStaff(account)) {
|
if (isStaff(account)) {
|
||||||
this.props.dispatch(fetchReports({ state: 'open' }));
|
this.props.dispatch(fetchReports({ state: 'open' }));
|
||||||
this.props.dispatch(fetchUsers({ page: 1, filters: 'local,need_approval' }));
|
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);
|
setTimeout(() => this.props.dispatch(fetchFilters()), 500);
|
||||||
|
|
||||||
|
if (account.get('locked')) {
|
||||||
|
setTimeout(() => this.props.dispatch(fetchFollowRequests()), 700);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.connectStreaming();
|
this.connectStreaming();
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue