Commit 978df55a authored by lain's avatar lain
Browse files

Merge branch 'feature/mastodon-search-tags' into 'develop'

mastodon search api: implement a reasonable hashtags stub

See merge request !89
parents 1dcc700c 2dcc6037
Pipeline #1050 canceled with stage
......@@ -513,12 +513,16 @@ def search(%{assigns: %{user: user}} = conn, %{"q" => query} = params) do
)
statuses = Repo.all(q) ++ fetched
tags = String.split(query)
|> Enum.uniq()
|> Enum.filter(fn tag -> String.starts_with?(tag, "#") end)
|> Enum.map(fn tag -> String.slice(tag, 1..-1) end)
res = %{
"accounts" => AccountView.render("accounts.json", users: accounts, for: user, as: :user),
"statuses" =>
StatusView.render("index.json", activities: statuses, for: user, as: :activity),
"hashtags" => []
"hashtags" => tags
}
json(conn, res)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment