Fix user representation after following.
This commit is contained in:
parent
b5e94bf930
commit
15655d992e
|
@ -44,7 +44,7 @@ def friends_timeline(%{assigns: %{user: user}} = conn, params) do
|
||||||
end
|
end
|
||||||
|
|
||||||
def follow(%{assigns: %{user: user}} = conn, %{ "user_id" => followed_id }) do
|
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})
|
response = follower |> UserRepresenter.to_json(%{for: user})
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,7 @@ test "with credentials", %{conn: conn, user: current_user} do
|
||||||
|
|
||||||
current_user = Repo.get(User, current_user.id)
|
current_user = Repo.get(User, current_user.id)
|
||||||
assert current_user.following == [User.ap_followers(followed)]
|
assert current_user.following == [User.ap_followers(followed)]
|
||||||
assert json_response(conn, 200) == UserRepresenter.to_map(followed)
|
assert json_response(conn, 200) == UserRepresenter.to_map(followed, %{for: current_user})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ test "with credentials", %{conn: conn, user: current_user} do
|
||||||
|
|
||||||
current_user = Repo.get(User, current_user.id)
|
current_user = Repo.get(User, current_user.id)
|
||||||
assert current_user.following == []
|
assert current_user.following == []
|
||||||
assert json_response(conn, 200) == UserRepresenter.to_map(followed)
|
assert json_response(conn, 200) == UserRepresenter.to_map(followed, %{for: current_user})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue