Change relationship direction of subscriptions
This commit is contained in:
parent
d35f6551c1
commit
9ca91cbb87
12 changed files with 84 additions and 94 deletions
|
|
@ -142,6 +142,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
|
|||
blocking: true,
|
||||
muting: false,
|
||||
muting_notifications: false,
|
||||
subscribing: false,
|
||||
requested: false,
|
||||
domain_blocking: false,
|
||||
showing_reblogs: true,
|
||||
|
|
@ -198,6 +199,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
|
|||
following: false,
|
||||
followed_by: false,
|
||||
blocking: true,
|
||||
subscribing: false,
|
||||
muting: false,
|
||||
muting_notifications: false,
|
||||
requested: false,
|
||||
|
|
|
|||
|
|
@ -1555,6 +1555,25 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
|
|||
assert %{"id" => _id, "muting" => false} = json_response(conn, 200)
|
||||
end
|
||||
|
||||
test "subscribing / unsubscribing to a user", %{conn: conn} do
|
||||
user = insert(:user)
|
||||
subscription_target = insert(:user)
|
||||
|
||||
conn =
|
||||
conn
|
||||
|> assign(:user, user)
|
||||
|> post("/api/v1/pleroma/accounts/#{subscription_target.id}/subscribe")
|
||||
|
||||
assert %{"id" => _id, "subscribing" => true} = json_response(conn, 200)
|
||||
|
||||
conn =
|
||||
build_conn()
|
||||
|> assign(:user, user)
|
||||
|> post("/api/v1/pleroma/accounts/#{subscription_target.id}/unsubscribe")
|
||||
|
||||
assert %{"id" => _id, "subscribing" => false} = json_response(conn, 200)
|
||||
end
|
||||
|
||||
test "getting a list of mutes", %{conn: conn} do
|
||||
user = insert(:user)
|
||||
other_user = insert(:user)
|
||||
|
|
|
|||
|
|
@ -105,8 +105,7 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
|
|||
"fields" => [],
|
||||
"pleroma" => %{
|
||||
"confirmation_pending" => false,
|
||||
"tags" => [],
|
||||
"subscribed" => false
|
||||
"tags" => []
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -154,8 +153,7 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
|
|||
"fields" => [],
|
||||
"pleroma" => %{
|
||||
"confirmation_pending" => false,
|
||||
"tags" => [],
|
||||
"subscribed" => false
|
||||
"tags" => []
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -204,22 +202,13 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
|
|||
"fields" => [],
|
||||
"pleroma" => %{
|
||||
"confirmation_pending" => false,
|
||||
"tags" => [],
|
||||
"subscribed" => false
|
||||
"tags" => []
|
||||
}
|
||||
}
|
||||
|
||||
assert represented == UserView.render("show.json", %{user: follower, for: user})
|
||||
end
|
||||
|
||||
test "a user that you are subscribed to" do
|
||||
user = insert(:user)
|
||||
subscriber = insert(:user)
|
||||
{:ok, subscriber} = User.subscribe(subscriber, user)
|
||||
represented = UserView.render("show.json", %{user: user, for: subscriber})
|
||||
assert represented["pleroma"]["subscribed"] == true
|
||||
end
|
||||
|
||||
test "a user that is a moderator" do
|
||||
user = insert(:user, %{info: %{is_moderator: true}})
|
||||
represented = UserView.render("show.json", %{user: user, for: user})
|
||||
|
|
@ -299,8 +288,7 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
|
|||
"fields" => [],
|
||||
"pleroma" => %{
|
||||
"confirmation_pending" => false,
|
||||
"tags" => [],
|
||||
"subscribed" => false
|
||||
"tags" => []
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue