summaryrefslogtreecommitdiff
path: root/lib/pleroma/user.ex
diff options
context:
space:
mode:
authorIlja <ilja@ilja.space>2022-06-18 08:38:00 +0200
committerIlja <ilja@ilja.space>2022-06-21 12:10:27 +0200
commite45faddb38311c799b2276cb952ac7715e2cbfab (patch)
tree02c4a7f74a17a6b4eb3afe85e347f4e37ade3762 /lib/pleroma/user.ex
parentedf0013ff38ae2d7bc84431d1d1384e5fc45bc0e (diff)
Revert "Delete report notifs when demoting from superuser"
This reverts commit 89667189b840fc79d85336739e6b2512684d7be0 and cdc5bbe8369d4fc66d642bb3e845a237d11e34d7. This is a side effect when changing user role. The goal was to not have report notifications when someone isn't admin or moderator any more. But this won't be triggered when we change the privilege tags for a role, so we can't use this sollution any more. There was another solution to filter out report notifications during fetch. It wasn't merged because this seemed 'cleaner' at the time, but now it seems the better sollution. I'll add it in the next commit.
Diffstat (limited to 'lib/pleroma/user.ex')
-rw-r--r--lib/pleroma/user.ex16
1 files changed, 1 insertions, 15 deletions
diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex
index 7dfc6ce7b..b68d5cf9a 100644
--- a/lib/pleroma/user.ex
+++ b/lib/pleroma/user.ex
@@ -1147,24 +1147,10 @@ defmodule Pleroma.User do
|> update_and_set_cache()
end
- def update_and_set_cache(%{data: %Pleroma.User{} = user} = changeset) do
- was_superuser_before_update = User.superuser?(user)
-
+ def update_and_set_cache(changeset) do
with {:ok, user} <- Repo.update(changeset, stale_error_field: :id) do
set_cache(user)
end
- |> maybe_remove_report_notifications(was_superuser_before_update)
- end
-
- 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
- end
-
- defp maybe_remove_report_notifications(result, _) do
- result
end
def get_user_friends_ap_ids(user) do