Introduce basic user and profile management
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -16,6 +16,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Admin do
|
||||
alias Mobilizon.Service.Statistics
|
||||
alias Mobilizon.Storage.Page
|
||||
alias Mobilizon.Users.User
|
||||
require Logger
|
||||
|
||||
def list_action_logs(
|
||||
_parent,
|
||||
@@ -96,6 +97,20 @@ defmodule Mobilizon.GraphQL.Resolvers.Admin do
|
||||
}
|
||||
end
|
||||
|
||||
defp transform_action_log(Actor, :suspend, %ActionLog{changes: changes}) do
|
||||
%{
|
||||
action: :actor_suspension,
|
||||
object: convert_changes_to_struct(Actor, changes)
|
||||
}
|
||||
end
|
||||
|
||||
defp transform_action_log(Actor, :unsuspend, %ActionLog{changes: changes}) do
|
||||
%{
|
||||
action: :actor_unsuspension,
|
||||
object: convert_changes_to_struct(Actor, changes)
|
||||
}
|
||||
end
|
||||
|
||||
# Changes are stored as %{"key" => "value"} so we need to convert them back as struct
|
||||
defp convert_changes_to_struct(struct, %{"report_id" => _report_id} = changes) do
|
||||
with data <- for({key, val} <- changes, into: %{}, do: {String.to_atom(key), val}),
|
||||
|
||||
Reference in New Issue
Block a user