Skip to content
GitLab
Menu
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
99e9c2c6
Commit
99e9c2c6
authored
Jan 25, 2022
by
Alex Gleason
Browse files
Merge branch 'birth-dates' into 'develop'
Fix show_birthday See merge request
!3621
parents
dd7977bb
ab12a05a
Pipeline
#38870
passed with stages
in 74 minutes and 52 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
lib/pleroma/web/mastodon_api/views/account_view.ex
View file @
99e9c2c6
...
@@ -297,8 +297,7 @@ defp do_render("show.json", %{user: user} = opts) do
...
@@ -297,8 +297,7 @@ defp do_render("show.json", %{user: user} = opts) do
skip_thread_containment:
user
.
skip_thread_containment
,
skip_thread_containment:
user
.
skip_thread_containment
,
background_image:
image_url
(
user
.
background
)
|>
MediaProxy
.
url
(),
background_image:
image_url
(
user
.
background
)
|>
MediaProxy
.
url
(),
accepts_chat_messages:
user
.
accepts_chat_messages
,
accepts_chat_messages:
user
.
accepts_chat_messages
,
favicon:
favicon
,
favicon:
favicon
birthday:
user
.
birthday
}
}
}
}
|>
maybe_put_role
(
user
,
opts
[
:for
])
|>
maybe_put_role
(
user
,
opts
[
:for
])
...
...
test/pleroma/web/mastodon_api/views/account_view_test.exs
View file @
99e9c2c6
...
@@ -79,7 +79,6 @@ test "Represent a user account" do
...
@@ -79,7 +79,6 @@ test "Represent a user account" do
ap_id:
user
.
ap_id
,
ap_id:
user
.
ap_id
,
also_known_as:
[
"https://shitposter.zone/users/shp"
],
also_known_as:
[
"https://shitposter.zone/users/shp"
],
background_image:
"https://example.com/images/asuka_hospital.png"
,
background_image:
"https://example.com/images/asuka_hospital.png"
,
birthday:
nil
,
favicon:
nil
,
favicon:
nil
,
is_confirmed:
true
,
is_confirmed:
true
,
tags:
[],
tags:
[],
...
@@ -182,7 +181,6 @@ test "Represent a Service(bot) account" do
...
@@ -182,7 +181,6 @@ test "Represent a Service(bot) account" do
ap_id:
user
.
ap_id
,
ap_id:
user
.
ap_id
,
also_known_as:
[],
also_known_as:
[],
background_image:
nil
,
background_image:
nil
,
birthday:
nil
,
favicon:
nil
,
favicon:
nil
,
is_confirmed:
true
,
is_confirmed:
true
,
tags:
[],
tags:
[],
...
@@ -496,6 +494,40 @@ test "shows email only to the account owner" do
...
@@ -496,6 +494,40 @@ test "shows email only to the account owner" do
end
end
end
end
describe
"hiding birthday"
do
test
"doesn't show birthday if hidden"
do
user
=
insert
(
:user
,
%{
birthday:
"2001-02-12"
,
show_birthday:
false
})
other_user
=
insert
(
:user
)
user
=
User
.
get_cached_by_ap_id
(
user
.
ap_id
)
assert
AccountView
.
render
(
"show.json"
,
%{
user:
user
,
for:
other_user
}
)[
:birthday
]
==
nil
end
test
"shows hidden birthday to the account owner"
do
user
=
insert
(
:user
,
%{
birthday:
"2001-02-12"
,
show_birthday:
false
})
user
=
User
.
get_cached_by_ap_id
(
user
.
ap_id
)
assert
AccountView
.
render
(
"show.json"
,
%{
user:
user
,
for:
user
}
)[
:birthday
]
==
nil
end
end
describe
"follow requests counter"
do
describe
"follow requests counter"
do
test
"shows zero when no follow requests are pending"
do
test
"shows zero when no follow requests are pending"
do
user
=
insert
(
:user
)
user
=
insert
(
:user
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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