After code review
Use patern matching to see if someone was superuser before
This commit is contained in:
parent
89667189b8
commit
cdc5bbe836
1 changed files with 2 additions and 5 deletions
|
@ -1136,11 +1136,8 @@ defmodule Pleroma.User do
|
||||||
|> maybe_remove_report_notifications(was_superuser_before_update)
|
|> maybe_remove_report_notifications(was_superuser_before_update)
|
||||||
end
|
end
|
||||||
|
|
||||||
defp maybe_remove_report_notifications(
|
defp maybe_remove_report_notifications({:ok, %Pleroma.User{} = user} = result, true) do
|
||||||
{:ok, %Pleroma.User{} = user} = result,
|
if not User.superuser?(user),
|
||||||
was_superuser_before_update
|
|
||||||
) do
|
|
||||||
if was_superuser_before_update and not User.superuser?(user),
|
|
||||||
do: user |> Notification.destroy_multiple_from_types(["pleroma:report"])
|
do: user |> Notification.destroy_multiple_from_types(["pleroma:report"])
|
||||||
|
|
||||||
result
|
result
|
||||||
|
|
Loading…
Reference in a new issue