mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-12-18 15:08:00 +01:00
Fix system report generation
This commit is contained in:
parent
0a0bcd15bf
commit
1cf4df73ce
1 changed files with 4 additions and 3 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue