PhoenixKitWeb.Live.Users.Media (phoenix_kit v2.44.0)

Copy Markdown View Source

Media management LiveView — thin wrapper around MediaBrowser LiveComponent.

This LiveView owns the page layout and assigns required by LayoutWrapper.app_layout. All media browser state and logic live in PhoenixKitWeb.Components.MediaBrowser.

URL sync (shareable …/admin/media?folder=<uuid> deep links) is provided by the MediaBrowser.Embed macro's url_sync option — it injects the handle_params / {:navigate} → push_patch round-trip and parses :initial_params from the URL in on_mount, so this module only owns the page-chrome assigns.

Libraries

The page shows one library at a time, and what it shows depends on who is looking (dev_docs/plans/2026-09-30-media-by-viewer.md):

  • a site library (PhoenixKit.Modules.Storage.Libraries): the default one (Media) at the bare /admin/media, any other at /admin/media/library/<slug>. An Owner/Admin, or a holder of media.view_all, sees every file. A holder of media without it sees only their own stuff: the files they uploaded, the folders they created or that hold their files, and those folders' ancestors (MediaBrowser's viewer_uuid).
  • one of the viewer's own or shared user libraries (while user libraries are on and the viewer holds storage), at /admin/media/my/<slug or uuid>, with the rights their role gives them there.

They share one switcher, grouped "Site" and "Mine". While there is only one library, nothing about libraries is shown. Another user's library is opened, by an Owner/Admin, at /admin/libraries (audit-logged), not here. Libraries are created, renamed and deleted in Settings → Media → Libraries (site) and on the profile's Media tab (user).

Summary

Functions

handle_event(binary, arg2, socket)

Callback implementation for Phoenix.LiveView.handle_event/3.

handle_info(msg, socket)

Callback implementation for Phoenix.LiveView.handle_info/2.

handle_params(params, uri, socket)

Callback implementation for Phoenix.LiveView.handle_params/3.

mount(params, session, socket)

Callback implementation for Phoenix.LiveView.mount/3.

render(assigns)

Callback implementation for Phoenix.LiveView.render/1.