Re-enabled attempt to use `bot` checkbox in profile_edit. Refactored shouldAppend method

timeline-tab-hover-styles
crockwave 2020-08-10 13:53:02 -05:00
rodzic 05cc7ac818
commit 40dbfbb5da
1 zmienionych plików z 7 dodań i 6 usunięć

Wyświetl plik

@ -111,10 +111,11 @@ class EditProfile extends ImmutablePureComponent {
const data = this.getParams(); const data = this.getParams();
let formData = new FormData(); let formData = new FormData();
for (let key in data) { for (let key in data) {
const shouldAppend = Boolean(data[key] const shouldAppend = Boolean(data[key] !== undefined || key.startsWith('fields_attributes'));
|| key.startsWith('fields_attributes') // const shouldAppend = Boolean(data[key]
|| (key === 'bot' && data.bot !== undefined) // || key.startsWith('fields_attributes')
|| (key === 'locked' && data.locked !== undefined)); // || (key === 'bot' && data.bot !== undefined)
// || (key === 'locked' && data.locked !== undefined));
if (shouldAppend) formData.append(key, String(data[key]) || ''); if (shouldAppend) formData.append(key, String(data[key]) || '');
} }
return formData; return formData;
@ -204,13 +205,13 @@ class EditProfile extends ImmutablePureComponent {
checked={this.state.locked} checked={this.state.locked}
onChange={this.handleCheckboxChange} onChange={this.handleCheckboxChange}
/> />
{/* <Checkbox <Checkbox
label={<FormattedMessage id='edit_profile.fields.bot_label' defaultMessage='This is a bot account' />} 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' />} hint={<FormattedMessage id='edit_profile.hints.bot' defaultMessage='This account mainly performs automated actions and might not be monitored' />}
name='bot' name='bot'
checked={this.state.bot} checked={this.state.bot}
onChange={this.handleCheckboxChange} onChange={this.handleCheckboxChange}
/> */} />
</FieldsGroup> </FieldsGroup>
<FieldsGroup> <FieldsGroup>
<div className='fields-row__column fields-group'> <div className='fields-row__column fields-group'>