Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F85949098
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
991 B
Referenced Files
None
Subscribers
None
View Options
diff --git a/lib/mix/tasks/make_moderator.ex b/lib/mix/tasks/make_moderator.ex
index 20f04c54c..4d427cfd8 100644
--- a/lib/mix/tasks/make_moderator.ex
+++ b/lib/mix/tasks/make_moderator.ex
@@ -1,30 +1,30 @@
defmodule Mix.Tasks.SetModerator do
use Mix.Task
import Mix.Ecto
alias Pleroma.{Repo, User}
@shortdoc "Set moderator status"
def run([nickname | rest]) do
ensure_started(Repo, [])
moderator =
case rest do
[moderator] -> moderator == "true"
_ -> true
end
with %User{local: true} = user <- User.get_by_nickname(nickname) do
info =
user.info
|> Map.put("is_moderator", !!moderator)
cng = User.info_changeset(user, %{info: info})
- user = Repo.update!(cng)
+ {:ok, user} = User.update_and_set_cache(cng)
IO.puts("Moderator status of #{nickname}: #{user.info["is_moderator"]}")
else
_ ->
IO.puts("No local user #{nickname}")
end
end
end
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Tue, Nov 17, 6:57 PM (13 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1818255
Default Alt Text
(991 B)
Attached To
Mode
rPUBE pleroma-upstream
Attached
Detach File
Event Timeline