Workaround with_index does not support function in Elixir 1.9
This commit is contained in:
parent
7451f0e81f
commit
95b3922328
1 changed files with 10 additions and 12 deletions
|
@ -423,18 +423,16 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
|
||||||
history_len = length(history)
|
history_len = length(history)
|
||||||
|
|
||||||
history =
|
history =
|
||||||
Enum.with_index(
|
Enum.zip(history_len..0, history)
|
||||||
history,
|
|> Enum.map(fn {chrono_order, object} ->
|
||||||
fn object, index ->
|
|
||||||
%{
|
%{
|
||||||
# The history is prepended every time there is a new edit.
|
# The history is prepended every time there is a new edit.
|
||||||
# In chrono_order, the oldest item is always at 0, and so on.
|
# In chrono_order, the oldest item is always at 0, and so on.
|
||||||
# The chrono_order is an invariant kept between edits.
|
# The chrono_order is an invariant kept between edits.
|
||||||
chrono_order: history_len - 1 - index,
|
chrono_order: chrono_order,
|
||||||
object: object
|
object: object
|
||||||
}
|
}
|
||||||
end
|
end)
|
||||||
)
|
|
||||||
|
|
||||||
individual_opts =
|
individual_opts =
|
||||||
opts
|
opts
|
||||||
|
|
Loading…
Reference in a new issue