diff options
| author | lambda <pleromagit@rogerbraun.net> | 2018-04-01 08:37:45 +0000 | 
|---|---|---|
| committer | lambda <pleromagit@rogerbraun.net> | 2018-04-01 08:37:45 +0000 | 
| commit | 978df55a866a8f8adaed81149287dec510e91826 (patch) | |
| tree | fe0d897f560206cc25232170ae65d9a11e5c98e2 /lib | |
| parent | 1dcc700cca378f813b8f232e26c0f6f494a8336e (diff) | |
| parent | 2dcc6037d038cdc187e850cc42b3863a5d449c91 (diff) | |
| download | pleroma-978df55a866a8f8adaed81149287dec510e91826.tar.gz pleroma-978df55a866a8f8adaed81149287dec510e91826.zip | |
Merge branch 'feature/mastodon-search-tags' into 'develop'
mastodon search api: implement a reasonable hashtags stub
See merge request pleroma/pleroma!89
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/pleroma/web/mastodon_api/mastodon_api_controller.ex | 6 | 
1 files changed, 5 insertions, 1 deletions
| diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex index 58bb5e03a..dc92e30c5 100644 --- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex +++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex @@ -513,12 +513,16 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController 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) | 
