Skip to content

Node.js based forum software built for the modern web

refactor: account edit logic and template, closes #9364

Julian Lam98bf4064e796
diff --git a/install/package.json b/install/package.json
index 1ada9e88a7..6128c04b68 100644
--- a/install/package.json
+++ b/install/package.json
@@ -92,9 +92,9 @@
"nodebb-plugin-spam-be-gone": "0.7.8",
"nodebb-rewards-essentials": "0.1.4",
"nodebb-theme-lavender": "5.2.1",
- "nodebb-theme-persona": "10.5.17",
+ "nodebb-theme-persona": "11.0.1",
"nodebb-theme-slick": "1.4.3",
- "nodebb-theme-vanilla": "11.4.5",
+ "nodebb-theme-vanilla": "12.0.1",
"nodebb-widget-essentials": "5.0.3",
"nodemailer": "^6.5.0",
"nprogress": "0.2.0",
diff --git a/public/src/client/account/edit.js b/public/src/client/account/edit.js
index fd0ee1b0fb..91624113a8 100644
--- a/public/src/client/account/edit.js
+++ b/public/src/client/account/edit.js
@@ -5,7 +5,8 @@ define('forum/account/edit', [
'accounts/picture',
'translator',
'api',
-], function (header, picture, translator, api) {
+ 'hooks',
+], function (header, picture, translator, api, hooks) {
var AccountEdit = {};
AccountEdit.init = function () {
@@ -31,22 +32,13 @@ define('forum/account/edit', [
};
function updateProfile() {
- var userData = {
- uid: $('#inputUID').val(),
- fullname: $('#inputFullname').val(),
- website: $('#inputWebsite').val(),
- birthday: $('#inputBirthday').val(),
- location: $('#inputLocation').val(),
- groupTitle: $('#groupTitle').val(),
- signature: $('#inputSignature').val(),
- aboutme: $('#inputAboutMe').val(),
- };
-
+ const userData = $('form[component="profile/edit/form"]').serializeObject();
+ userData.uid = ajaxify.data.uid;
userData.groupTitle = JSON.stringify(
Array.isArray(userData.groupTitle) ? userData.groupTitle : [userData.groupTitle]
);
- $(window).trigger('action:profile.update', userData);
+ hooks.fire('action:profile.update', userData);
api.put('/users/' + userData.uid, userData).then((res) => {
app.alertSuccess('[[user:profile_update_success]]');
@@ -128,7 +120,7 @@ define('forum/account/edit', [
}
function updateSignature() {
- var el = $('#inputSignature');
+ var el = $('#signature');
$('#signatureCharCountLeft').html(getCharsLeft(el, ajaxify.data.maximumSignatureLength));
el.on('keyup change', function () {
@@ -137,7 +129,7 @@ define('forum/account/edit', [
}
function updateAboutMe() {
- var el = $('#inputAboutMe');
+ var el = $('#aboutme');
$('#aboutMeCharCountLeft').html(getCharsLeft(el, ajaxify.data.maximumAboutMeLength));
el.on('keyup change', function () {