mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-06 02:56:07 +02:00
feat: use updateProfile for picture change
so it triggers action:user:updateProfile
This commit is contained in:
@@ -108,10 +108,11 @@ module.exports = function (User) {
|
||||
});
|
||||
|
||||
await deleteCurrentPicture(data.uid, 'uploadedpicture');
|
||||
await User.setUserFields(data.uid, {
|
||||
await User.updateProfile(data.callerUid, {
|
||||
uid: data.uid,
|
||||
uploadedpicture: uploadedImage.url,
|
||||
picture: uploadedImage.url,
|
||||
});
|
||||
}, ['uploadedpicture', 'picture']);
|
||||
return uploadedImage;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
const _ = require('lodash');
|
||||
const async = require('async');
|
||||
const validator = require('validator');
|
||||
const winston = require('winston');
|
||||
@@ -13,11 +14,14 @@ const groups = require('../groups');
|
||||
const plugins = require('../plugins');
|
||||
|
||||
module.exports = function (User) {
|
||||
User.updateProfile = async function (uid, data) {
|
||||
User.updateProfile = async function (uid, data, extraFields) {
|
||||
let fields = [
|
||||
'username', 'email', 'fullname', 'website', 'location',
|
||||
'groupTitle', 'birthday', 'signature', 'aboutme',
|
||||
];
|
||||
if (Array.isArray(extraFields)) {
|
||||
fields = _.uniq(fields.concat(extraFields));
|
||||
}
|
||||
if (!data.uid) {
|
||||
throw new Error('[[error:invalid-update-uid]]');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user