Skip to content

Commit

Permalink
set default avatar not respecting setting
Browse files Browse the repository at this point in the history
  • Loading branch information
KevLehman committed Dec 13, 2024
1 parent e080c0f commit 2c039eb
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion apps/meteor/server/routes/avatar/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,20 @@ export const userAvatarByUsername = async function (request: IncomingMessage, re

// if request starts with @ always return the svg letters
if (requestUsername[0] === '@') {
serveSvgAvatarInRequestedFormat({ nameOrUsername: requestUsername.slice(1), req, res });
const usernameWithoutAt = requestUsername.slice(1);
if (settings.get('UI_Use_Name_Avatar')) {
const user = await Users.findOneByUsernameIgnoringCase(usernameWithoutAt, {
projection: {
name: 1,
},
});

if (user?.name) {
serveSvgAvatarInRequestedFormat({ nameOrUsername: user.name, req, res, useAllInitials: true });
return;
}
}
serveSvgAvatarInRequestedFormat({ nameOrUsername: usernameWithoutAt, req, res });
return;
}

Expand Down

0 comments on commit 2c039eb

Please sign in to comment.