mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-12-30 04:14:57 +00:00
After code review
Use patern matching to see if someone was superuser before
This commit is contained in:
parent
1048bc1bb9
commit
a20d2847e2
|
@ -1099,11 +1099,8 @@ defmodule Pleroma.User do
|
|||
|> maybe_remove_report_notifications(was_superuser_before_update)
|
||||
end
|
||||
|
||||
defp maybe_remove_report_notifications(
|
||||
{:ok, %Pleroma.User{} = user} = result,
|
||||
was_superuser_before_update
|
||||
) do
|
||||
if was_superuser_before_update and not User.superuser?(user),
|
||||
defp maybe_remove_report_notifications({:ok, %Pleroma.User{} = user} = result, true) do
|
||||
if not User.superuser?(user),
|
||||
do: user |> Notification.destroy_multiple_from_types(["pleroma:report"])
|
||||
|
||||
result
|
||||
|
|
Loading…
Reference in a new issue