diff options
author | Ekaterina Vaartis <vaartis@cock.li> | 2018-09-02 00:33:13 +0300 |
---|---|---|
committer | Ekaterina Vaartis <vaartis@cock.li> | 2019-02-19 21:49:55 +0300 |
commit | da64ea4a5540bf21770de039e27a33b5ef9fb377 (patch) | |
tree | 4249c9cb371f65c5e6cbcfa6e1f2abde631483a2 /lib | |
parent | f41f017bbca232c2ab3cd41ad23ef95d5ad13e36 (diff) | |
download | pleroma-da64ea4a5540bf21770de039e27a33b5ef9fb377.tar.gz |
Implement mastodon mutes endpoint
Aparently i forgot to add it, it gets a list of muted users
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/mastodon_api/mastodon_api_controller.ex | 9 | ||||
-rw-r--r-- | lib/pleroma/web/router.ex | 2 |
2 files changed, 10 insertions, 1 deletions
diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex index af16264ee..49b49be19 100644 --- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex +++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex @@ -780,6 +780,15 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do end end + # TODO: Use proper query + def mutes(%{assigns: %{user: user}} = conn, _) do + with muted_users <- user.info["mutes"] || [], + accounts <- Enum.map(muted_users, fn ap_id -> User.get_cached_by_ap_id(ap_id) end) do + res = AccountView.render("accounts.json", users: accounts, for: user, as: :user) + json(conn, res) + end + end + def block(%{assigns: %{user: blocker}} = conn, %{"id" => id}) do with %User{} = blocked <- Repo.get(User, id), {:ok, blocker} <- User.block(blocker, blocked), diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index fb7a8d448..1b62d02ea 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -178,7 +178,7 @@ defmodule Pleroma.Web.Router do get("/blocks", MastodonAPIController, :blocks) - get("/mutes", MastodonAPIController, :empty_array) + get("/mutes", MastodonAPIController, :mutes) get("/timelines/home", MastodonAPIController, :home_timeline) |