Re-enable "change username" button after failed attempt (#9568)

* Re-enable "change username" button after failed attempt

* chore: proper indentation
v1.18.x
Mats 4 years ago committed by GitHub
parent 0a5f165371
commit e6ef094079
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -27,7 +27,6 @@ define('forum/account/edit/username', [
btn.addClass('disabled').find('i').removeClass('hide'); btn.addClass('disabled').find('i').removeClass('hide');
api.put('/users/' + userData.uid, userData).then((response) => { api.put('/users/' + userData.uid, userData).then((response) => {
btn.removeClass('disabled').find('i').addClass('hide');
var userslug = slugify(userData.username); var userslug = slugify(userData.username);
if (userData.username && userslug && parseInt(userData.uid, 10) === parseInt(app.user.uid, 10)) { if (userData.username && userslug && parseInt(userData.uid, 10) === parseInt(app.user.uid, 10)) {
$('[component="header/profilelink"]').attr('href', config.relative_path + '/user/' + userslug); $('[component="header/profilelink"]').attr('href', config.relative_path + '/user/' + userslug);
@ -38,7 +37,10 @@ define('forum/account/edit/username', [
} }
ajaxify.go('user/' + userslug + '/edit'); ajaxify.go('user/' + userslug + '/edit');
}).catch(app.alertError); }).catch(app.alertError)
.finally(() => {
btn.removeClass('disabled').find('i').addClass('hide');
});
return false; return false;
}); });

Loading…
Cancel
Save