Private
Public Access
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.
37 lines
1.1 KiB
Python
37 lines
1.1 KiB
Python
"""user profile fields
|
|
|
|
Revision ID: f6e024985d4d
|
|
Revises: 1d355add7299
|
|
Create Date: 2026-08-14 16:47:04.360957
|
|
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = 'f6e024985d4d'
|
|
down_revision: Union[str, Sequence[str], None] = '1d355add7299'
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
"""Upgrade schema."""
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.add_column('users', sa.Column('display_name', sa.String(length=50), nullable=True))
|
|
op.add_column('users', sa.Column('avatar_filename', sa.String(length=64), nullable=True))
|
|
op.add_column('users', sa.Column('avatar_content_type', sa.String(length=50), nullable=True))
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
"""Downgrade schema."""
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_column('users', 'avatar_content_type')
|
|
op.drop_column('users', 'avatar_filename')
|
|
op.drop_column('users', 'display_name')
|
|
# ### end Alembic commands ###
|