Redundant Repo.get_by usage was recently removed from the codebase
authorMark Felder <feld@FreeBSD.org>
Fri, 5 Apr 2019 16:41:41 +0000 (11:41 -0500)
committerMark Felder <feld@FreeBSD.org>
Fri, 5 Apr 2019 16:41:41 +0000 (11:41 -0500)
lib/pleroma/web/admin_api/admin_api_controller.ex

index 84d0aabafa1028ca256c205f631361fcd1eff300..78bf31893635ce60e4853b472ed1ef093e999036 100644 (file)
@@ -26,8 +26,8 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIController 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 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIController do
   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