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.
This commit is contained in:
parent
e45faddb38
commit
eab13fed3e
2 changed files with 52 additions and 5 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue