projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'mix-tasks-improvement' into 'develop'
[akkoma]
/
lib
/
pleroma
/
web
/
common_api
/
common_api.ex
diff --git
a/lib/pleroma/web/common_api/common_api.ex
b/lib/pleroma/web/common_api/common_api.ex
index 04e081a8e88def3de6bf6139ff3a08854d612699..4d5b0decf77c3a3b3aec03b9a1f046a81de35ed9 100644
(file)
--- a/
lib/pleroma/web/common_api/common_api.ex
+++ b/
lib/pleroma/web/common_api/common_api.ex
@@
-25,6
+25,13
@@
defmodule Pleroma.Web.CommonAPI do
require Pleroma.Constants
require Logger
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),
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),
@@
-94,10
+101,14
@@
defmodule Pleroma.Web.CommonAPI do
def follow(follower, followed) do
timeout = Pleroma.Config.get([:activitypub, :follow_handshake_timeout])
def follow(follower, followed) do
timeout = Pleroma.Config.get([:activitypub, :follow_handshake_timeout])
- with {:ok, follow
er} <- User.maybe_direct_
follow(follower, followed),
- {:ok, activity
} <- ActivityPub.follow(follower, followed
),
+ with {:ok, follow
_data, _} <- Builder.
follow(follower, followed),
+ {:ok, activity
, _} <- Pipeline.common_pipeline(follow_data, local: true
),
{:ok, follower, followed} <- User.wait_and_refresh(timeout, follower, followed) do
{:ok, follower, followed} <- User.wait_and_refresh(timeout, follower, followed) do
- {:ok, follower, followed, activity}
+ if activity.data["state"] == "reject" do
+ {:error, :rejected}
+ else
+ {:ok, follower, followed, activity}
+ end
end
end
end
end