diff options
author | Tusooa Zhu <tusooa@kazv.moe> | 2022-06-11 16:28:59 -0400 |
---|---|---|
committer | Tusooa Zhu <tusooa@kazv.moe> | 2022-06-11 17:02:29 -0400 |
commit | 95b39223281a61f3ee7d52776df2713952de3be0 (patch) | |
tree | 833b5b11565f274768279f6d1303571619cdead8 | |
parent | 7451f0e81f1fd378a3ff23d437e3cc6780d62fb4 (diff) | |
download | pleroma-95b39223281a61f3ee7d52776df2713952de3be0.tar.gz |
Workaround with_index does not support function in Elixir 1.9
-rw-r--r-- | lib/pleroma/web/mastodon_api/views/status_view.ex | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex index 9cb2adcf9..6ede89803 100644 --- a/lib/pleroma/web/mastodon_api/views/status_view.ex +++ b/lib/pleroma/web/mastodon_api/views/status_view.ex @@ -423,18 +423,16 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do history_len = length(history) history = - Enum.with_index( - history, - fn object, index -> - %{ - # The history is prepended every time there is a new edit. - # In chrono_order, the oldest item is always at 0, and so on. - # The chrono_order is an invariant kept between edits. - chrono_order: history_len - 1 - index, - object: object - } - end - ) + Enum.zip(history_len..0, history) + |> Enum.map(fn {chrono_order, object} -> + %{ + # The history is prepended every time there is a new edit. + # In chrono_order, the oldest item is always at 0, and so on. + # The chrono_order is an invariant kept between edits. + chrono_order: chrono_order, + object: object + } + end) individual_opts = opts |