Replace map |> join with map_join
This commit is contained in:
parent
90ed27939b
commit
aba4e6ea60
|
@ -224,8 +224,7 @@ defmodule Pleroma.LoadTesting.Activities do
|
|||
|> Enum.reduce([users[:user]], fn group, acc ->
|
||||
acc ++ Enum.take(users[group], 5)
|
||||
end)
|
||||
|> Enum.map(&"@#{&1.nickname}")
|
||||
|> Enum.join(", ")
|
||||
|> Enum.map_join(", ", &"@#{&1.nickname}")
|
||||
|
||||
Cachex.put(:user_cache, "hell_thread_mentions", cached)
|
||||
cached
|
||||
|
|
|
@ -303,7 +303,7 @@ defmodule Mix.Tasks.Pleroma.Instance do
|
|||
else
|
||||
shell_error(
|
||||
"The task would have overwritten the following files:\n" <>
|
||||
(Enum.map(will_overwrite, &"- #{&1}\n") |> Enum.join("")) <>
|
||||
Enum.map_join(will_overwrite, "", &"- #{&1}\n") <>
|
||||
"Rerun with `--force` to overwrite them."
|
||||
)
|
||||
end
|
||||
|
|
|
@ -43,7 +43,7 @@ defmodule Pleroma.Emails.AdminEmail do
|
|||
if is_list(statuses) && length(statuses) > 0 do
|
||||
statuses_list_html =
|
||||
statuses
|
||||
|> Enum.map(fn
|
||||
|> Enum.map_join("\n", fn
|
||||
%{id: id} ->
|
||||
status_url = Helpers.o_status_url(Pleroma.Web.Endpoint, :notice, id)
|
||||
"<li><a href=\"#{status_url}\">#{status_url}</li>"
|
||||
|
@ -54,7 +54,6 @@ defmodule Pleroma.Emails.AdminEmail do
|
|||
id when is_binary(id) ->
|
||||
"<li><a href=\"#{id}\">#{id}</li>"
|
||||
end)
|
||||
|> Enum.join("\n")
|
||||
|
||||
"""
|
||||
<p> Statuses:
|
||||
|
|
|
@ -134,10 +134,9 @@ defmodule Pleroma.Emoji do
|
|||
|> hd()
|
||||
|> String.trim()
|
||||
|> String.split()
|
||||
|> Enum.map(fn codepoint ->
|
||||
|> Enum.map_join(fn codepoint ->
|
||||
<<String.to_integer(codepoint, 16)::utf8>>
|
||||
end)
|
||||
|> Enum.join()
|
||||
end)
|
||||
|> Enum.uniq()
|
||||
|
||||
|
|
|
@ -207,8 +207,7 @@ defmodule Pleroma.Filter do
|
|||
def compose_regex([_ | _] = filters, format) do
|
||||
phrases =
|
||||
filters
|
||||
|> Enum.map(& &1.phrase)
|
||||
|> Enum.join("|")
|
||||
|> Enum.map_join("|", & &1.phrase)
|
||||
|
||||
case format do
|
||||
:postgres ->
|
||||
|
|
|
@ -556,14 +556,12 @@ defmodule Pleroma.ModerationLog do
|
|||
|
||||
defp nicknames_to_string(nicknames) do
|
||||
nicknames
|
||||
|> Enum.map(&"@#{&1}")
|
||||
|> Enum.join(", ")
|
||||
|> Enum.map_join(", ", &"@#{&1}")
|
||||
end
|
||||
|
||||
defp users_to_nicknames_string(users) do
|
||||
users
|
||||
|> Enum.map(&"@#{&1["nickname"]}")
|
||||
|> Enum.join(", ")
|
||||
|> Enum.map_join(", ", &"@#{&1["nickname"]}")
|
||||
end
|
||||
|
||||
defp subject_actor_nickname(%ModerationLog{data: data}, prefix_msg, postfix_msg \\ "") do
|
||||
|
|
|
@ -134,8 +134,7 @@ defmodule Pleroma.User.Search do
|
|||
|> String.replace(~r/[!-\/|@|[-`|{-~|:-?]+/, " ")
|
||||
|> String.trim()
|
||||
|> String.split()
|
||||
|> Enum.map(&(&1 <> ":*"))
|
||||
|> Enum.join(" | ")
|
||||
|> Enum.map_join(" | ", &(&1 <> ":*"))
|
||||
end
|
||||
|
||||
# Considers nickname match, localized nickname match, name match; preferences nickname match
|
||||
|
|
|
@ -30,7 +30,7 @@ defmodule Pleroma.Web.ApiSpec.RenderError do
|
|||
conn
|
||||
|> put_status(:bad_request)
|
||||
|> json(%{
|
||||
error: errors |> Enum.map(&message/1) |> Enum.join(" "),
|
||||
error: errors |> Enum.map_join(" ", &message/1),
|
||||
errors: errors |> Enum.map(&render_error/1)
|
||||
})
|
||||
end
|
||||
|
|
|
@ -167,8 +167,7 @@ defmodule Pleroma.Web.MastodonAPI.SearchController do
|
|||
|
||||
defp joined_tag(tags) do
|
||||
tags
|
||||
|> Enum.map(fn tag -> String.capitalize(tag) end)
|
||||
|> Enum.join()
|
||||
|> Enum.map_join(fn tag -> String.capitalize(tag) end)
|
||||
end
|
||||
|
||||
defp with_fallback(f, fallback \\ []) do
|
||||
|
|
|
@ -15,8 +15,7 @@ defmodule Pleroma.Web.Metadata do
|
|||
params
|
||||
|> parser.build_tags()
|
||||
|> Enum.map(&to_tag/1)
|
||||
|> Enum.map(&HTML.safe_to_string/1)
|
||||
|> Enum.join()
|
||||
|> Enum.map_join(&HTML.safe_to_string/1)
|
||||
|
||||
acc <> rendered_html
|
||||
end)
|
||||
|
@ -35,8 +34,7 @@ defmodule Pleroma.Web.Metadata do
|
|||
params
|
||||
|> parser.build_tags()
|
||||
|> Enum.map(&to_tag/1)
|
||||
|> Enum.map(&HTML.safe_to_string/1)
|
||||
|> Enum.join()
|
||||
|> Enum.map_join(&HTML.safe_to_string/1)
|
||||
|
||||
acc <> rendered_html
|
||||
end)
|
||||
|
|
|
@ -244,8 +244,7 @@ defmodule Pleroma.Web.Plugs.RateLimiter do
|
|||
plug_opts
|
||||
|> Keyword.get(:params, [])
|
||||
|> Enum.sort()
|
||||
|> Enum.map(&Map.get(conn_params, &1, ""))
|
||||
|> Enum.join(":")
|
||||
|> Enum.map_join(":", &Map.get(conn_params, &1, ""))
|
||||
|
||||
[input, params_string]
|
||||
|> Enum.join(":")
|
||||
|
|
|
@ -94,8 +94,7 @@ defmodule Pleroma.ModerationLogTest do
|
|||
|
||||
users =
|
||||
[subject1.nickname, subject2.nickname]
|
||||
|> Enum.map(&"@#{&1}")
|
||||
|> Enum.join(", ")
|
||||
|> Enum.map_join(", ", &"@#{&1}")
|
||||
|
||||
tags = ["foo", "bar"] |> Enum.join(", ")
|
||||
|
||||
|
@ -115,8 +114,7 @@ defmodule Pleroma.ModerationLogTest do
|
|||
|
||||
users =
|
||||
[subject1.nickname, subject2.nickname]
|
||||
|> Enum.map(&"@#{&1}")
|
||||
|> Enum.join(", ")
|
||||
|> Enum.map_join(", ", &"@#{&1}")
|
||||
|
||||
tags = ["foo", "bar"] |> Enum.join(", ")
|
||||
|
||||
|
|
|
@ -122,8 +122,7 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
|
|||
|
||||
users =
|
||||
[user1.nickname, user2.nickname]
|
||||
|> Enum.map(&"@#{&1}")
|
||||
|> Enum.join(", ")
|
||||
|> Enum.map_join(", ", &"@#{&1}")
|
||||
|
||||
tags = ["foo", "bar"] |> Enum.join(", ")
|
||||
|
||||
|
@ -168,8 +167,7 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
|
|||
|
||||
users =
|
||||
[user1.nickname, user2.nickname]
|
||||
|> Enum.map(&"@#{&1}")
|
||||
|> Enum.join(", ")
|
||||
|> Enum.map_join(", ", &"@#{&1}")
|
||||
|
||||
tags = ["x", "z"] |> Enum.join(", ")
|
||||
|
||||
|
|
|
@ -247,8 +247,7 @@ defmodule Pleroma.Web.MastodonAPI.ConversationControllerTest do
|
|||
defp create_direct_message(sender, recips) do
|
||||
hellos =
|
||||
recips
|
||||
|> Enum.map(fn s -> "@#{s.nickname}" end)
|
||||
|> Enum.join(", ")
|
||||
|> Enum.map_join(", ", fn s -> "@#{s.nickname}" end)
|
||||
|
||||
CommonAPI.post(sender, %{
|
||||
status: "Hi #{hellos}!",
|
||||
|
|
|
@ -630,8 +630,8 @@ defmodule Pleroma.Web.MastodonAPI.UpdateCredentialsTest do
|
|||
name_limit = Pleroma.Config.get([:instance, :account_field_name_length])
|
||||
value_limit = Pleroma.Config.get([:instance, :account_field_value_length])
|
||||
|
||||
long_name = Enum.map(0..name_limit, fn _ -> "x" end) |> Enum.join()
|
||||
long_value = Enum.map(0..value_limit, fn _ -> "x" end) |> Enum.join()
|
||||
long_name = Enum.map_join(0..name_limit, fn _ -> "x" end)
|
||||
long_value = Enum.map_join(0..value_limit, fn _ -> "x" end)
|
||||
|
||||
fields = [%{name: "foo", value: long_value}]
|
||||
|
||||
|
|
Loading…
Reference in New Issue