mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-02-14 02:27:49 +01:00
test: fix username test
move cover:url code to user/data.js like uploadedpicture
This commit is contained in:
@@ -9,9 +9,12 @@ const meta = require('../meta');
|
||||
const plugins = require('../plugins');
|
||||
const activitypub = require('../activitypub');
|
||||
const utils = require('../utils');
|
||||
const coverPhoto = require('../coverPhoto');
|
||||
|
||||
const relative_path = nconf.get('relative_path');
|
||||
|
||||
const prependRelativePath = url => url.startsWith('http') ? url : relative_path + url;
|
||||
|
||||
const intFields = [
|
||||
'uid', 'postcount', 'topiccount', 'reputation', 'profileviews',
|
||||
'banned', 'banned:expire', 'email:confirmed', 'joindate', 'lastonline',
|
||||
@@ -257,12 +260,18 @@ module.exports = function (User) {
|
||||
parseGroupTitle(user);
|
||||
}
|
||||
|
||||
if (user.picture && user.picture === user.uploadedpicture) {
|
||||
user.uploadedpicture = user.picture.startsWith('http') ? user.picture : relative_path + user.picture;
|
||||
user.picture = user.uploadedpicture;
|
||||
} else if (user.uploadedpicture) {
|
||||
user.uploadedpicture = user.uploadedpicture.startsWith('http') ? user.uploadedpicture : relative_path + user.uploadedpicture;
|
||||
if (user.uploadedpicture || user.picture) {
|
||||
const source = (user.picture && user.picture === user.uploadedpicture) ? user.picture : user.uploadedpicture;
|
||||
if (source) {
|
||||
user.uploadedpicture = prependRelativePath(source);
|
||||
user.picture = user.uploadedpicture;
|
||||
}
|
||||
}
|
||||
|
||||
user['cover:url'] = user['cover:url'] ?
|
||||
prependRelativePath(user['cover:url']) :
|
||||
coverPhoto.getDefaultProfileCover(user.uid);
|
||||
|
||||
if (meta.config.defaultAvatar && !user.picture) {
|
||||
user.picture = User.getDefaultAvatar();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user