Merge branch 'develop' of ssh.gitgud.io:lambadalambda/pleroma into feature/user-timeline
authordtluna <dtluna@openmailbox.org>
Thu, 13 Apr 2017 14:15:02 +0000 (17:15 +0300)
committerdtluna <dtluna@openmailbox.org>
Thu, 13 Apr 2017 14:15:02 +0000 (17:15 +0300)
1  2 
lib/pleroma/web/router.ex
lib/pleroma/web/twitter_api/twitter_api_controller.ex

index 8e6a2b012ff02c73a6da8721879bc37f69d9bbf5,40350ad0c9461755942eb35fa03c25c828c3e89f..1ced7f3ea35da1a32c0bc6ac4faf6a59086a54f9
@@@ -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
index 741689ebfeff484d1f1bda79d3f9c1b5cdbd96ef,3f299a941690e2a93d0e5013ecec9c53e9f90e8f..11e7b3bdf13d0af0ae1d12397d432978df666919
@@@ -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})