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>
45 lines
1.0 KiB
Python
45 lines
1.0 KiB
Python
"""Add linked_user_id and is_umbral_contact to people table.
|
|
|
|
Revision ID: 043
|
|
Revises: 042
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
revision = "043"
|
|
down_revision = "042"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.add_column(
|
|
"people",
|
|
sa.Column(
|
|
"linked_user_id",
|
|
sa.Integer,
|
|
sa.ForeignKey("users.id", ondelete="SET NULL"),
|
|
nullable=True,
|
|
),
|
|
)
|
|
op.add_column(
|
|
"people",
|
|
sa.Column(
|
|
"is_umbral_contact",
|
|
sa.Boolean,
|
|
nullable=False,
|
|
server_default="false",
|
|
),
|
|
)
|
|
# Fast lookup of umbral contacts by owner
|
|
op.execute(
|
|
'CREATE INDEX "ix_people_linked_user" ON people (user_id, linked_user_id) '
|
|
"WHERE linked_user_id IS NOT NULL"
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.execute('DROP INDEX IF EXISTS "ix_people_linked_user"')
|
|
op.drop_column("people", "is_umbral_contact")
|
|
op.drop_column("people", "linked_user_id")
|