Skip to content

Commit 0631b83

Browse files
committed
fix(2447): clear errors after successful AJAX submission, remove override author email checkbox
1 parent 0afad76 commit 0631b83

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

templates/v3/user_profile_edit.html

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,6 @@
203203
{% include 'v3/includes/_field_combo.html' with name=user_profile_form.country.name label='Country' options=country_options selected=user_profile_form.country.value placeholder='Select' error=user_profile_form.country.errors.0 %}
204204
{% include 'v3/includes/_field_include.html' with bound_field=user_profile_form.indicate_last_login_method %}
205205
{% include 'v3/includes/_field_include.html' with bound_field=user_profile_form.override_commit_author_name %}
206-
{% include 'v3/includes/_field_include.html' with bound_field=user_profile_form.override_commit_author_email %}
207206
</div>
208207
<hr class="card__hr" aria-hidden="true" />
209208
<div class="card__cta_section">
@@ -349,6 +348,15 @@
349348
if (response.ok && contentType.includes('application/json')) {
350349
this.saved = true
351350
succeeded = true
351+
// Static, server-rendered field errors (left over from a prior
352+
// failed submit) don't clear themselves on a successful AJAX
353+
// save since they aren't Alpine-reactive. Clear them here.
354+
form.querySelectorAll('.field--error').forEach((wrapper) => {
355+
wrapper.classList.remove('field--error')
356+
})
357+
form.querySelectorAll('p.field__error:not([x-show])').forEach((el) => {
358+
el.remove()
359+
})
352360
}
353361
} catch (_) {}
354362
if (!succeeded) {

users/forms.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -339,10 +339,6 @@ def clean_username(self):
339339
help_text="Globally replaces your git commit author name with username value set above",
340340
required=False,
341341
)
342-
override_commit_author_email = forms.BooleanField(
343-
help_text="Links your login to an existing commit-author email after verification",
344-
required=False,
345-
)
346342

347343
# Commit Emails
348344
commit_email_formset = V3CommitEmailFormSet(

0 commit comments

Comments
 (0)