1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.MastodonAPI.MarkerController do
6 use Pleroma.Web, :controller
7 alias Pleroma.Plugs.OAuthScopesPlug
11 %{scopes: ["read:statuses"]}
15 plug(OAuthScopesPlug, %{scopes: ["write:statuses"]} when action == :upsert)
16 plug(Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug)
17 action_fallback(Pleroma.Web.MastodonAPI.FallbackController)
20 def index(%{assigns: %{user: user}} = conn, params) do
22 Pleroma.Marker.get_markers(
25 %{recount_unread: true}
28 render(conn, "markers.json", %{markers: markers})
31 # POST /api/v1/markers
32 def upsert(%{assigns: %{user: user}} = conn, params) do
33 with {:ok, result} <- Pleroma.Marker.upsert(user, params),
34 markers <- Map.values(result) do
35 render(conn, "markers.json", %{markers: markers})