profile: add hasAvatar

This commit is contained in:
Girish Ramakrishnan
2025-12-10 18:53:31 +01:00
parent 001adcee62
commit bbefca71e5
2 changed files with 5 additions and 6 deletions

View File

@@ -99,7 +99,8 @@ const appPasswords = require('./apppasswords.js'),
// the avatar and backgroundImage fields are special and not added here to reduce response sizes
const USERS_FIELDS = [ 'id', 'username', 'email', 'fallbackEmail', 'password', 'salt', 'creationTime', 'inviteToken', 'resetToken', 'displayName', 'language',
'twoFactorAuthenticationEnabled', 'twoFactorAuthenticationSecret', 'active', 'source', 'role', 'resetTokenCreationTime', 'loginLocationsJson', 'notificationConfigJson' ].join(',');
'twoFactorAuthenticationEnabled', 'twoFactorAuthenticationSecret', 'active', 'source', 'role', 'resetTokenCreationTime', 'loginLocationsJson', 'notificationConfigJson',
'(avatar IS NOT NULL) AS hasAvatar', '(backgroundImage IS NOT NULL) AS hasBackgroundImage' ].join(',');
const DEFAULT_GHOST_LIFETIME = 6 * 60 * 60 * 1000; // 6 hours
@@ -191,7 +192,7 @@ function validatePassword(password) {
function removePrivateFields(user) {
const result = _.pick(user, [
'id', 'username', 'email', 'fallbackEmail', 'displayName', 'groupIds', 'active', 'source', 'role', 'createdAt',
'twoFactorAuthenticationEnabled', 'notificationConfig']);
'twoFactorAuthenticationEnabled', 'notificationConfig', 'hasAvatar', 'hasBackgroundImage' ]);
// invite status indicator
result.inviteAccepted = !user.inviteToken;