Skip to content

Feature: Implement User Avatars #20

@fred-maina

Description

@fred-maina

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

  1. Modify User.java: Add a new private String avatarUrl; field.
  2. 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.
  3. 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.
  4. 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.
  5. 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).
  6. Updated AC:
      1. Add avatarUrl to User.java.
      1. Populate avatarUrl in AuthService.handleGoogleOAuth from the picture claim.
      1. Populate avatarUrl in AuthService.signUp with a Gravatar link (e.g., https://www.gravatar.com/avatar/HASH?d=identicon).
      1. Ensure the User object returned by /api/auth/me, /api/auth/login, etc., includes this new avatarUrl field.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions