Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
e05244e5
Commit
e05244e5
authored
Oct 21, 2020
by
fjsanpedro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show head image tags with avatar url
parent
9f498701
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
8 deletions
+33
-8
app/helpers/page_layout_helper.rb
app/helpers/page_layout_helper.rb
+4
-1
config/feature_flags/development/avatar_with_host.yml
config/feature_flags/development/avatar_with_host.yml
+7
-0
spec/helpers/page_layout_helper_spec.rb
spec/helpers/page_layout_helper_spec.rb
+22
-7
No files found.
app/helpers/page_layout_helper.rb
View file @
e05244e5
...
@@ -57,7 +57,10 @@ module PageLayoutHelper
...
@@ -57,7 +57,10 @@ module PageLayoutHelper
subject
=
@project
||
@user
||
@group
subject
=
@project
||
@user
||
@group
image
=
subject
.
avatar_url
if
subject
.
present?
args
=
{}
args
[
:only_path
]
=
false
if
Feature
.
enabled?
(
:avatar_with_host
)
image
=
subject
.
avatar_url
(
args
)
if
subject
.
present?
image
||
default
image
||
default
end
end
...
...
config/feature_flags/development/avatar_with_host.yml
0 → 100644
View file @
e05244e5
---
name
:
avatar_with_host
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/45776
rollout_issue_url
:
type
:
development
group
:
group::editor
default_enabled
:
false
spec/helpers/page_layout_helper_spec.rb
View file @
e05244e5
...
@@ -56,27 +56,42 @@ RSpec.describe PageLayoutHelper do
...
@@ -56,27 +56,42 @@ RSpec.describe PageLayoutHelper do
end
end
%w(project user group)
.
each
do
|
type
|
%w(project user group)
.
each
do
|
type
|
let
(
:object
)
{
build
(
type
,
trait
)
}
let
(
:trait
)
{
:with_avatar
}
context
"with @
#{
type
}
assigned"
do
context
"with @
#{
type
}
assigned"
do
it
"uses
#{
type
.
titlecase
}
avatar if available"
do
before
do
object
=
double
(
avatar_url:
'http://example.com/uploads/-/system/avatar.png'
)
assign
(
type
,
object
)
assign
(
type
,
object
)
end
expect
(
helper
.
page_image
).
to
eq
object
.
avatar_url
it
"uses
#{
type
.
titlecase
}
avatar full url"
do
expect
(
helper
.
page_image
).
to
eq
object
.
avatar_url
(
only_path:
false
)
end
end
it
'falls back to the default when avatar_url is nil'
do
context
'when avatar_url is nil'
do
object
=
double
(
avatar_url:
nil
)
let
(
:trait
)
{
nil
}
assign
(
type
,
object
)
it
'falls back to the default when avatar_url is nil'
do
expect
(
helper
.
page_image
).
to
match_asset_path
'assets/gitlab_logo.png'
expect
(
helper
.
page_image
).
to
match_asset_path
'assets/gitlab_logo.png'
end
end
end
end
end
context
"with no assignments"
do
context
"with no assignments"
do
it
'falls back to the default'
do
it
'falls back to the default'
do
expect
(
helper
.
page_image
).
to
match_asset_path
'assets/gitlab_logo.png'
expect
(
helper
.
page_image
).
to
match_asset_path
'assets/gitlab_logo.png'
end
end
end
end
context
'if avatar_with_host is disabled'
do
it
"
#{
type
.
titlecase
}
does not generate avatar full url"
do
stub_feature_flags
(
avatar_with_host:
false
)
assign
(
type
,
object
)
expect
(
helper
.
page_image
).
to
eq
object
.
avatar_url
(
only_path:
true
)
end
end
end
end
end
end
...
...
Write
Preview
Markdown
is supported
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