mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-22 16:16:34 +00:00
Unfollow should also unsubscribe
This commit is contained in:
parent
509d8058d9
commit
dce8ebc9ea
3 changed files with 17 additions and 1 deletions
|
@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
- Configuration: Filter.AnonymizeFilename added ability to retain file extension with custom text
|
- Configuration: Filter.AnonymizeFilename added ability to retain file extension with custom text
|
||||||
- Federation: Return 403 errors when trying to request pages from a user's follower/following collections if they have `hide_followers`/`hide_follows` set
|
- Federation: Return 403 errors when trying to request pages from a user's follower/following collections if they have `hide_followers`/`hide_follows` set
|
||||||
- NodeInfo: Return `skipThreadContainment` in `metadata` for the `skip_thread_containment` option
|
- NodeInfo: Return `skipThreadContainment` in `metadata` for the `skip_thread_containment` option
|
||||||
|
- Mastodon API: Unsubscribe followers when they unfollow a user
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Not being able to pin unlisted posts
|
- Not being able to pin unlisted posts
|
||||||
|
|
|
@ -31,7 +31,8 @@ defmodule Pleroma.Web.CommonAPI do
|
||||||
|
|
||||||
def unfollow(follower, unfollowed) do
|
def unfollow(follower, unfollowed) do
|
||||||
with {:ok, follower, _follow_activity} <- User.unfollow(follower, unfollowed),
|
with {:ok, follower, _follow_activity} <- User.unfollow(follower, unfollowed),
|
||||||
{:ok, _activity} <- ActivityPub.unfollow(follower, unfollowed) do
|
{:ok, _activity} <- ActivityPub.unfollow(follower, unfollowed),
|
||||||
|
{:ok, _unfollowed} <- User.unsubscribe(follower, unfollowed) do
|
||||||
{:ok, follower}
|
{:ok, follower}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -346,6 +346,20 @@ defmodule Pleroma.Web.CommonAPITest do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "unfollow/2" do
|
||||||
|
test "also unsubscribes a user" do
|
||||||
|
[follower, followed] = insert_pair(:user)
|
||||||
|
{:ok, follower, followed, _} = CommonAPI.follow(follower, followed)
|
||||||
|
{:ok, followed} = User.subscribe(follower, followed)
|
||||||
|
|
||||||
|
assert User.subscribed_to?(follower, followed)
|
||||||
|
|
||||||
|
{:ok, follower} = CommonAPI.unfollow(follower, followed)
|
||||||
|
|
||||||
|
refute User.subscribed_to?(follower, followed)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe "accept_follow_request/2" do
|
describe "accept_follow_request/2" do
|
||||||
test "after acceptance, it sets all existing pending follow request states to 'accept'" do
|
test "after acceptance, it sets all existing pending follow request states to 'accept'" do
|
||||||
user = insert(:user, info: %{locked: true})
|
user = insert(:user, info: %{locked: true})
|
||||||
|
|
Loading…
Reference in a new issue