EditProfile: restore most checkboxes

This commit is contained in:
Alex Gleason 2022-04-29 16:31:46 -05:00
parent 2cbea4aa5b
commit b6f1de0a58
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
2 changed files with 83 additions and 30 deletions

View file

@ -200,6 +200,20 @@ const EditProfile: React.FC = () => {
}; };
}; };
const handleHideNetworkChange: React.ChangeEventHandler<HTMLInputElement> = e => {
const hide = e.target.checked;
setData(prevData => {
return {
...prevData,
hide_followers: hide,
hide_follows: hide,
hide_followers_count: hide,
hide_follows_count: hide,
};
});
};
const handleFileChange = ( const handleFileChange = (
name: keyof AccountCredentials, name: keyof AccountCredentials,
maxPixels: number, maxPixels: number,
@ -339,36 +353,51 @@ const EditProfile: React.FC = () => {
</div> </div>
</div> </div>
{/*<Checkbox {features.followRequests && (
label={<FormattedMessage id='edit_profile.fields.locked_label' defaultMessage='Lock account' />} <Checkbox
hint={<FormattedMessage id='edit_profile.hints.locked' defaultMessage='Requires you to manually approve followers' />} label={<FormattedMessage id='edit_profile.fields.locked_label' defaultMessage='Lock account' />}
checked={this.state.locked} hint={<FormattedMessage id='edit_profile.hints.locked' defaultMessage='Requires you to manually approve followers' />}
onChange={this.handleCheckboxChange('locked')} checked={data.locked}
/> onChange={handleCheckboxChange('locked')}
<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' />}
checked={this.state.hide_network} {features.hideNetwork && (
onChange={this.handleCheckboxChange('hide_network')} <Checkbox
/> label={<FormattedMessage id='edit_profile.fields.hide_network_label' defaultMessage='Hide network' />}
<Checkbox hint={<FormattedMessage id='edit_profile.hints.hide_network' defaultMessage='Who you follow and who follows you will not be shown on your profile' />}
label={<FormattedMessage id='edit_profile.fields.bot_label' defaultMessage='This is a bot account' />} checked={account ? hidesNetwork(account): false}
hint={<FormattedMessage id='edit_profile.hints.bot' defaultMessage='This account mainly performs automated actions and might not be monitored' />} onChange={handleHideNetworkChange}
checked={this.state.bot} />
onChange={this.handleCheckboxChange('bot')} )}
/>
<Checkbox {features.bots && (
label={<FormattedMessage id='edit_profile.fields.stranger_notifications_label' defaultMessage='Block notifications from strangers' />} <Checkbox
hint={<FormattedMessage id='edit_profile.hints.stranger_notifications' defaultMessage='Only show notifications from people you follow' />} label={<FormattedMessage id='edit_profile.fields.bot_label' defaultMessage='This is a bot account' />}
checked={this.state.stranger_notifications} hint={<FormattedMessage id='edit_profile.hints.bot' defaultMessage='This account mainly performs automated actions and might not be monitored' />}
onChange={this.handleCheckboxChange('stranger_notifications')} checked={data.bot}
/> onChange={handleCheckboxChange('bot')}
<Checkbox />
label={<FormattedMessage id='edit_profile.fields.discoverable_label' defaultMessage='Allow account discovery' />} )}
hint={<FormattedMessage id='edit_profile.hints.discoverable' defaultMessage='Display account in profile directory and allow indexing by external services' />}
checked={this.state.discoverable} {/*
onChange={this.handleCheckboxChange('discoverable')} <Checkbox
/>*/} label={<FormattedMessage id='edit_profile.fields.stranger_notifications_label' defaultMessage='Block notifications from strangers' />}
hint={<FormattedMessage id='edit_profile.hints.stranger_notifications' defaultMessage='Only show notifications from people you follow' />}
checked={this.state.stranger_notifications}
onChange={this.handleCheckboxChange('stranger_notifications')}
/>
*/}
{features.profileDirectory && (
<Checkbox
label={<FormattedMessage id='edit_profile.fields.discoverable_label' defaultMessage='Allow account discovery' />}
hint={<FormattedMessage id='edit_profile.hints.discoverable' defaultMessage='Display account in profile directory and allow indexing by external services' />}
checked={data.discoverable}
onChange={handleCheckboxChange('discoverable')}
/>
)}
{features.emailList && ( {features.emailList && (
<Checkbox <Checkbox
label={<FormattedMessage id='edit_profile.fields.accepts_email_list_label' defaultMessage='Subscribe to newsletter' />} label={<FormattedMessage id='edit_profile.fields.accepts_email_list_label' defaultMessage='Subscribe to newsletter' />}

View file

@ -148,6 +148,15 @@ const getInstanceFeatures = (instance: Instance) => {
v.software === PIXELFED, v.software === PIXELFED,
]), ]),
/**
* Accounts can be marked as bots.
* @see PATCH /api/v1/accounts/update_credentials
*/
bots: any([
v.software === MASTODON,
v.software === PLEROMA,
]),
/** /**
* Pleroma chats API. * Pleroma chats API.
* @see {@link https://docs.pleroma.social/backend/development/API/chats/} * @see {@link https://docs.pleroma.social/backend/development/API/chats/}
@ -240,12 +249,27 @@ const getInstanceFeatures = (instance: Instance) => {
*/ */
focalPoint: v.software === MASTODON && gte(v.compatVersion, '2.3.0'), focalPoint: v.software === MASTODON && gte(v.compatVersion, '2.3.0'),
/**
* Ability to lock accounts and manually approve followers.
* @see PATCH /api/v1/accounts/update_credentials
*/
followRequests: any([
v.software === MASTODON,
v.software === PLEROMA,
]),
/** /**
* Whether client settings can be retrieved from the API. * Whether client settings can be retrieved from the API.
* @see GET /api/pleroma/frontend_configurations * @see GET /api/pleroma/frontend_configurations
*/ */
frontendConfigurations: v.software === PLEROMA, frontendConfigurations: v.software === PLEROMA,
/**
* Can hide follows/followers lists and counts.
* @see PATCH /api/v1/accounts/update_credentials
*/
hideNetwork: v.software === PLEROMA,
/** /**
* Pleroma import API. * Pleroma import API.
* @see POST /api/pleroma/follow_import * @see POST /api/pleroma/follow_import