Bonfire.API.MastoCompat.Mappers.Conversation (Bonfire v1.0.1-social-alpha.28)
View SourceMaps Bonfire Message threads to Mastodon Conversation format.
A Mastodon Conversation represents a DM thread with:
- id: Thread ID
- accounts: Participants in the conversation
- unread: Whether there are unseen messages
- last_status: The most recent message in the thread
Usage
# Transform a thread message (from latest_in_threads query)
Mappers.Conversation.from_thread(message, current_user: user)
Summary
Functions
Transform a Bonfire thread message into a Mastodon Conversation.
Functions
Transform a Bonfire thread message into a Mastodon Conversation.
Expects a message from Bonfire.Messages.list/3 with latest_in_threads: true.
Options
:current_user- The current user (required for participants and seen status)
Examples
iex> from_thread(message, current_user: user)
%{"id" => "thread_123", "accounts" => [...], "unread" => false, "last_status" => {...}}