Description
Currently, ChatService.getUserChatSessions hardcodes a placeholder avatar from pravatar.cc:
.avatarUrl("[https://i.pravatar.cc/150?u=](https://i.pravatar.cc/150?u=)" + sessionId)
This should be replaced with a real avatar system. A simple first step would be to use the user's Google profile picture (if they signed in with Google) or a generated "identicon" for email/password users.
Acceptance Criteria
- Modify
User.java: Add a new private String avatarUrl; field.
- Modify
AuthService.handleGoogleOAuth: When validating the id_token, extract the picture claim from the Google token info response. Save this URL to the avatarUrl field on the new User or existing User.
- Modify
AuthService.signUp: For users signing up with email/password, generate a default avatar (e.g., using a service like https://www.gravatar.com/avatar/{hash_of_email} or a local identicon library) and save it to the avatarUrl field.
- Modify
ChatService.getUserChatSessions: This method is for anonymous sessions. The avatar should be for the anonymous user. The pravatar.cc link based on sessionId is actually a good, simple solution for anonymous users. The issue is that registered users also need avatars.
- Refinement: The
User model needs an avatarUrl. The ChatSessionDto avatarUrl should remain the anonymous user's avatar. A new feature is needed to get the registered user's avatar (e.g., on the /api/auth/me response).
- Updated AC:
-
- Add
avatarUrl to User.java.
-
- Populate
avatarUrl in AuthService.handleGoogleOAuth from the picture claim.
-
- Populate
avatarUrl in AuthService.signUp with a Gravatar link (e.g., https://www.gravatar.com/avatar/HASH?d=identicon).
-
- Ensure the
User object returned by /api/auth/me, /api/auth/login, etc., includes this new avatarUrl field.
Description
Currently,
ChatService.getUserChatSessionshardcodes a placeholder avatar frompravatar.cc:This should be replaced with a real avatar system. A simple first step would be to use the user's Google profile picture (if they signed in with Google) or a generated "identicon" for email/password users.
Acceptance Criteria
User.java: Add a newprivate String avatarUrl;field.AuthService.handleGoogleOAuth: When validating theid_token, extract thepictureclaim from the Google token info response. Save this URL to theavatarUrlfield on the newUseror existingUser.AuthService.signUp: For users signing up with email/password, generate a default avatar (e.g., using a service likehttps://www.gravatar.com/avatar/{hash_of_email}or a local identicon library) and save it to theavatarUrlfield.ChatService.getUserChatSessions: This method is for anonymous sessions. The avatar should be for the anonymous user. Thepravatar.cclink based onsessionIdis actually a good, simple solution for anonymous users. The issue is that registered users also need avatars.Usermodel needs anavatarUrl. TheChatSessionDtoavatarUrlshould remain the anonymous user's avatar. A new feature is needed to get the registered user's avatar (e.g., on the/api/auth/meresponse).avatarUrltoUser.java.avatarUrlinAuthService.handleGoogleOAuthfrom thepictureclaim.avatarUrlinAuthService.signUpwith a Gravatar link (e.g.,https://www.gravatar.com/avatar/HASH?d=identicon).Userobject returned by/api/auth/me,/api/auth/login, etc., includes this newavatarUrlfield.