Merge branch 'develop' into activation-meta
[akkoma] / lib / pleroma / web / common_api / common_api.ex
index 04e081a8e88def3de6bf6139ff3a08854d612699..fd714907953901aaf3f2dd814e0347909c9d4f76 100644 (file)
@@ -25,6 +25,13 @@ defmodule Pleroma.Web.CommonAPI do
   require Pleroma.Constants
   require Logger
 
+  def block(blocker, blocked) do
+    with {:ok, block_data, _} <- Builder.block(blocker, blocked),
+         {:ok, block, _} <- Pipeline.common_pipeline(block_data, local: true) do
+      {:ok, block}
+    end
+  end
+
   def post_chat_message(%User{} = user, %User{} = recipient, content, opts \\ []) do
     with maybe_attachment <- opts[:media_id] && Object.get_by_id(opts[:media_id]),
          :ok <- validate_chat_content_length(content, !!maybe_attachment),