mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-07-09 11:11:34 +02:00
fix: remove unused data from post/topic/user hashes
This commit is contained in:
@@ -24,23 +24,20 @@ module.exports = function (User) {
|
||||
email: data.email || '',
|
||||
joindate: timestamp,
|
||||
lastonline: timestamp,
|
||||
picture: data.picture || '',
|
||||
fullname: data.fullname || '',
|
||||
location: data.location || '',
|
||||
birthday: data.birthday || '',
|
||||
website: '',
|
||||
signature: '',
|
||||
uploadedpicture: '',
|
||||
profileviews: 0,
|
||||
reputation: 0,
|
||||
postcount: 0,
|
||||
topiccount: 0,
|
||||
lastposttime: 0,
|
||||
banned: 0,
|
||||
status: 'online',
|
||||
gdpr_consent: data.gdpr_consent === true ? 1 : 0,
|
||||
acceptTos: data.acceptTos === true ? 1 : 0,
|
||||
};
|
||||
['picture', 'fullname', 'location', 'birthday'].forEach((field) => {
|
||||
if (data[field]) {
|
||||
userData[field] = data[field];
|
||||
}
|
||||
});
|
||||
if (data.gdpr_consent === true) {
|
||||
userData.gdpr_consent = 1;
|
||||
}
|
||||
if (data.acceptTos === true) {
|
||||
userData.acceptTos = 1;
|
||||
}
|
||||
|
||||
const renamedUsername = await User.uniqueUsername(userData);
|
||||
const userNameChanged = !!renamedUsername;
|
||||
if (userNameChanged) {
|
||||
|
||||
@@ -12,7 +12,7 @@ const utils = require('../utils');
|
||||
const intFields = [
|
||||
'uid', 'postcount', 'topiccount', 'reputation', 'profileviews',
|
||||
'banned', 'banned:expire', 'email:confirmed', 'joindate', 'lastonline', 'lastqueuetime',
|
||||
'lastposttime', 'followingCount', 'followerCount',
|
||||
'lastposttime', 'followingCount', 'followerCount', 'passwordExpiry',
|
||||
];
|
||||
|
||||
module.exports = function (User) {
|
||||
|
||||
@@ -86,7 +86,9 @@ UserReset.updateExpiry = async function (uid) {
|
||||
const oneDay = 1000 * 60 * 60 * 24;
|
||||
const expireDays = meta.config.passwordExpiryDays;
|
||||
const expiry = Date.now() + (oneDay * expireDays);
|
||||
await user.setUserField(uid, 'passwordExpiry', expireDays > 0 ? expiry : 0);
|
||||
if (expireDays > 0) {
|
||||
await user.setUserField(uid, 'passwordExpiry', expiry);
|
||||
}
|
||||
};
|
||||
|
||||
UserReset.clean = async function () {
|
||||
|
||||
Reference in New Issue
Block a user