mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-30 14:57:59 +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,7 +24,9 @@ defmodule Philomena.Versions do
|
|||
|
||||
{versions, _last_body} =
|
||||
versions
|
||||
|> Enum.map_reduce(parent.body, fn version, previous_body ->
|
||||
|> Enum.map_reduce(
|
||||
{parent.body, parent.edit_reason},
|
||||
fn version, {previous_body, previous_reason} ->
|
||||
yaml = YamlElixir.read_from_string!(version.object || "")
|
||||
body = yaml["body"] || ""
|
||||
edit_reason = yaml["edit_reason"]
|
||||
|
@ -34,12 +36,13 @@ defmodule Philomena.Versions do
|
|||
| parent: parent,
|
||||
user: users[version.whodunnit],
|
||||
body: body,
|
||||
edit_reason: edit_reason,
|
||||
edit_reason: previous_reason,
|
||||
difference: difference(body, previous_body)
|
||||
}
|
||||
|
||||
{v, body}
|
||||
end)
|
||||
{v, {body, edit_reason}}
|
||||
end
|
||||
)
|
||||
|
||||
versions
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue