aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/user.ex
diff options
context:
space:
mode:
authorIvan Tashkinov <ivantashkinov@gmail.com>2021-01-28 19:49:43 +0300
committerIvan Tashkinov <ivantashkinov@gmail.com>2021-01-28 19:49:43 +0300
commit60b46540380e1467dcc0a93f7bfded84c5e98c64 (patch)
treeb586dfa0601c11c4618ae617dbc970da5602b5f6 /lib/pleroma/user.ex
parent7f0787163999fc0ac0c6fcfd0c13f80c5a55266d (diff)
downloadpleroma-60b46540380e1467dcc0a93f7bfded84c5e98c64.tar.gz
Email-like field in /api/v1/accounts/verify_credentials response (for OAuth plugins like Peertube).
Addresses https://git.pleroma.social/pleroma/pleroma-support/-/issues/56.
Diffstat (limited to 'lib/pleroma/user.ex')
-rw-r--r--lib/pleroma/user.ex9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex
index e422b59f1..7cb36454a 100644
--- a/lib/pleroma/user.ex
+++ b/lib/pleroma/user.ex
@@ -2030,6 +2030,15 @@ defmodule Pleroma.User do
|> hd()
end
+ def full_nickname(%User{} = user) do
+ if String.contains?(user.nickname, "@") do
+ user.nickname
+ else
+ %{host: host} = URI.parse(user.ap_id)
+ user.nickname <> "@" <> host
+ end
+ end
+
def full_nickname(nickname_or_mention),
do: String.trim_leading(nickname_or_mention, "@")