From: dtluna Date: Thu, 13 Apr 2017 14:15:02 +0000 (+0300) Subject: Merge branch 'develop' of ssh.gitgud.io:lambadalambda/pleroma into feature/user-timeline X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=443381d0a05849d7dcdc0abb11844cb4d4a75a55;p=akkoma Merge branch 'develop' of ssh.gitgud.io:lambadalambda/pleroma into feature/user-timeline --- 443381d0a05849d7dcdc0abb11844cb4d4a75a55 diff --cc lib/pleroma/web/router.ex index 8e6a2b012,40350ad0c..1ced7f3ea --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@@ -30,10 -31,11 +31,12 @@@ defmodule Pleroma.Web.Router d scope "/api", Pleroma.Web do pipe_through :authenticated_api + get "/account/verify_credentials", TwitterAPI.Controller, :verify_credentials post "/account/verify_credentials", TwitterAPI.Controller, :verify_credentials post "/statuses/update", TwitterAPI.Controller, :status_update + get "/statuses/home_timeline", TwitterAPI.Controller, :friends_timeline get "/statuses/friends_timeline", TwitterAPI.Controller, :friends_timeline + get "/statuses/user_timeline", TwitterAPI.Controller, :user_timeline post "/friendships/create", TwitterAPI.Controller, :follow post "/friendships/destroy", TwitterAPI.Controller, :unfollow post "/statusnet/media/upload", TwitterAPI.Controller, :upload diff --cc lib/pleroma/web/twitter_api/twitter_api_controller.ex index 741689ebf,3f299a941..11e7b3bdf --- a/lib/pleroma/web/twitter_api/twitter_api_controller.ex +++ b/lib/pleroma/web/twitter_api/twitter_api_controller.ex @@@ -43,28 -43,8 +43,28 @@@ defmodule Pleroma.Web.TwitterAPI.Contro |> json_reply(200, json) end + def user_timeline(conn, %{ "user_id" => user_id } = params) do + user = Repo.get(User, user_id) + conn = Map.merge(conn, %{assigns: %{user: user}}) + params = Map.delete(params, "user_id") + + friends_timeline(conn, params) + end + + def user_timeline(conn, %{ "screen_name" => nickname} = params) do + user = Repo.get_by!(User, nickname: nickname) + conn = Map.merge(conn, %{assigns: %{user: user}}) + params = Map.delete(params, "screen_name") + + friends_timeline(conn, params) + end + + def user_timeline(conn, params) do + friends_timeline(conn, params) + end + def follow(%{assigns: %{user: user}} = conn, %{ "user_id" => followed_id }) do - { :ok, _user, follower, _activity } = TwitterAPI.follow(user, followed_id) + { :ok, user, follower, _activity } = TwitterAPI.follow(user, followed_id) response = follower |> UserRepresenter.to_json(%{for: user})