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
Pleroma
pleroma
Commits
c196754b
Commit
c196754b
authored
Nov 20, 2018
by
kaniini
Browse files
mastodon api: account view: fix tests
parent
ece86567
Pipeline
#4600
failed with stages
in 7 minutes and 17 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
lib/pleroma/web/mastodon_api/views/account_view.ex
View file @
c196754b
...
...
@@ -14,10 +14,10 @@ def render("account.json", %{user: user} = opts) do
image
=
User
.
avatar_url
(
user
)
|>
MediaProxy
.
url
()
header
=
User
.
banner_url
(
user
)
|>
MediaProxy
.
url
()
user_info
=
User
.
user_info
(
user
)
bot
=
(
user
.
info
[
"
source_data
"
]
[
"type"
]
||
"Person"
)
in
[
"Application"
,
"Service"
]
bot
=
(
user
.
info
.
source_data
[
"type"
]
||
"Person"
)
in
[
"Application"
,
"Service"
]
emojis
=
(
user
.
info
[
"
source_data
"
]
[
"tag"
]
||
[])
(
user
.
info
.
source_data
[
"tag"
]
||
[])
|>
Enum
.
filter
(
fn
%{
"type"
=>
t
}
->
t
==
"Emoji"
end
)
|>
Enum
.
map
(
fn
%{
"icon"
=>
%{
"url"
=>
url
},
"name"
=>
name
}
->
%{
...
...
@@ -29,7 +29,7 @@ def render("account.json", %{user: user} = opts) do
end
)
fields
=
(
user
.
info
[
"
source_data
"
]
[
"attachment"
]
||
[])
(
user
.
info
.
source_data
[
"attachment"
]
||
[])
|>
Enum
.
filter
(
fn
%{
"type"
=>
t
}
->
t
==
"PropertyValue"
end
)
|>
Enum
.
map
(
fn
fields
->
Map
.
take
(
fields
,
[
"name"
,
"value"
])
end
)
...
...
test/web/mastodon_api/account_view_test.exs
View file @
c196754b
...
...
@@ -17,7 +17,7 @@ test "Represent a user account" do
user
=
insert
(
:user
,
%{
info:
%{
"
note_count
"
=>
5
,
"
follower_count
"
=>
3
,
"
source_data
"
=>
source_data
},
info:
%{
note_count
:
5
,
follower_count
:
3
,
source_data
:
source_data
},
nickname:
"shp@shitposter.club"
,
name:
":karjalanpiirakka: shp"
,
bio:
"<script src=
\"
invalid-html
\"
></script><span>valid html</span>"
,
...
...
@@ -63,7 +63,7 @@ test "Represent a user account" do
test
"Represent a Service(bot) account"
do
user
=
insert
(
:user
,
%{
info:
%{
"
note_count
"
=>
5
,
"
follower_count
"
=>
3
,
"
source_data
"
=>
%{
"type"
=>
"Service"
}},
info:
%{
note_count
:
5
,
follower_count
:
3
,
source_data
:
%{
"type"
=>
"Service"
}},
nickname:
"shp@shitposter.club"
,
inserted_at:
~N[2017-08-15 15:47:06.597036]
})
...
...
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