2020-02-18 08:57:00 +01:00
|
|
|
defmodule Mix.Tasks.Mobilizon.Groups.Refresh do
|
|
|
|
@moduledoc """
|
|
|
|
Task to refresh an actor details
|
|
|
|
"""
|
|
|
|
use Mix.Task
|
|
|
|
alias Mobilizon.Actors
|
|
|
|
alias Mobilizon.Actors.Actor
|
|
|
|
alias Mobilizon.Federation.ActivityPub.Refresher
|
2020-10-30 15:16:01 +01:00
|
|
|
import Mix.Tasks.Mobilizon.Common
|
2020-02-18 08:57:00 +01:00
|
|
|
|
|
|
|
@shortdoc "Refresh a group private informations from an account member"
|
|
|
|
|
|
|
|
@impl Mix.Task
|
|
|
|
def run([group_url, on_behalf_of]) do
|
2020-10-30 15:16:01 +01:00
|
|
|
start_mobilizon()
|
2020-02-18 08:57:00 +01:00
|
|
|
|
|
|
|
with %Actor{} = actor <- Actors.get_local_actor_by_name(on_behalf_of) do
|
|
|
|
res = Refresher.fetch_group(group_url, actor)
|
|
|
|
IO.puts(inspect(res))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def run(_) do
|
2020-10-30 15:16:01 +01:00
|
|
|
shell_error(
|
2020-02-18 08:57:00 +01:00
|
|
|
"mobilizon.groups.refresh requires a group URL and an actor username which is member of the group as arguments"
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|