PhoenixKit 1.7.101: Users get notifications when something concerns them
PhoenixKit 1.7.101 adds notifications. When an activity is logged about one user by another, such as a like on their post, the target user gets a notification. Admins keep using the activity log and get none.
Users choose which types they want, account, posts or comments, under Notifications in their settings, then Save preferences. The Enable user notifications switch in the admin settings turns the feature off for everyone; it is on by default. A nightly job can delete notifications older than the retention period, 90 days unless set otherwise. Modules can register their own notification types.
The notification bell is not added to any page yet: a host renders PhoenixKitWeb.Live.NotificationsBell in its own header. A new <.phoenix_kit_favicon /> puts the site icon from Settings in a host’s own layout. Dropping several files into the media browser now reloads the list once instead of once per file.
Upgrading
Run mix phoenix_kit.update for V104. A new install’s Oban config gets the clean-up job; an existing one needs {"0 4 * * *", PhoenixKit.Notifications.PruneWorker} added to its cron list by hand.
Full release notes: PhoenixKit 1.7.101
1.7.101 · 24 April 2026
Added
- Notifications module — per-user inbox driven by the activity log. When
PhoenixKit.Activity.log/1records an entry withtarget_uuid != actor_uuid, a row is inserted intophoenix_kit_notificationsfor the target user. Independentseen_at/dismissed_atper row, per-user PubSub topic ("phoenix_kit:notifications:<user_uuid>"), global kill-switch vianotifications_enabledsetting (default"true"). Admins still audit via/admin/activityand don’t receive notifications (PR #505)- V104 migration:
phoenix_kit_notificationswith UUIDv7 PK, FKs tophoenix_kit_activitiesandphoenix_kit_users(bothON DELETE CASCADE), unique(activity_uuid, recipient_uuid)index, partial(recipient_uuid, inserted_at DESC) WHERE dismissed_at IS NULLindex for the inbox read path PhoenixKit.Notificationspublic API:maybe_create_from_activity/1,list_for_user/2,recent_for_user/2,count_unread/1,mark_seen/2,mark_all_seen/1,dismiss/2,dismiss_all/1,get_notification/2,enabled?/0,retention_days/0,prune/1PhoenixKit.Notifications.Render.render/1— maps action →%{icon, text, link, actor_uuid}; honors metadata overrides (notification_text,notification_icon,notification_link) before falling back to the action lookupPhoenixKit.Notifications.Typesregistry — three core types (account,posts,comments) plus extension point for external modules via the new optionalnotification_types/0callback onPhoenixKit.ModulePhoenixKit.Notifications.Prefs— per-user preferences persisted incustom_fields.notification_preferences(reuses V18 JSONB column; no migration). Fail-open on any ambiguityPhoenixKit.Notifications.PruneWorker— daily Oban cron at"0 4 * * *"; retention vianotifications_retention_days(falls back toactivity_retention_days, default 90)PhoenixKitWeb.Live.NotificationsBell— sticky nested LiveView for the bell + dropdown. Not mounted by default; parent apps render it where they have a user-facing header viaPhoenix.Component.live_render(..., sticky: true, session: %{"user_uuid" => ...}). Badge + recent list refresh live via PubSub- Notification preferences section in
PhoenixKitWeb.Live.Components.UserSettings— one toggle per registered type; unknown submitted keys dropped at the call site notifications_enabledtoggle on/admin/settings
- V104 migration:
- Arity-2
dynamic_children_fnfor admin sidebar tabs — callbacks can now be(scope, locale -> [tab])in addition to the existing(scope -> [tab]). Backwards-compatible extension: the sidebar dispatches on arity, every existing 1-arity callback keeps working unchanged. Lets plugins render locale-aware child labels without readingGettext.get_locale/1at render time (PR #506)
PhoenixKit 1.7.101. Install or update: {:phoenix_kit, "~> 1.7"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.