From 255a681782682ce364721f3e616d2bfb727f5f4c Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Sun, 17 Sep 2017 11:45:16 +0200 Subject: [PATCH] TwitterAPI: Add tag timeline. --- lib/pleroma/web/router.ex | 1 + .../twitter_api/twitter_api_controller_test.exs | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index 04f4e213c..9eb27b879 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -120,6 +120,7 @@ defmodule Pleroma.Web.Router do end get "/search", TwitterAPI.Controller, :search + get "/statusnet/tags/:tag", TwitterAPI.Controller, :public_and_external_timeline get "/externalprofile/show", TwitterAPI.Controller, :external_profile end diff --git a/test/web/twitter_api/twitter_api_controller_test.exs b/test/web/twitter_api/twitter_api_controller_test.exs index 14c1d4df7..14b9cf47a 100644 --- a/test/web/twitter_api/twitter_api_controller_test.exs +++ b/test/web/twitter_api/twitter_api_controller_test.exs @@ -490,4 +490,20 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do assert status["id"] == activity.id end end + + describe "GET /api/statusnet/tags/timeline/:tag.json" do + test "it returns the tags timeline" do + user = insert(:user) + user_two = insert(:user, %{nickname: "shp@shitposter.club"}) + + {:ok, activity} = CommonAPI.post(user, %{"status" => "This is about #2hu"}) + {:ok, _} = CommonAPI.post(user_two, %{"status" => "This isn't"}) + + conn = conn + |> get("/api/statusnet/tags/2hu.json") + + assert [status] = json_response(conn, 200) + assert status["id"] == activity.id + end + end end