944769b1a934abc2632512b3604b9fc663e5fd95
[anni] / lib / pleroma / web / mastodon_api / views / marker_view.ex
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Web.MastodonAPI.MarkerView do
6   use Pleroma.Web, :view
7
8   def render("markers.json", %{markers: markers}) do
9     Map.new(markers, fn m ->
10       {m.timeline,
11        %{
12          last_read_id: m.last_read_id,
13          version: m.lock_version,
14          updated_at: NaiveDateTime.to_iso8601(m.updated_at),
15          pleroma: %{
16            unread_count: m.unread_count
17          }
18        }}
19     end)
20   end
21 end