From 05cc7ac818734b40c40ee2b04dda63b6f69de2a5 Mon Sep 17 00:00:00 2001 From: crockwave Date: Mon, 3 Aug 2020 18:05:53 -0500 Subject: [PATCH 1/2] Fixed features/edit_profile checkbox issues. Bot value always returned true, so commented that feature out --- app/soapbox/features/edit_profile/index.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/soapbox/features/edit_profile/index.js b/app/soapbox/features/edit_profile/index.js index 02972cb6d..bd29650b3 100644 --- a/app/soapbox/features/edit_profile/index.js +++ b/app/soapbox/features/edit_profile/index.js @@ -111,8 +111,11 @@ class EditProfile extends ImmutablePureComponent { const data = this.getParams(); let formData = new FormData(); for (let key in data) { - const shouldAppend = Boolean(data[key] || key.startsWith('fields_attributes')); - if (shouldAppend) formData.append(key, data[key] || ''); + const shouldAppend = Boolean(data[key] + || key.startsWith('fields_attributes') + || (key === 'bot' && data.bot !== undefined) + || (key === 'locked' && data.locked !== undefined)); + if (shouldAppend) formData.append(key, String(data[key]) || ''); } return formData; } @@ -201,13 +204,13 @@ class EditProfile extends ImmutablePureComponent { checked={this.state.locked} onChange={this.handleCheckboxChange} /> - } hint={} name='bot' checked={this.state.bot} onChange={this.handleCheckboxChange} - /> + /> */}
From 40dbfbb5daa24c59268d6fe96c55d3b821877919 Mon Sep 17 00:00:00 2001 From: crockwave Date: Mon, 10 Aug 2020 13:53:02 -0500 Subject: [PATCH 2/2] Re-enabled attempt to use `bot` checkbox in profile_edit. Refactored shouldAppend method --- app/soapbox/features/edit_profile/index.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/app/soapbox/features/edit_profile/index.js b/app/soapbox/features/edit_profile/index.js index bd29650b3..a9ba5bcfd 100644 --- a/app/soapbox/features/edit_profile/index.js +++ b/app/soapbox/features/edit_profile/index.js @@ -111,10 +111,11 @@ class EditProfile extends ImmutablePureComponent { const data = this.getParams(); let formData = new FormData(); for (let key in data) { - const shouldAppend = Boolean(data[key] - || key.startsWith('fields_attributes') - || (key === 'bot' && data.bot !== undefined) - || (key === 'locked' && data.locked !== undefined)); + const shouldAppend = Boolean(data[key] !== undefined || key.startsWith('fields_attributes')); + // const shouldAppend = Boolean(data[key] + // || key.startsWith('fields_attributes') + // || (key === 'bot' && data.bot !== undefined) + // || (key === 'locked' && data.locked !== undefined)); if (shouldAppend) formData.append(key, String(data[key]) || ''); } return formData; @@ -204,13 +205,13 @@ class EditProfile extends ImmutablePureComponent { checked={this.state.locked} onChange={this.handleCheckboxChange} /> - {/* } hint={} name='bot' checked={this.state.bot} onChange={this.handleCheckboxChange} - /> */} + />