Schema for user blocking relationships.
Represents a one-way block where one user blocks another. Blocking prevents all interaction between users.
Fields
blocker_uuid- UUID of the user who initiated the blockblocked_uuid- UUID of the user who is blockedreason- Optional reason for the block (visible to admins)inserted_at- When the block was created
Examples
# User A blocks User B
%Block{
uuid: "018e3c4a-9f6b-7890-abcd-ef1234567890",
blocker_uuid: "019abc12-3456-7890-abcd-ef1234567890",
blocked_uuid: "019abc12-9876-5432-abcd-ef1234567890",
reason: "Spam",
inserted_at: ~N[2025-01-15 10:30:00]
}Business Rules
- Cannot block yourself
- Blocking removes any existing follows between the users
- Blocking removes any existing connections between the users
- Blocked users cannot follow, connect, or view the blocker's profile
- Blocking is one-way (A blocks B doesn't mean B blocks A)
Summary
Functions
Changeset for creating a block.
Types
@type t() :: %PhoenixKit.Modules.Connections.Block{ __meta__: term(), blocked: PhoenixKit.Users.Auth.User.t() | Ecto.Association.NotLoaded.t(), blocked_uuid: UUIDv7.t(), blocker: PhoenixKit.Users.Auth.User.t() | Ecto.Association.NotLoaded.t(), blocker_uuid: UUIDv7.t(), inserted_at: DateTime.t() | nil, reason: String.t() | nil, uuid: UUIDv7.t() | nil }
Functions
Changeset for creating a block.
Required Fields
blocker_uuid- UUID of the user who is blockingblocked_uuid- UUID of the user being blocked
Optional Fields
reason- Why the user was blocked
Validation Rules
- Both user UUIDs are required
- Cannot block yourself
- Unique constraint on (blocker_uuid, blocked_uuid) pair