diff options
author | Ilja <ilja@ilja.space> | 2022-03-02 18:05:50 +0100 |
---|---|---|
committer | Ilja <ilja@ilja.space> | 2022-06-21 12:10:27 +0200 |
commit | eab13fed3e6ba7edd7847fd00581b45dc4292af0 (patch) | |
tree | 8ec33084409adb4a82c4a46ad0baf63e884c3492 /lib | |
parent | e45faddb38311c799b2276cb952ac7715e2cbfab (diff) | |
download | pleroma-eab13fed3e6ba7edd7847fd00581b45dc4292af0.tar.gz pleroma-eab13fed3e6ba7edd7847fd00581b45dc4292af0.zip |
Hide pleroma:report for non-privileged users
Before we deleted the notifications, but that was a side effect and didn't always trigger any more.
Now we just hide them when an unprivileged user asks them.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/mastodon_api/mastodon_api.ex | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/pleroma/web/mastodon_api/mastodon_api.ex b/lib/pleroma/web/mastodon_api/mastodon_api.ex index 5e32b9611..21ee5f0d4 100644 --- a/lib/pleroma/web/mastodon_api/mastodon_api.ex +++ b/lib/pleroma/web/mastodon_api/mastodon_api.ex @@ -61,7 +61,18 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPI do end def get_notifications(user, params \\ %{}) do - options = cast_params(params) + options = + cast_params(params) |> Map.update(:include_types, [], fn include_types -> include_types end) + + options = + if "pleroma:report" not in options.include_types or User.privileged?(user, :report_handle) do + options + else + options + |> Map.update(:exclude_types, ["pleroma:report"], fn current_exclude_types -> + current_exclude_types ++ ["pleroma:report"] + end) + end user |> Notification.for_user_query(options) |