Introduce comments below events

Also add tomstones

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2019-11-15 18:36:47 +01:00
parent 45155a3bde
commit dc07f34d78
71 changed files with 2642 additions and 879 deletions

View File

@@ -7,7 +7,7 @@ defmodule MobilizonWeb.Resolvers.Admin do
alias Mobilizon.Admin.ActionLog
alias Mobilizon.Events
alias Mobilizon.Events.Event
alias Mobilizon.Events.{Event, Comment}
alias Mobilizon.Reports.{Note, Report}
alias Mobilizon.Service.Statistics
alias Mobilizon.Users.User
@@ -90,6 +90,15 @@ defmodule MobilizonWeb.Resolvers.Admin do
}
end
defp transform_action_log(Comment, :delete, %ActionLog{
changes: changes
}) do
%{
action: :comment_deletion,
object: convert_changes_to_struct(Comment, 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}),