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
cef0c04c
Commit
cef0c04c
authored
Mar 24, 2020
by
Doug Stull
Committed by
Phil Hughes
Mar 24, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add notification dot on user avatar
- prepping for new experiment pipeline
parent
df4320ab
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
61 additions
and
0 deletions
+61
-0
app/assets/stylesheets/framework/gitlab_theme.scss
app/assets/stylesheets/framework/gitlab_theme.scss
+17
-0
app/assets/stylesheets/framework/header.scss
app/assets/stylesheets/framework/header.scss
+8
-0
app/helpers/nav_helper.rb
app/helpers/nav_helper.rb
+4
-0
app/views/layouts/header/_default.html.haml
app/views/layouts/header/_default.html.haml
+2
-0
lib/gitlab/experimentation.rb
lib/gitlab/experimentation.rb
+6
-0
spec/helpers/nav_helper_spec.rb
spec/helpers/nav_helper_spec.rb
+20
-0
spec/support/helpers/stub_experiments.rb
spec/support/helpers/stub_experiments.rb
+4
-0
No files found.
app/assets/stylesheets/framework/gitlab_theme.scss
View file @
cef0c04c
...
...
@@ -68,6 +68,23 @@
.header-user-avatar
{
border-color
:
$search-and-nav-links
;
}
.header-user-notification-dot
{
border
:
2px
solid
$nav-svg-color
;
}
}
&
:focus:hover
,
&
:focus
{
&
.header-user-dropdown-toggle
.header-user-notification-dot
{
border-color
:
$white-light
;
}
}
&
:hover
{
&
.header-user-dropdown-toggle
.header-user-notification-dot
{
border-color
:
$nav-svg-color
+
33
;
}
}
&
:hover
,
...
...
app/assets/stylesheets/framework/header.scss
View file @
cef0c04c
...
...
@@ -567,6 +567,14 @@
border
:
1px
solid
$gray-normal
;
}
.header-user-notification-dot
{
background-color
:
$orange-500
;
height
:
10px
;
width
:
10px
;
right
:
8px
;
top
:
-8px
;
}
.with-performance-bar
.navbar-gitlab
{
top
:
$performance-bar-height
;
}
...
...
app/helpers/nav_helper.rb
View file @
cef0c04c
...
...
@@ -65,6 +65,10 @@ module NavHelper
%w(groups#issues labels#index milestones#index boards#index boards#show)
end
def
show_user_notification_dot?
experiment_enabled?
(
:ci_notification_dot
)
end
private
def
get_header_links
...
...
app/views/layouts/header/_default.html.haml
View file @
cef0c04c
...
...
@@ -68,6 +68,8 @@
%li
.nav-item.header-user.dropdown
{
data:
{
track_label:
"profile_dropdown"
,
track_event:
"click_dropdown"
,
track_value:
""
,
qa_selector:
'user_menu'
},
class:
(
'mr-0'
if
has_impersonation_link
)
}
=
link_to
current_user
,
class:
user_dropdown_class
,
data:
{
toggle:
"dropdown"
}
do
=
image_tag
avatar_icon_for_user
(
current_user
,
23
),
width:
23
,
height:
23
,
class:
"header-user-avatar qa-user-avatar"
-
if
show_user_notification_dot?
%span
.header-user-notification-dot.rounded-circle.position-relative
=
sprite_icon
(
'angle-down'
,
css_class:
'caret-down'
)
.dropdown-menu.dropdown-menu-right
=
render
'layouts/header/current_user_dropdown'
...
...
lib/gitlab/experimentation.rb
View file @
cef0c04c
...
...
@@ -28,6 +28,12 @@ module Gitlab
environment:
::
Gitlab
.
dev_env_or_com?
,
enabled_ratio:
0.1
,
tracking_category:
'Growth::Expansion::Experiment::SuggestPipeline'
},
ci_notification_dot:
{
feature_toggle: :ci_notification_dot
,
environment:
::
Gitlab
.
dev_env_or_com?
,
enabled_ratio:
0.1
,
tracking_category:
'Growth::Expansion::Experiment::CiNotificationDot'
}
}.
freeze
...
...
spec/helpers/nav_helper_spec.rb
View file @
cef0c04c
...
...
@@ -117,4 +117,24 @@ describe NavHelper, :do_not_mock_admin_mode do
it
{
is_expected
.
to
all
(
be_a
(
String
))
}
end
describe
'.show_user_notification_dot?'
do
subject
{
helper
.
show_user_notification_dot?
}
context
'when experiment is disabled'
do
before
do
allow
(
helper
).
to
receive
(
:experiment_enabled?
).
with
(
:ci_notification_dot
).
and_return
(
false
)
end
it
{
is_expected
.
to
be_falsey
}
end
context
'when experiment is enabled'
do
before
do
allow
(
helper
).
to
receive
(
:experiment_enabled?
).
with
(
:ci_notification_dot
).
and_return
(
true
)
end
it
{
is_expected
.
to
be_truthy
}
end
end
end
spec/support/helpers/stub_experiments.rb
View file @
cef0c04c
...
...
@@ -8,6 +8,8 @@ module StubExperiments
# Examples
# - `stub_experiment(signup_flow: false)` ... Disable `signup_flow` experiment globally.
def
stub_experiment
(
experiments
)
allow
(
Gitlab
::
Experimentation
).
to
receive
(
:enabled?
).
and_call_original
experiments
.
each
do
|
experiment_key
,
enabled
|
allow
(
Gitlab
::
Experimentation
).
to
receive
(
:enabled?
).
with
(
experiment_key
)
{
enabled
}
end
...
...
@@ -20,6 +22,8 @@ module StubExperiments
# Examples
# - `stub_experiment_for_user(signup_flow: false)` ... Disable `signup_flow` experiment for user.
def
stub_experiment_for_user
(
experiments
)
allow
(
Gitlab
::
Experimentation
).
to
receive
(
:enabled_for_user?
).
and_call_original
experiments
.
each
do
|
experiment_key
,
enabled
|
allow
(
Gitlab
::
Experimentation
).
to
receive
(
:enabled_for_user?
).
with
(
experiment_key
,
anything
)
{
enabled
}
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