diff --git a/app/soapbox/features/edit_profile/index.tsx b/app/soapbox/features/edit_profile/index.tsx index 595b440b0..e75a9d4c6 100644 --- a/app/soapbox/features/edit_profile/index.tsx +++ b/app/soapbox/features/edit_profile/index.tsx @@ -200,6 +200,20 @@ const EditProfile: React.FC = () => { }; }; + const handleHideNetworkChange: React.ChangeEventHandler = 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 = () => { - {/*} - hint={} - checked={this.state.locked} - onChange={this.handleCheckboxChange('locked')} - /> - } - hint={} - checked={this.state.hide_network} - onChange={this.handleCheckboxChange('hide_network')} - /> - } - hint={} - checked={this.state.bot} - onChange={this.handleCheckboxChange('bot')} - /> - } - hint={} - checked={this.state.stranger_notifications} - onChange={this.handleCheckboxChange('stranger_notifications')} - /> - } - hint={} - checked={this.state.discoverable} - onChange={this.handleCheckboxChange('discoverable')} - />*/} + {features.followRequests && ( + } + hint={} + checked={data.locked} + onChange={handleCheckboxChange('locked')} + /> + )} + + {features.hideNetwork && ( + } + hint={} + checked={account ? hidesNetwork(account): false} + onChange={handleHideNetworkChange} + /> + )} + + {features.bots && ( + } + hint={} + checked={data.bot} + onChange={handleCheckboxChange('bot')} + /> + )} + + {/* + } + hint={} + checked={this.state.stranger_notifications} + onChange={this.handleCheckboxChange('stranger_notifications')} + /> + */} + + {features.profileDirectory && ( + } + hint={} + checked={data.discoverable} + onChange={handleCheckboxChange('discoverable')} + /> + )} + {features.emailList && ( } diff --git a/app/soapbox/utils/features.ts b/app/soapbox/utils/features.ts index 2a65bffa3..a87e90046 100644 --- a/app/soapbox/utils/features.ts +++ b/app/soapbox/utils/features.ts @@ -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