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 = (
name: keyof AccountCredentials,
maxPixels: number,
@ -339,36 +353,51 @@ const EditProfile: React.FC = () => {
</div>
</div>
{/*<Checkbox
label={<FormattedMessage id='edit_profile.fields.locked_label' defaultMessage='Lock account' />}
hint={<FormattedMessage id='edit_profile.hints.locked' defaultMessage='Requires you to manually approve followers' />}
checked={this.state.locked}
onChange={this.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}
onChange={this.handleCheckboxChange('hide_network')}
/>
<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' />}
checked={this.state.bot}
onChange={this.handleCheckboxChange('bot')}
/>
<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')}
/>
<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')}
/>*/}
{features.followRequests && (
<Checkbox
label={<FormattedMessage id='edit_profile.fields.locked_label' defaultMessage='Lock account' />}
hint={<FormattedMessage id='edit_profile.hints.locked' defaultMessage='Requires you to manually approve followers' />}
checked={data.locked}
onChange={handleCheckboxChange('locked')}
/>
)}
{features.hideNetwork && (
<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={account ? hidesNetwork(account): false}
onChange={handleHideNetworkChange}
/>
)}
{features.bots && (
<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' />}
checked={data.bot}
onChange={handleCheckboxChange('bot')}
/>
)}
{/*
<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 && (
<Checkbox
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,
]),
/**
* Accounts can be marked as bots.
* @see PATCH /api/v1/accounts/update_credentials
*/
bots: any([
v.software === MASTODON,
v.software === PLEROMA,
]),
/**
* Pleroma chats API.
* @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'),
/**
* 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.
* @see GET /api/pleroma/frontend_configurations
*/
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.
* @see POST /api/pleroma/follow_import