Fix system report generation

This commit is contained in:
Liam 2024-12-05 12:53:24 -05:00
parent 0a0bcd15bf
commit 1cf4df73ce

View file

@ -133,17 +133,18 @@ defmodule Philomena.Reports do
def create_system_report({reportable_type, reportable_id} = _type_and_id, category, reason) do def create_system_report({reportable_type, reportable_id} = _type_and_id, category, reason) do
attrs = %{ attrs = %{
reason: reason, reason: reason,
category: category category: category,
user_agent: "system"
} }
attributes = %{ attribution = %{
system: true, system: true,
ip: %Postgrex.INET{address: {127, 0, 0, 1}, netmask: 32}, ip: %Postgrex.INET{address: {127, 0, 0, 1}, netmask: 32},
fingerprint: "ffff" fingerprint: "ffff"
} }
%Report{reportable_type: reportable_type, reportable_id: reportable_id} %Report{reportable_type: reportable_type, reportable_id: reportable_id}
|> Report.creation_changeset(attrs, attributes) |> Report.creation_changeset(attrs, attribution)
|> Repo.insert() |> Repo.insert()
|> reindex_after_update() |> reindex_after_update()
end end