Merge branch 'hide-network' into 'develop'

Support hidden stats

Closes #569

See merge request soapbox-pub/soapbox-fe!531
merge-requests/532/merge
Alex Gleason 2021-06-16 19:36:41 +00:00
commit 282c9d2bfe
2 zmienionych plików z 28 dodań i 7 usunięć

Wyświetl plik

@ -255,6 +255,7 @@ class Header extends ImmutablePureComponent {
);
}
const self = account.get('id') === me;
const info = this.makeInfo();
const menu = this.makeMenu();
@ -286,18 +287,18 @@ class Header extends ImmutablePureComponent {
<span><FormattedMessage id='account.posts' defaultMessage='Posts' /></span>
</NavLink>
<NavLink exact activeClassName='active' to={`/@${account.get('acct')}/following`} title={intl.formatNumber(account.get('following_count'))}>
<span>{shortNumberFormat(account.get('following_count'))}</span>
{(self || !account.getIn(['pleroma', 'hide_follows'], false)) && <NavLink exact activeClassName='active' to={`/@${account.get('acct')}/following`} title={intl.formatNumber(account.get('following_count'))}>
{account.getIn(['pleroma', 'hide_follows_count'], false) ? <span></span> : <span>{shortNumberFormat(account.get('following_count'))}</span>}
<span><FormattedMessage id='account.follows' defaultMessage='Follows' /></span>
</NavLink>
</NavLink>}
<NavLink exact activeClassName='active' to={`/@${account.get('acct')}/followers`} title={intl.formatNumber(account.get('followers_count'))}>
<span>{shortNumberFormat(account.get('followers_count'))}</span>
{(self || !account.getIn(['pleroma', 'hide_followers'], false)) && <NavLink exact activeClassName='active' to={`/@${account.get('acct')}/followers`} title={intl.formatNumber(account.get('followers_count'))}>
{account.getIn(['pleroma', 'hide_followers_count'], false) ? <span></span> : <span>{shortNumberFormat(account.get('followers_count'))}</span>}
<span><FormattedMessage id='account.followers' defaultMessage='Followers' /></span>
</NavLink>
</NavLink>}
{
account.get('id') === me &&
self &&
<div>
<NavLink
exact activeClassName='active' to={`/@${account.get('acct')}/favorites`}

Wyświetl plik

@ -26,6 +26,14 @@ import { isVerified } from 'soapbox/utils/accounts';
import { getSoapboxConfig } from 'soapbox/actions/soapbox';
import { getFeatures } from 'soapbox/utils/features';
const hidesNetwork = account => {
const pleroma = account.get('pleroma');
if (!pleroma) return false;
const { hide_followers, hide_follows, hide_followers_count, hide_follows_count } = pleroma.toJS();
return hide_followers && hide_follows && hide_followers_count && hide_follows_count;
};
const messages = defineMessages({
heading: { id: 'column.edit_profile', defaultMessage: 'Edit profile' },
metaFieldLabel: { id: 'edit_profile.fields.meta_fields.label_placeholder', defaultMessage: 'Label' },
@ -87,6 +95,7 @@ class EditProfile extends ImmutablePureComponent {
map.set('fields', normalizeFields(map.get('fields'), props.maxFields));
map.set('stranger_notifications', strangerNotifications);
map.set('accepts_email_list', acceptsEmailList);
map.set('hide_network', hidesNetwork(account));
unescapeParams(map, ['display_name', 'bio']);
});
this.state = initialState.toObject();
@ -122,6 +131,10 @@ class EditProfile extends ImmutablePureComponent {
header: state.header_file,
locked: state.locked,
accepts_email_list: state.accepts_email_list,
hide_followers: state.hide_network,
hide_follows: state.hide_network,
hide_followers_count: state.hide_network,
hide_follows_count: state.hide_network,
}, this.getFieldParams().toJS());
}
@ -237,6 +250,13 @@ class EditProfile extends ImmutablePureComponent {
checked={this.state.locked}
onChange={this.handleCheckboxChange}
/>
<Checkbox
label={<FormattedMessage id='edit_profile.fields.hide_network_label' defaultMessage='Hide network' />}
hint={<FormattedMessage id='edit_profile.hints.hide_network' defaultMessage='Who you follow and who follows you will not be shown on your profile' />}
name='hide_network'
checked={this.state.hide_network}
onChange={this.handleCheckboxChange}
/>
<Checkbox
label={<FormattedMessage id='edit_profile.fields.bot_label' defaultMessage='This is a bot account' />}
hint={<FormattedMessage id='edit_profile.hints.bot' defaultMessage='This account mainly performs automated actions and might not be monitored' />}