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
404dbbc7
Commit
404dbbc7
authored
Jun 29, 2021
by
Doug Stull
Committed by
Bob Van Landuyt
Jun 29, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Customize this page banner shows up when it shouldn't
parent
00a0eac9
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
84 additions
and
22 deletions
+84
-22
app/helpers/user_callouts_helper.rb
app/helpers/user_callouts_helper.rb
+1
-1
app/models/user.rb
app/models/user.rb
+4
-0
app/views/dashboard/projects/index.html.haml
app/views/dashboard/projects/index.html.haml
+0
-9
app/views/root/index.html.haml
app/views/root/index.html.haml
+10
-0
ee/spec/controllers/ee/root_controller_spec.rb
ee/spec/controllers/ee/root_controller_spec.rb
+1
-1
spec/controllers/root_controller_spec.rb
spec/controllers/root_controller_spec.rb
+24
-4
spec/features/dashboard/projects_spec.rb
spec/features/dashboard/projects_spec.rb
+0
-6
spec/features/dashboard/root_spec.rb
spec/features/dashboard/root_spec.rb
+19
-0
spec/helpers/user_callouts_helper_spec.rb
spec/helpers/user_callouts_helper_spec.rb
+11
-1
spec/models/user_spec.rb
spec/models/user_spec.rb
+14
-0
No files found.
app/helpers/user_callouts_helper.rb
View file @
404dbbc7
...
...
@@ -43,7 +43,7 @@ module UserCalloutsHelper
end
def
show_customize_homepage_banner?
!
user_dismissed?
(
CUSTOMIZE_HOMEPAGE
)
current_user
.
default_dashboard?
&&
!
user_dismissed?
(
CUSTOMIZE_HOMEPAGE
)
end
def
show_feature_flags_new_version?
...
...
app/models/user.rb
View file @
404dbbc7
...
...
@@ -808,6 +808,10 @@ class User < ApplicationRecord
# Instance methods
#
def
default_dashboard?
dashboard
==
self
.
class
.
column_defaults
[
'dashboard'
]
end
def
full_path
username
end
...
...
app/views/dashboard/projects/index.html.haml
View file @
404dbbc7
...
...
@@ -3,15 +3,6 @@
=
content_for
:meta_tags
do
=
auto_discovery_link_tag
(
:atom
,
dashboard_projects_url
(
rss_url_options
),
title:
"All activity"
)
-
if
show_customize_homepage_banner?
=
content_for
:customize_homepage_banner
do
.gl-display-none.gl-md-display-block
{
class:
"gl-pt-6! gl-pb-2! #{(container_class unless @no_container)} #{@content_class}"
}
.js-customize-homepage-banner
{
data:
{
svg_path:
image_path
(
'illustrations/monitoring/getting_started.svg'
),
preferences_behavior_path:
profile_preferences_path
(
anchor:
'behavior'
),
callouts_path:
user_callouts_path
,
callouts_feature_id:
UserCalloutsHelper
::
CUSTOMIZE_HOMEPAGE
,
track_label:
'home_page'
}
}
=
render_dashboard_ultimate_trial
(
current_user
)
-
page_title
_
(
"Projects"
)
...
...
app/views/root/index.html.haml
0 → 100644
View file @
404dbbc7
-
if
show_customize_homepage_banner?
=
content_for
:customize_homepage_banner
do
.gl-display-none.gl-md-display-block
{
class:
"gl-pt-6! gl-pb-2! #{(container_class unless @no_container)} #{@content_class}"
}
.js-customize-homepage-banner
{
data:
{
svg_path:
image_path
(
'illustrations/monitoring/getting_started.svg'
),
preferences_behavior_path:
profile_preferences_path
(
anchor:
'behavior'
),
callouts_path:
user_callouts_path
,
callouts_feature_id:
UserCalloutsHelper
::
CUSTOMIZE_HOMEPAGE
,
track_label:
'home_page'
}
}
=
render
template:
'dashboard/projects/index'
ee/spec/controllers/ee/root_controller_spec.rb
View file @
404dbbc7
...
...
@@ -93,7 +93,7 @@ RSpec.describe RootController do
it
'renders the default dashboard'
do
get
:index
expect
(
response
).
to
render_template
'
dashboard/projects
/index'
expect
(
response
).
to
render_template
'
root
/index'
end
end
end
...
...
spec/controllers/root_controller_spec.rb
View file @
404dbbc7
...
...
@@ -128,11 +128,31 @@ RSpec.describe RootController do
end
end
context
'who uses the default dashboard setting'
do
it
'renders the default dashboard'
do
get
:index
context
'who uses the default dashboard setting'
,
:aggregate_failures
do
render_views
context
'with customize homepage banner'
do
it
'renders the default dashboard'
do
get
:index
expect
(
response
).
to
render_template
'root/index'
expect
(
response
.
body
).
to
have_css
(
'.js-customize-homepage-banner'
)
end
end
context
'without customize homepage banner'
do
before
do
Users
::
DismissUserCalloutService
.
new
(
container:
nil
,
current_user:
user
,
params:
{
feature_name:
UserCalloutsHelper
::
CUSTOMIZE_HOMEPAGE
}
).
execute
end
it
'renders the default dashboard'
do
get
:index
expect
(
response
).
to
render_template
'dashboard/projects/index'
expect
(
response
).
to
render_template
'root/index'
expect
(
response
.
body
).
not_to
have_css
(
'.js-customize-homepage-banner'
)
end
end
end
end
...
...
spec/features/dashboard/projects_spec.rb
View file @
404dbbc7
...
...
@@ -18,12 +18,6 @@ RSpec.describe 'Dashboard Projects' do
end
end
it
'shows the customize banner'
,
:js
do
visit
dashboard_projects_path
expect
(
page
).
to
have_content
(
'Do you want to customize this page?'
)
end
context
'when user has access to the project'
do
it
'shows role badge'
do
visit
dashboard_projects_path
...
...
spec/features/dashboard/root_spec.rb
0 → 100644
View file @
404dbbc7
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
'Root path'
do
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:project
)
{
create
(
:project
)
}
before
do
project
.
add_developer
(
user
)
sign_in
(
user
)
end
it
'shows the customize banner'
,
:js
do
visit
root_path
expect
(
page
).
to
have_content
(
'Do you want to customize this page?'
)
end
end
spec/helpers/user_callouts_helper_spec.rb
View file @
404dbbc7
...
...
@@ -97,7 +97,17 @@ RSpec.describe UserCalloutsHelper do
allow
(
helper
).
to
receive
(
:user_dismissed?
).
with
(
described_class
::
CUSTOMIZE_HOMEPAGE
)
{
false
}
end
it
{
is_expected
.
to
be
true
}
context
'when user is on the default dashboard'
do
it
{
is_expected
.
to
be
true
}
end
context
'when user is not on the default dashboard'
do
before
do
user
.
dashboard
=
'stars'
end
it
{
is_expected
.
to
be
false
}
end
end
context
'when user dismissed'
do
...
...
spec/models/user_spec.rb
View file @
404dbbc7
...
...
@@ -5754,6 +5754,20 @@ RSpec.describe User do
end
end
describe
'#default_dashboard?'
do
it
'is the default dashboard'
do
user
=
build
(
:user
)
expect
(
user
.
default_dashboard?
).
to
be
true
end
it
'is not the default dashboard'
do
user
=
build
(
:user
,
dashboard:
'stars'
)
expect
(
user
.
default_dashboard?
).
to
be
false
end
end
describe
'.dormant'
do
it
'returns dormant users'
do
freeze_time
do
...
...
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