Merge branch 'email-stub-in-verify-credentials' into 'develop'
Email-like field in /api/v1/accounts/verify_credentials (for PeerTube OAuth plugin and alike) See merge request pleroma/pleroma!3286
This commit is contained in:
commit
f1f773f2c7
10 changed files with 67 additions and 15 deletions
|
|
@ -2232,6 +2232,36 @@ defmodule Pleroma.UserTest do
|
|||
end
|
||||
end
|
||||
|
||||
describe "local_nickname/1" do
|
||||
test "returns nickname without host" do
|
||||
assert User.local_nickname("@mentioned") == "mentioned"
|
||||
assert User.local_nickname("a_local_nickname") == "a_local_nickname"
|
||||
assert User.local_nickname("nickname@host.com") == "nickname"
|
||||
end
|
||||
end
|
||||
|
||||
describe "full_nickname/1" do
|
||||
test "returns fully qualified nickname for local and remote users" do
|
||||
local_user =
|
||||
insert(:user, nickname: "local_user", ap_id: "https://somehost.com/users/local_user")
|
||||
|
||||
remote_user = insert(:user, nickname: "remote@host.com", local: false)
|
||||
|
||||
assert User.full_nickname(local_user) == "local_user@somehost.com"
|
||||
assert User.full_nickname(remote_user) == "remote@host.com"
|
||||
end
|
||||
|
||||
test "strips leading @ from mentions" do
|
||||
assert User.full_nickname("@mentioned") == "mentioned"
|
||||
assert User.full_nickname("@nickname@host.com") == "nickname@host.com"
|
||||
end
|
||||
|
||||
test "does not modify nicknames" do
|
||||
assert User.full_nickname("nickname") == "nickname"
|
||||
assert User.full_nickname("nickname@host.com") == "nickname@host.com"
|
||||
end
|
||||
end
|
||||
|
||||
test "avatar fallback" do
|
||||
user = insert(:user)
|
||||
assert User.avatar_url(user) =~ "/images/avi.png"
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
|
|||
},
|
||||
fields: []
|
||||
},
|
||||
fqn: "shp@shitposter.club",
|
||||
pleroma: %{
|
||||
ap_id: user.ap_id,
|
||||
also_known_as: ["https://shitposter.zone/users/shp"],
|
||||
|
|
@ -172,6 +173,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
|
|||
},
|
||||
fields: []
|
||||
},
|
||||
fqn: "shp@shitposter.club",
|
||||
pleroma: %{
|
||||
ap_id: user.ap_id,
|
||||
also_known_as: [],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue