fix: guest join doesn't add avatar when logged in
All checks were successful
Build & Push Docker Image / build (push) Successful in 4m27s
All checks were successful
Build & Push Docker Image / build (push) Successful in 4m27s
This commit is contained in:
@@ -602,7 +602,7 @@ router.get('/:uid/public', async (req, res) => {
|
||||
// POST /api/rooms/:uid/guest-join - Join meeting as guest (no auth needed)
|
||||
router.post('/:uid/guest-join', guestJoinLimiter, async (req, res) => {
|
||||
try {
|
||||
const { name, access_code, moderator_code } = req.body;
|
||||
const { name, access_code, moderator_code, avatar_image, avatar_color } = req.body;
|
||||
|
||||
if (!name || name.trim().length === 0) {
|
||||
return res.status(400).json({ error: 'Name is required' });
|
||||
@@ -648,7 +648,17 @@ router.post('/:uid/guest-join', guestJoinLimiter, async (req, res) => {
|
||||
}
|
||||
|
||||
const baseUrl = getBaseUrl(req);
|
||||
const guestAvatarURL = `${baseUrl}/api/auth/avatar/initials/${encodeURIComponent(name.trim())}`;
|
||||
let guestAvatarURL;
|
||||
if (avatar_image) {
|
||||
// Use avatar image of the logged-in user
|
||||
guestAvatarURL = `${baseUrl}/api/auth/avatar/${avatar_image}`;
|
||||
} else if (avatar_color) {
|
||||
// Initials with user color
|
||||
guestAvatarURL = `${baseUrl}/api/auth/avatar/initials/${encodeURIComponent(name.trim())}?color=${encodeURIComponent(avatar_color)}`;
|
||||
} else {
|
||||
// Default: initials without color
|
||||
guestAvatarURL = `${baseUrl}/api/auth/avatar/initials/${encodeURIComponent(name.trim())}`;
|
||||
}
|
||||
const joinUrl = await joinMeeting(room.uid, name.trim(), isModerator, guestAvatarURL);
|
||||
res.json({ joinUrl });
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user