Merge branch 'verify-credentials-default-scope' into 'develop'
Specify default scope in verify_credentials See merge request pleroma/pleroma!317
This commit is contained in:
commit
95abc0eaaa
@ -68,7 +68,8 @@ defmodule Pleroma.User do
|
|||||||
following_count: length(user.following) - oneself,
|
following_count: length(user.following) - oneself,
|
||||||
note_count: user.info["note_count"] || 0,
|
note_count: user.info["note_count"] || 0,
|
||||||
follower_count: user.info["follower_count"] || 0,
|
follower_count: user.info["follower_count"] || 0,
|
||||||
locked: user.info["locked"] || false
|
locked: user.info["locked"] || false,
|
||||||
|
default_scope: user.info["default_scope"] || "public"
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
|
|||||||
fields: [],
|
fields: [],
|
||||||
source: %{
|
source: %{
|
||||||
note: "",
|
note: "",
|
||||||
privacy: "public",
|
privacy: user_info.default_scope,
|
||||||
sensitive: "false"
|
sensitive: "false"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -206,7 +206,19 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
|
|||||||
|> assign(:user, user)
|
|> assign(:user, user)
|
||||||
|> get("/api/v1/accounts/verify_credentials")
|
|> get("/api/v1/accounts/verify_credentials")
|
||||||
|
|
||||||
assert %{"id" => id} = json_response(conn, 200)
|
assert %{"id" => id, "source" => %{"privacy" => "public"}} = json_response(conn, 200)
|
||||||
|
assert id == to_string(user.id)
|
||||||
|
end
|
||||||
|
|
||||||
|
test "verify_credentials default scope unlisted", %{conn: conn} do
|
||||||
|
user = insert(:user, %{info: %{"default_scope" => "unlisted"}})
|
||||||
|
|
||||||
|
conn =
|
||||||
|
conn
|
||||||
|
|> assign(:user, user)
|
||||||
|
|> get("/api/v1/accounts/verify_credentials")
|
||||||
|
|
||||||
|
assert %{"id" => id, "source" => %{"privacy" => "unlisted"}} = json_response(conn, 200)
|
||||||
assert id == to_string(user.id)
|
assert id == to_string(user.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -715,6 +727,18 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
|
|||||||
assert User.following?(other_user, user) == true
|
assert User.following?(other_user, user) == true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "verify_credentials", %{conn: conn} do
|
||||||
|
user = insert(:user, %{info: %{"default_scope" => "private"}})
|
||||||
|
|
||||||
|
conn =
|
||||||
|
conn
|
||||||
|
|> assign(:user, user)
|
||||||
|
|> get("/api/v1/accounts/verify_credentials")
|
||||||
|
|
||||||
|
assert %{"id" => id, "source" => %{"privacy" => "private"}} = json_response(conn, 200)
|
||||||
|
assert id == to_string(user.id)
|
||||||
|
end
|
||||||
|
|
||||||
test "/api/v1/follow_requests/:id/reject works" do
|
test "/api/v1/follow_requests/:id/reject works" do
|
||||||
user = insert(:user, %{info: %{"locked" => true}})
|
user = insert(:user, %{info: %{"locked" => true}})
|
||||||
other_user = insert(:user)
|
other_user = insert(:user)
|
||||||
|
Loading…
Reference in New Issue
Block a user