diff options
author | Haelwenn <contact+git.pleroma.social@hacktivis.me> | 2020-01-20 11:26:07 +0000 |
---|---|---|
committer | Haelwenn <contact+git.pleroma.social@hacktivis.me> | 2020-01-20 11:26:07 +0000 |
commit | e8759cb5baba85709607b167d27bd54cf4822366 (patch) | |
tree | b53355e0c3d979df13cd9f648cb0f9e6a4787775 /lib | |
parent | 9367b70f37ba11f22c456dc6b8dd9366ced84386 (diff) | |
parent | 271afcd940b743b84fae2ee40245d1e0c53cc714 (diff) | |
download | pleroma-e8759cb5baba85709607b167d27bd54cf4822366.tar.gz |
Merge branch 'hashtag-benchmarks' into 'develop'
Hashtag benchmarks
See merge request pleroma/pleroma!2116
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex b/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex index 384159336..29964a1d4 100644 --- a/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex @@ -77,10 +77,7 @@ defmodule Pleroma.Web.MastodonAPI.TimelineController do |> render("index.json", activities: activities, for: user, as: :activity) end - # GET /api/v1/timelines/tag/:tag - def hashtag(%{assigns: %{user: user}} = conn, params) do - local_only = truthy_param?(params["local"]) - + def hashtag_fetching(params, user, local_only) do tags = [params["tag"], params["any"]] |> List.flatten() @@ -98,7 +95,7 @@ defmodule Pleroma.Web.MastodonAPI.TimelineController do |> Map.get("none", []) |> Enum.map(&String.downcase(&1)) - activities = + _activities = params |> Map.put("type", "Create") |> Map.put("local_only", local_only) @@ -109,6 +106,13 @@ defmodule Pleroma.Web.MastodonAPI.TimelineController do |> Map.put("tag_all", tag_all) |> Map.put("tag_reject", tag_reject) |> ActivityPub.fetch_public_activities() + end + + # GET /api/v1/timelines/tag/:tag + def hashtag(%{assigns: %{user: user}} = conn, params) do + local_only = truthy_param?(params["local"]) + + activities = hashtag_fetching(params, user, local_only) conn |> add_link_headers(activities, %{"local" => local_only}) |