Web.MastodonAPI.MastodonAPIController: tag+any bookmark params in a array and flatten it

This commit is contained in:
Haelwenn (lanodan) Monnier 2019-01-26 16:46:20 +01:00
parent 22f2687f17
commit de956b9e04
No known key found for this signature in database
GPG key ID: D5B7A8E43C997DEE

View file

@ -541,7 +541,8 @@ def hashtag_timeline(%{assigns: %{user: user}} = conn, params) do
local_only = params["local"] in [true, "True", "true", "1"] local_only = params["local"] in [true, "True", "true", "1"]
tags = tags =
([params["tag"]] ++ (params["any"] || [])) [params["tag"], params["any"]]
|> List.flatten()
|> Enum.uniq() |> Enum.uniq()
|> Enum.filter(& &1) |> Enum.filter(& &1)
|> Enum.map(&String.downcase(&1)) |> Enum.map(&String.downcase(&1))