Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
feld
pleroma
Commits
ddc6f32b
Verified
Commit
ddc6f32b
authored
Aug 29, 2018
by
href
Browse files
Fix Mastodon API when actor's nickname is null
parent
cce9d008
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/pleroma/web/mastodon_api/views/account_view.ex
View file @
ddc6f32b
...
...
@@ -28,7 +28,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
%{
id:
to_string
(
user
.
id
),
username:
hd
(
String
.
split
(
user
.
nickname
,
"@"
)
),
username:
username_from_nickname
(
user
.
nickname
),
acct:
user
.
nickname
,
display_name:
user
.
name
||
user
.
nickname
,
locked:
user_info
.
locked
,
...
...
@@ -56,7 +56,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
%{
id:
to_string
(
user
.
id
),
acct:
user
.
nickname
,
username:
hd
(
String
.
split
(
user
.
nickname
,
"@"
)
),
username:
username_from_nickname
(
user
.
nickname
),
url:
user
.
ap_id
}
end
...
...
@@ -76,4 +76,10 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
def
render
(
"relationships.json"
,
%{
user:
user
,
targets:
targets
})
do
render_many
(
targets
,
AccountView
,
"relationship.json"
,
user:
user
,
as:
:target
)
end
defp
username_from_nickname
(
string
)
when
is_binary
(
string
)
do
hd
(
String
.
split
(
string
,
"@"
))
end
defp
username_from_nickname
(
_
),
do
:
nil
end
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment