PhoenixKit.API.Approvals.Notifier (phoenix_kit v2.63.0)

Copy Markdown View Source

The "approval waiting" notice: when an approval is queued, those who may decide it get an in-app notification, at most one per API key per ten minutes, and an unread one is refreshed instead of repeated.

The ten-minute window is the notified_at column: under a per-key advisory lock the first approval of a key to find no notified_at in the last ten minutes sets its own and sends; the others send nothing. The notification itself goes through PhoenixKit.Notifications.upsert_inapp/3 with the dedupe key api:approvals:<key uuid>, so a notice nobody has read yet is updated ("3 operations are waiting") and a second bell is never added.

The text is English: a notification row stores its text.

Summary

Functions

Tells the deciders of approval that it is waiting, unless the key was announced in the last ten minutes. Never raises: a failed notice must not fail the API call.

Functions

notify_requested(approval, now \\ DateTime.utc_now())

@spec notify_requested(PhoenixKit.API.Confirm.Confirmation.t(), DateTime.t()) ::
  :ok | :throttled

Tells the deciders of approval that it is waiting, unless the key was announced in the last ten minutes. Never raises: a failed notice must not fail the API call.