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
fffb0c5d
Commit
fffb0c5d
authored
Nov 18, 2020
by
Peter Hegman
Committed by
Stan Hu
Nov 18, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hide open registration callout on gitlab.com
Unneeded on gitlab.com since registration will always be open
parent
572bb643
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
2 deletions
+25
-2
app/helpers/user_callouts_helper.rb
app/helpers/user_callouts_helper.rb
+4
-1
changelogs/unreleased/hide-open-registration-callout-on-gitlab-com.yml
...released/hide-open-registration-callout-on-gitlab-com.yml
+5
-0
spec/helpers/user_callouts_helper_spec.rb
spec/helpers/user_callouts_helper_spec.rb
+16
-1
No files found.
app/helpers/user_callouts_helper.rb
View file @
fffb0c5d
...
@@ -57,7 +57,10 @@ module UserCalloutsHelper
...
@@ -57,7 +57,10 @@ module UserCalloutsHelper
end
end
def
show_registration_enabled_user_callout?
def
show_registration_enabled_user_callout?
current_user
&
.
admin?
&&
signup_enabled?
&&
!
user_dismissed?
(
REGISTRATION_ENABLED_CALLOUT
)
!
Gitlab
.
com?
&&
current_user
&
.
admin?
&&
signup_enabled?
&&
!
user_dismissed?
(
REGISTRATION_ENABLED_CALLOUT
)
end
end
private
private
...
...
changelogs/unreleased/hide-open-registration-callout-on-gitlab-com.yml
0 → 100644
View file @
fffb0c5d
---
title
:
Hide open registration user callout on gitlab.com
merge_request
:
47865
author
:
type
:
changed
spec/helpers/user_callouts_helper_spec.rb
View file @
fffb0c5d
...
@@ -167,8 +167,20 @@ RSpec.describe UserCalloutsHelper do
...
@@ -167,8 +167,20 @@ RSpec.describe UserCalloutsHelper do
subject
{
helper
.
show_registration_enabled_user_callout?
}
subject
{
helper
.
show_registration_enabled_user_callout?
}
context
'when on gitlab.com'
do
before
do
allow
(
::
Gitlab
).
to
receive
(
:com?
).
and_return
(
true
)
allow
(
helper
).
to
receive
(
:current_user
).
and_return
(
admin
)
stub_application_setting
(
signup_enabled:
true
)
allow
(
helper
).
to
receive
(
:user_dismissed?
).
with
(
described_class
::
REGISTRATION_ENABLED_CALLOUT
)
{
false
}
end
it
{
is_expected
.
to
be
false
}
end
context
'when `current_user` is not an admin'
do
context
'when `current_user` is not an admin'
do
before
do
before
do
allow
(
::
Gitlab
).
to
receive
(
:com?
).
and_return
(
false
)
allow
(
helper
).
to
receive
(
:current_user
).
and_return
(
user
)
allow
(
helper
).
to
receive
(
:current_user
).
and_return
(
user
)
stub_application_setting
(
signup_enabled:
true
)
stub_application_setting
(
signup_enabled:
true
)
allow
(
helper
).
to
receive
(
:user_dismissed?
).
with
(
described_class
::
REGISTRATION_ENABLED_CALLOUT
)
{
false
}
allow
(
helper
).
to
receive
(
:user_dismissed?
).
with
(
described_class
::
REGISTRATION_ENABLED_CALLOUT
)
{
false
}
...
@@ -179,6 +191,7 @@ RSpec.describe UserCalloutsHelper do
...
@@ -179,6 +191,7 @@ RSpec.describe UserCalloutsHelper do
context
'when signup is disabled'
do
context
'when signup is disabled'
do
before
do
before
do
allow
(
::
Gitlab
).
to
receive
(
:com?
).
and_return
(
false
)
allow
(
helper
).
to
receive
(
:current_user
).
and_return
(
admin
)
allow
(
helper
).
to
receive
(
:current_user
).
and_return
(
admin
)
stub_application_setting
(
signup_enabled:
false
)
stub_application_setting
(
signup_enabled:
false
)
allow
(
helper
).
to
receive
(
:user_dismissed?
).
with
(
described_class
::
REGISTRATION_ENABLED_CALLOUT
)
{
false
}
allow
(
helper
).
to
receive
(
:user_dismissed?
).
with
(
described_class
::
REGISTRATION_ENABLED_CALLOUT
)
{
false
}
...
@@ -189,6 +202,7 @@ RSpec.describe UserCalloutsHelper do
...
@@ -189,6 +202,7 @@ RSpec.describe UserCalloutsHelper do
context
'when user has dismissed callout'
do
context
'when user has dismissed callout'
do
before
do
before
do
allow
(
::
Gitlab
).
to
receive
(
:com?
).
and_return
(
false
)
allow
(
helper
).
to
receive
(
:current_user
).
and_return
(
admin
)
allow
(
helper
).
to
receive
(
:current_user
).
and_return
(
admin
)
stub_application_setting
(
signup_enabled:
true
)
stub_application_setting
(
signup_enabled:
true
)
allow
(
helper
).
to
receive
(
:user_dismissed?
).
with
(
described_class
::
REGISTRATION_ENABLED_CALLOUT
)
{
true
}
allow
(
helper
).
to
receive
(
:user_dismissed?
).
with
(
described_class
::
REGISTRATION_ENABLED_CALLOUT
)
{
true
}
...
@@ -197,8 +211,9 @@ RSpec.describe UserCalloutsHelper do
...
@@ -197,8 +211,9 @@ RSpec.describe UserCalloutsHelper do
it
{
is_expected
.
to
be
false
}
it
{
is_expected
.
to
be
false
}
end
end
context
'when `current_user` is an admin, signup is enabled, and user has not dismissed callout'
do
context
'when
not gitlab.com,
`current_user` is an admin, signup is enabled, and user has not dismissed callout'
do
before
do
before
do
allow
(
::
Gitlab
).
to
receive
(
:com?
).
and_return
(
false
)
allow
(
helper
).
to
receive
(
:current_user
).
and_return
(
admin
)
allow
(
helper
).
to
receive
(
:current_user
).
and_return
(
admin
)
stub_application_setting
(
signup_enabled:
true
)
stub_application_setting
(
signup_enabled:
true
)
allow
(
helper
).
to
receive
(
:user_dismissed?
).
with
(
described_class
::
REGISTRATION_ENABLED_CALLOUT
)
{
false
}
allow
(
helper
).
to
receive
(
:user_dismissed?
).
with
(
described_class
::
REGISTRATION_ENABLED_CALLOUT
)
{
false
}
...
...
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