Merge branch 'feature/incoming-remote-unfollow' into 'develop'
Add support for incoming remote unfollows and blocks/unblocks See merge request pleroma/pleroma!158
This commit is contained in:
commit
c2dcd767cf
18 changed files with 475 additions and 62 deletions
|
|
@ -99,7 +99,7 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenter do
|
|||
) do
|
||||
created_at = created_at |> Utils.date_to_asctime()
|
||||
|
||||
text = "#{user.nickname} undid the action at #{undid_activity}"
|
||||
text = "#{user.nickname} undid the action at #{undid_activity["id"]}"
|
||||
|
||||
%{
|
||||
"id" => activity.id,
|
||||
|
|
|
|||
|
|
@ -36,14 +36,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do
|
|||
def unfollow(%User{} = follower, params) do
|
||||
with {:ok, %User{} = unfollowed} <- get_user(params),
|
||||
{:ok, follower, follow_activity} <- User.unfollow(follower, unfollowed),
|
||||
{:ok, _activity} <-
|
||||
ActivityPub.insert(%{
|
||||
"type" => "Undo",
|
||||
"actor" => follower.ap_id,
|
||||
# get latest Follow for these users
|
||||
"object" => follow_activity.data["id"],
|
||||
"published" => make_date()
|
||||
}) do
|
||||
{:ok, _activity} <- ActivityPub.unfollow(follower, unfollowed) do
|
||||
{:ok, follower, unfollowed}
|
||||
else
|
||||
err -> err
|
||||
|
|
@ -52,7 +45,8 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do
|
|||
|
||||
def block(%User{} = blocker, params) do
|
||||
with {:ok, %User{} = blocked} <- get_user(params),
|
||||
{:ok, blocker} <- User.block(blocker, blocked) do
|
||||
{:ok, blocker} <- User.block(blocker, blocked),
|
||||
{:ok, _activity} <- ActivityPub.block(blocker, blocked) do
|
||||
{:ok, blocker, blocked}
|
||||
else
|
||||
err -> err
|
||||
|
|
@ -61,7 +55,8 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do
|
|||
|
||||
def unblock(%User{} = blocker, params) do
|
||||
with {:ok, %User{} = blocked} <- get_user(params),
|
||||
{:ok, blocker} <- User.unblock(blocker, blocked) do
|
||||
{:ok, blocker} <- User.unblock(blocker, blocked),
|
||||
{:ok, _activity} <- ActivityPub.unblock(blocker, blocked) do
|
||||
{:ok, blocker, blocked}
|
||||
else
|
||||
err -> err
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue