Add user profile management: display name + avatar upload (Gitea issue #12)

Users can set a display name (shown instead of username in the message
list, room member list, TopBar, and admin Users tab) and upload a real
avatar, replacing the generated color-initial avatars everywhere a user
appears. Avatars are square-cropped and downscaled to 512px, reusing
app/storage.py's upload primitives from image uploads with a new square
option.

Two deliberate divergences from message-image handling, documented in
backend/README.md: the previous avatar file is deleted on replace/remove
(safe since it's strictly one file per user), and avatar serving is not
room-gated and uses a short cache (identity-addressed and mutable, unlike
a message image's permanent content-addressed URL).

Frontend: new ProfileModal reachable from the TopBar account menu;
AuthContext gains updateUser() so a profile change reflects instantly
everywhere without a refetch.
This commit is contained in:
2026-08-14 16:59:56 -06:00
parent c6f90d49fc
commit 8ca3e2e23d
28 changed files with 689 additions and 41 deletions
+8 -1
View File
@@ -214,7 +214,12 @@ async def list_room_members_endpoint(
memberships = await list_room_members(db, room_id)
return [
RoomMemberRead(
user_id=m.user_id, username=m.user.username, role=m.role, joined_at=m.joined_at
user_id=m.user_id,
username=m.user.username,
display_name=m.user.display_name,
avatar_filename=m.user.avatar_filename,
role=m.role,
joined_at=m.joined_at,
)
for m in memberships
]
@@ -260,6 +265,8 @@ async def change_member_role_endpoint(
return RoomMemberRead(
user_id=membership.user_id,
username=membership.user.username,
display_name=membership.user.display_name,
avatar_filename=membership.user.avatar_filename,
role=membership.role,
joined_at=membership.joined_at,
)