Redundant Repo.get_by usage was recently removed from the codebase

This commit is contained in:
Mark Felder 2019-04-05 11:41:41 -05:00
parent da64a5aece
commit b5a2d384f7
1 changed files with 4 additions and 4 deletions

View File

@ -26,8 +26,8 @@ def user_delete(conn, %{"nickname" => nickname}) do
end
def user_follow(conn, %{"follower" => follower_nick, "followed" => followed_nick}) do
with %User{} = follower <- Repo.get_by(User, %{nickname: follower_nick}),
%User{} = followed <- Repo.get_by(User, %{nickname: followed_nick}) do
with %User{} = follower <- User.get_by_nickname(follower_nick),
%User{} = followed <- User.get_by_nickname(followed_nick) do
User.follow(follower, followed)
end
@ -36,8 +36,8 @@ def user_follow(conn, %{"follower" => follower_nick, "followed" => followed_nick
end
def user_unfollow(conn, %{"follower" => follower_nick, "followed" => followed_nick}) do
with %User{} = follower <- Repo.get_by(User, %{nickname: follower_nick}),
%User{} = followed <- Repo.get_by(User, %{nickname: followed_nick}) do
with %User{} = follower <- User.get_by_nickname(follower_nick),
%User{} = followed <- User.get_by_nickname(followed_nick) do
User.unfollow(follower, followed)
end