mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-02-20 04:14:23 +01:00
fix edit reason offset in version history
This commit is contained in:
parent
351cb282bf
commit
2768b5753b
1 changed files with 17 additions and 14 deletions
|
@ -24,22 +24,25 @@ defmodule Philomena.Versions do
|
||||||
|
|
||||||
{versions, _last_body} =
|
{versions, _last_body} =
|
||||||
versions
|
versions
|
||||||
|> Enum.map_reduce(parent.body, fn version, previous_body ->
|
|> Enum.map_reduce(
|
||||||
yaml = YamlElixir.read_from_string!(version.object || "")
|
{parent.body, parent.edit_reason},
|
||||||
body = yaml["body"] || ""
|
fn version, {previous_body, previous_reason} ->
|
||||||
edit_reason = yaml["edit_reason"]
|
yaml = YamlElixir.read_from_string!(version.object || "")
|
||||||
|
body = yaml["body"] || ""
|
||||||
|
edit_reason = yaml["edit_reason"]
|
||||||
|
|
||||||
v = %{
|
v = %{
|
||||||
version
|
version
|
||||||
| parent: parent,
|
| parent: parent,
|
||||||
user: users[version.whodunnit],
|
user: users[version.whodunnit],
|
||||||
body: body,
|
body: body,
|
||||||
edit_reason: edit_reason,
|
edit_reason: previous_reason,
|
||||||
difference: difference(body, previous_body)
|
difference: difference(body, previous_body)
|
||||||
}
|
}
|
||||||
|
|
||||||
{v, body}
|
{v, {body, edit_reason}}
|
||||||
end)
|
end
|
||||||
|
)
|
||||||
|
|
||||||
versions
|
versions
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue