Implements the full User Connections & Notification Centre feature: Phase 1 - Database: migrations 039-043 adding umbral_name to users, profile/social fields to settings, notifications table, connection request/user_connection tables, and linked_user_id to people. Phase 2 - Notifications: backend CRUD router + service + 90-day purge, frontend NotificationsPage with All/Unread filter, bell icon in sidebar with unread badge polling every 60s. Phase 3 - Settings: profile fields (phone, mobile, address, company, job_title), social card with accept_connections toggle and per-field sharing defaults, umbral name display with CopyableField. Phase 4 - Connections: timing-safe user search, send/accept/reject flow with atomic status updates, bidirectional UserConnection + Person records, in-app + ntfy notifications, per-receiver pending cap, nginx rate limiting. Phase 5 - People integration: batch-loaded shared profiles (N+1 prevention), Ghost icon for umbral contacts, Umbral filter pill, split Add Person button, shared field indicators (synced labels + Lock icons), disabled form inputs for synced fields on umbral contacts. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
86 lines
2.8 KiB
Python
86 lines
2.8 KiB
Python
"""Expand settings with profile, social, and sharing fields.
|
|
|
|
Revision ID: 040
|
|
Revises: 039
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
revision = "040"
|
|
down_revision = "039"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
# Profile fields
|
|
op.add_column("settings", sa.Column("phone", sa.String(50), nullable=True))
|
|
op.add_column("settings", sa.Column("mobile", sa.String(50), nullable=True))
|
|
op.add_column("settings", sa.Column("address", sa.Text, nullable=True))
|
|
op.add_column("settings", sa.Column("company", sa.String(255), nullable=True))
|
|
op.add_column("settings", sa.Column("job_title", sa.String(255), nullable=True))
|
|
|
|
# Social toggle
|
|
op.add_column(
|
|
"settings",
|
|
sa.Column("accept_connections", sa.Boolean, nullable=False, server_default="false"),
|
|
)
|
|
|
|
# Sharing defaults
|
|
op.add_column(
|
|
"settings",
|
|
sa.Column("share_preferred_name", sa.Boolean, nullable=False, server_default="true"),
|
|
)
|
|
op.add_column(
|
|
"settings",
|
|
sa.Column("share_email", sa.Boolean, nullable=False, server_default="false"),
|
|
)
|
|
op.add_column(
|
|
"settings",
|
|
sa.Column("share_phone", sa.Boolean, nullable=False, server_default="false"),
|
|
)
|
|
op.add_column(
|
|
"settings",
|
|
sa.Column("share_mobile", sa.Boolean, nullable=False, server_default="false"),
|
|
)
|
|
op.add_column(
|
|
"settings",
|
|
sa.Column("share_birthday", sa.Boolean, nullable=False, server_default="false"),
|
|
)
|
|
op.add_column(
|
|
"settings",
|
|
sa.Column("share_address", sa.Boolean, nullable=False, server_default="false"),
|
|
)
|
|
op.add_column(
|
|
"settings",
|
|
sa.Column("share_company", sa.Boolean, nullable=False, server_default="false"),
|
|
)
|
|
op.add_column(
|
|
"settings",
|
|
sa.Column("share_job_title", sa.Boolean, nullable=False, server_default="false"),
|
|
)
|
|
|
|
# ntfy connection notifications toggle (gates push only, not in-app)
|
|
op.add_column(
|
|
"settings",
|
|
sa.Column("ntfy_connections_enabled", sa.Boolean, nullable=False, server_default="true"),
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_column("settings", "ntfy_connections_enabled")
|
|
op.drop_column("settings", "share_job_title")
|
|
op.drop_column("settings", "share_company")
|
|
op.drop_column("settings", "share_address")
|
|
op.drop_column("settings", "share_birthday")
|
|
op.drop_column("settings", "share_mobile")
|
|
op.drop_column("settings", "share_phone")
|
|
op.drop_column("settings", "share_email")
|
|
op.drop_column("settings", "share_preferred_name")
|
|
op.drop_column("settings", "accept_connections")
|
|
op.drop_column("settings", "job_title")
|
|
op.drop_column("settings", "company")
|
|
op.drop_column("settings", "address")
|
|
op.drop_column("settings", "mobile")
|
|
op.drop_column("settings", "phone")
|