Do not need a function to provide fallback value with default defined in config.exs
[akkoma] / lib / pleroma / following_relationship.ex
index 0343a20d44b5cf1b6a939cf5eff76c79e4418674..093b1f4050d62a94f70c865bc27262f2cb70b6ca 100644 (file)
@@ -62,13 +62,10 @@ defmodule Pleroma.FollowingRelationship do
         follow(follower, following, state)
 
       following_relationship ->
-        {:ok, relationship} =
-          following_relationship
-          |> cast(%{state: state}, [:state])
-          |> validate_required([:state])
-          |> Repo.update()
-
-        {:ok, relationship}
+        following_relationship
+        |> cast(%{state: state}, [:state])
+        |> validate_required([:state])
+        |> Repo.update()
     end
   end
 
@@ -144,6 +141,12 @@ defmodule Pleroma.FollowingRelationship do
     |> where([r], r.state == ^:follow_accept)
   end
 
+  def outgoing_pending_follow_requests_query(%User{} = follower) do
+    __MODULE__
+    |> where([r], r.follower_id == ^follower.id)
+    |> where([r], r.state == ^:follow_pending)
+  end
+
   def following(%User{} = user) do
     following =
       following_query(user)