diff options
author | eugenijm <eugenijm@protonmail.com> | 2019-03-15 20:06:28 +0300 |
---|---|---|
committer | eugenijm <eugenijm@protonmail.com> | 2019-03-15 23:56:14 +0300 |
commit | 43fb03be5a8968c1df23938ed4f5a93825ab476c (patch) | |
tree | 31b8bc6913a212c1739aa6b27feec0c8ac1b16bf /lib/pleroma/web/twitter_api/controllers/util_controller.ex | |
parent | 4b3c86c1a61a029202a262229c713cc3737b2a1b (diff) | |
download | pleroma-43fb03be5a8968c1df23938ed4f5a93825ab476c.tar.gz |
Allow to mark a single notification as read
Diffstat (limited to 'lib/pleroma/web/twitter_api/controllers/util_controller.ex')
-rw-r--r-- | lib/pleroma/web/twitter_api/controllers/util_controller.ex | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/pleroma/web/twitter_api/controllers/util_controller.ex b/lib/pleroma/web/twitter_api/controllers/util_controller.ex index 8ed02a93f..320ec778c 100644 --- a/lib/pleroma/web/twitter_api/controllers/util_controller.ex +++ b/lib/pleroma/web/twitter_api/controllers/util_controller.ex @@ -9,6 +9,7 @@ defmodule Pleroma.Web.TwitterAPI.UtilController do alias Comeonin.Pbkdf2 alias Pleroma.Emoji + alias Pleroma.Notification alias Pleroma.PasswordResetToken alias Pleroma.Repo alias Pleroma.User @@ -142,6 +143,17 @@ defmodule Pleroma.Web.TwitterAPI.UtilController do end end + def notifications_read(%{assigns: %{user: user}} = conn, %{"id" => notification_id}) do + with {:ok, _} <- Notification.read_one(user, notification_id) do + json(conn, %{status: "success"}) + else + {:error, message} -> + conn + |> put_resp_content_type("application/json") + |> send_resp(403, Jason.encode!(%{"error" => message})) + end + end + def config(conn, _params) do instance = Pleroma.Config.get(:instance) instance_fe = Pleroma.Config.get(:fe) |