Add subscribed status to user view

Added in pleroma extensions, but can be moved whenever
This commit is contained in:
Sadposter 2019-04-05 15:21:33 +01:00 committed by Hannah Ward
commit d56866c824
3 changed files with 25 additions and 7 deletions

View file

@ -105,7 +105,8 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
"fields" => [],
"pleroma" => %{
"confirmation_pending" => false,
"tags" => []
"tags" => [],
"subscribed" => false
}
}
@ -153,7 +154,8 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
"fields" => [],
"pleroma" => %{
"confirmation_pending" => false,
"tags" => []
"tags" => [],
"subscribed" => false,
}
}
@ -202,13 +204,22 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
"fields" => [],
"pleroma" => %{
"confirmation_pending" => false,
"tags" => []
"tags" => [],
"subscribed" => false
}
}
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})