diff options
author | Roger Braun <roger@rogerbraun.net> | 2017-03-23 13:13:09 +0100 |
---|---|---|
committer | Roger Braun <roger@rogerbraun.net> | 2017-03-23 13:13:09 +0100 |
commit | 30650e5bc610810d129bf02891a73ac11340710b (patch) | |
tree | 961bc760faea353f875f32325acd0cc296ce16ad /lib/pleroma/web/twitter_api/twitter_api.ex | |
parent | 75e51b190d5b4bd4e9cbf6a669bfce7a440e1a5c (diff) | |
download | pleroma-30650e5bc610810d129bf02891a73ac11340710b.tar.gz |
Add unfollowing to TwAPI.
Diffstat (limited to 'lib/pleroma/web/twitter_api/twitter_api.ex')
-rw-r--r-- | lib/pleroma/web/twitter_api/twitter_api.ex | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/pleroma/web/twitter_api/twitter_api.ex b/lib/pleroma/web/twitter_api/twitter_api.ex index fb093b227..2ef679397 100644 --- a/lib/pleroma/web/twitter_api/twitter_api.ex +++ b/lib/pleroma/web/twitter_api/twitter_api.ex @@ -42,6 +42,14 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do end end + def unfollow(%User{} = follower, followed_id) do + with %User{} = followed <- Repo.get(User, followed_id), + { :ok, follower } <- User.unfollow(follower, followed) + do + { :ok, follower, followed } + end + end + defp activities_to_statuses(activities) do Enum.map(activities, fn(activity) -> actor = get_in(activity.data, ["actor"]) |