Merge branch 'develop' into issue/1276
[akkoma] / lib / pleroma / web / mastodon_api / views / marker_view.ex
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 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 Enum.reduce(markers, %{}, fn m, acc ->
10 Map.put_new(acc, m.timeline, %{
11 last_read_id: m.last_read_id,
12 version: m.lock_version,
13 updated_at: NaiveDateTime.to_iso8601(m.updated_at),
14 pleroma: %{
15 unread_count: m.unread_count
16 }
17 })
18 end)
19 end
20 end