Add Undo of Follow Activity insertion

This commit is contained in:
dtluna 2017-04-21 19:54:21 +03:00
commit 28b203d08f
6 changed files with 51 additions and 6 deletions

View file

@ -2,7 +2,8 @@ defmodule Pleroma.User do
use Ecto.Schema
import Ecto.Changeset
import Ecto.Query
alias Pleroma.{Repo, User, Activity, Object}
alias Pleroma.{Repo, User, Object}
alias Pleroma.Web.ActivityPub.ActivityPub
schema "users" do
field :bio, :string
@ -91,9 +92,10 @@ defmodule Pleroma.User do
following = follower.following
|> List.delete(ap_followers)
follower
{ :ok, follower } = follower
|> follow_changeset(%{following: following})
|> Repo.update
{ :ok, follower, ActivityPub.fetch_latest_follow(follower, followed)}
else
{ :error, "Not subscribed!" }
end