Skip to content

PhoenixKit 1.7.159: Employment history for Staff and a tidier Activity page

PhoenixKit 1.7.159 adds employment history for the Staff module with migration V136, lets a module link to the activity of a single record, and makes the Activity page and media picker easier to use.

V136 stores a history of each staff member’s jobs, with type, title, department, dates and place of work, and creates one current entry for every existing person. The Activity page now accepts a record filter in its address, and keeps it when another filter is picked. Before, such a feed showed the events of every record of that type. Its filters fit one row on a phone as dropdowns, and a Grid and List switch is remembered.

The media picker accepts only the file type it was opened for, checked on the server too, leaves trashed and system files out, and can open as a plain uploader. Two pickers on one page no longer clash. Switching the users or activity view no longer adds a column to Customize Table Columns or reloads the users list for every admin. mdex is now a core dependency that modules share.

Upgrading

Run mix phoenix_kit.update for V136.

Full release notes: PhoenixKit 1.7.159

1.7.159 · 17 June 2026

Staff-support core changes (V136 employment history, Activity per-resource filter, media picker hardening, embedded-LiveView identity) plus follow-up review fixes. These changes landed on main after 1.7.158 without a version bump; recorded here.

Added

  • V136 migration — phoenix_kit_staff_employments, a per-person history of employment spans (employment type, translatable job_title, department/team snapshot, date range, work_location, notes). A partial unique index enforces one open (current) span per person; the matching phoenix_kit_staff_people columns are kept as a denormalized mirror of the current span (not dropped). Backfills one open span per existing person (guarded, retry-safe). @current_version → 136.
  • PhoenixKitWeb.Users.Auth.assign_embedded_current_user/2 — reconstructs :phoenix_kit_current_user / :phoenix_kit_current_scope on an off-router embedded LiveView mount from a host-supplied session["current_user_uuid"]. No-ops on a router mount, degrades to anonymous for an absent/unknown/inactive uuid, and reconstructs identity (not authorization). Reference consumer: phoenix_kit_projects.
  • Upload-only media picker — MediaSelectorModal gains a browse: false mode that hides the library grid/search/filter, leaving a pure uploader (uploaded files auto-select).
  • update_user_custom_fields/3 gains :broadcast and :ensure_definitions options (both default true, so existing callers are unchanged).

Changed

  • PhoenixKit.Activity.list/1 (and count/1) now honour a :resource_uuid filter, and the admin Activity page (/admin/activity) reads a resource_uuid URL param — so a module can deep-link a per-resource feed. Previously :resource_uuid was silently ignored, leaking every same-type resource’s events into a per-resource view.
  • MediaSelectorModal constrains uploads to the active type filter, shows filter-aware copy, excludes trashed / system-managed files from the browse list, and gives each instance a unique <dialog> id so two pickers on one page don’t collide.
  • Admin Activity page UI follow-ups (PR #600): the filter toolbar fits one row on mobile (Module / Mode / Action / Type as compact dropdowns), a persisted grid/list Display toggle, and a mobile-friendly list view. The user form’s Cancel / primary buttons are reordered (Cancel left, primary right) to match the rest of the admin UI.

Fixed

  • The manage-users and activity grid/list view toggles no longer register their internal users_view_mode / activity_view_mode preference as a user-facing custom-field definition (it was leaking into the Customize Columns modal) and no longer broadcast a user_updated event — so toggling the view stops re-querying the users list for every connected admin.
  • The Activity page’s new filter dropdowns preserve the resource_uuid deep-link scope (a per-resource feed no longer reverts to all activity when a filter is picked).
  • The media picker now rejects off-type uploads server-side. The client accept list is fixed when the upload is first allowed and can’t track the in-modal type dropdown, so an image/video picker could still store an off-type file; MediaSelectorModal re-checks the type on upload and rejects mismatches.
  • The accepted-types hint is shown in the upload-only media picker (it was hidden in browse: false mode, the one place it’s most useful).

i18n

  • Internationalized the full-page media selector and the Jobs / Languages admin page headers; added the new picker copy strings (et, ru).

PhoenixKit 1.7.159. Install or update: {:phoenix_kit, "~> 1.7"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.