PhoenixKitInbox.Paths (PhoenixKitInbox v0.2.0)

Copy Markdown View Source

Centralized URL paths for the Inbox module.

Every href, patch, navigate, and redirect in this module goes through a function here, and every function here goes through PhoenixKit.Utils.Routes.path/1 so the host's URL prefix and the current locale are applied. A hardcoded "/admin/inbox" works on a default install and 404s on a prefixed or localized one.

Summary

Functions

The compose view. Pass :reply_to or :draft to prefill it.

The mailbox view.

The shared-mailbox management view.

The raw (unprefixed) path to a message, for embedding in notification links.

Functions

compose(opts \\ [])

@spec compose(keyword()) :: String.t()

The compose view. Pass :reply_to or :draft to prefill it.

inbox(opts \\ [])

@spec inbox(keyword()) :: String.t()

The mailbox view.

Options

  • :mailbox — mailbox uuid to open (defaults to the user's personal one)
  • :folder — one of PhoenixKitInbox.Schemas.Delivery.folders/0
  • :message — message uuid to open in the reading pane
  • :search — search term to filter the list by
  • :unseen"1" to show only unseen messages
  • :page — 1-based page number; page 1 is omitted so the canonical first-page URL has no page= in it

Everything except the mailbox itself is a query param rather than a path segment, so the whole mailbox stays one LiveView: switching folders or opening a message is a push_patch, not a remount. InboxLive builds every one of its patches through this function.

iex> PhoenixKitInbox.Paths.inbox(folder: "sent")
"/admin/inbox?folder=sent"

mailboxes()

@spec mailboxes() :: String.t()

The shared-mailbox management view.

raw_message_path(mailbox_uuid, message_uuid)

@spec raw_message_path(binary(), binary()) :: String.t()

The raw (unprefixed) path to a message, for embedding in notification links.

PhoenixKit.Notifications runs stored links through Routes.path/1 itself, so a pre-prefixed path would come out double-prefixed.