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
d908fcb2
Commit
d908fcb2
authored
Feb 10, 2021
by
Amparo Luna
Committed by
Andrew Fontaine
Feb 10, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove feature flag usages
The :admin_new_user_signups_cap feature is no longer needed.
parent
bd3a20b8
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
41 additions
and
155 deletions
+41
-155
ee/app/controllers/ee/admin/application_settings_controller.rb
...p/controllers/ee/admin/application_settings_controller.rb
+1
-1
ee/app/helpers/ee/user_callouts_helper.rb
ee/app/helpers/ee/user_callouts_helper.rb
+0
-1
ee/app/models/ee/application_setting.rb
ee/app/models/ee/application_setting.rb
+1
-2
ee/app/services/ee/application_settings/update_service.rb
ee/app/services/ee/application_settings/update_service.rb
+0
-1
ee/app/views/admin/application_settings/_new_user_signups_cap.html.haml
...dmin/application_settings/_new_user_signups_cap.html.haml
+0
-2
ee/config/feature_flags/development/admin_new_user_signups_cap.yml
.../feature_flags/development/admin_new_user_signups_cap.yml
+0
-8
ee/spec/controllers/ee/registrations_controller_spec.rb
ee/spec/controllers/ee/registrations_controller_spec.rb
+4
-26
ee/spec/features/admin/admin_settings_spec.rb
ee/spec/features/admin/admin_settings_spec.rb
+26
-44
ee/spec/helpers/ee/user_callouts_helper_spec.rb
ee/spec/helpers/ee/user_callouts_helper_spec.rb
+0
-9
ee/spec/models/application_setting_spec.rb
ee/spec/models/application_setting_spec.rb
+9
-19
ee/spec/models/ee/user_spec.rb
ee/spec/models/ee/user_spec.rb
+0
-12
ee/spec/requests/callout_spec.rb
ee/spec/requests/callout_spec.rb
+0
-8
ee/spec/services/application_settings/update_service_spec.rb
ee/spec/services/application_settings/update_service_spec.rb
+0
-10
ee/spec/services/ee/users/build_service_spec.rb
ee/spec/services/ee/users/build_service_spec.rb
+0
-12
No files found.
ee/app/controllers/ee/admin/application_settings_controller.rb
View file @
d908fcb2
...
@@ -62,7 +62,7 @@ module EE
...
@@ -62,7 +62,7 @@ module EE
attrs
<<
:maintenance_mode_message
attrs
<<
:maintenance_mode_message
end
end
attrs
<<
:new_user_signups_cap
if
::
Feature
.
enabled?
(
:admin_new_user_signups_cap
,
default_enabled:
true
)
attrs
<<
:new_user_signups_cap
attrs
attrs
end
end
...
...
ee/app/helpers/ee/user_callouts_helper.rb
View file @
d908fcb2
...
@@ -84,7 +84,6 @@ module EE
...
@@ -84,7 +84,6 @@ module EE
end
end
def
show_new_user_signups_cap_reached?
def
show_new_user_signups_cap_reached?
return
false
unless
::
Feature
.
enabled?
(
:admin_new_user_signups_cap
,
default_enabled:
true
)
return
false
unless
current_user
&
.
admin?
return
false
unless
current_user
&
.
admin?
return
false
if
user_dismissed?
(
NEW_USER_SIGNUPS_CAP_REACHED
)
return
false
if
user_dismissed?
(
NEW_USER_SIGNUPS_CAP_REACHED
)
...
...
ee/app/models/ee/application_setting.rb
View file @
d908fcb2
...
@@ -358,8 +358,7 @@ module EE
...
@@ -358,8 +358,7 @@ module EE
end
end
def
should_apply_user_signup_cap?
def
should_apply_user_signup_cap?
::
Feature
.
enabled?
(
:admin_new_user_signups_cap
,
default_enabled:
true
)
&&
::
Gitlab
::
CurrentSettings
.
new_user_signups_cap
.
present?
::
Gitlab
::
CurrentSettings
.
new_user_signups_cap
.
present?
end
end
private
private
...
...
ee/app/services/ee/application_settings/update_service.rb
View file @
d908fcb2
...
@@ -52,7 +52,6 @@ module EE
...
@@ -52,7 +52,6 @@ module EE
def
user_cap_increased?
def
user_cap_increased?
return
false
unless
application_setting
.
previous_changes
.
key?
(
:new_user_signups_cap
)
return
false
unless
application_setting
.
previous_changes
.
key?
(
:new_user_signups_cap
)
return
false
unless
::
Feature
.
enabled?
(
:admin_new_user_signups_cap
,
default_enabled:
true
)
previous_user_cap
,
current_user_cap
=
application_setting
.
previous_changes
[
:new_user_signups_cap
]
previous_user_cap
,
current_user_cap
=
application_setting
.
previous_changes
[
:new_user_signups_cap
]
...
...
ee/app/views/admin/application_settings/_new_user_signups_cap.html.haml
View file @
d908fcb2
-
return
unless
::
Feature
.
enabled?
(
:admin_new_user_signups_cap
,
default_enabled:
true
)
.form-group
.form-group
=
form
.
label
:new_user_signups_cap
,
s_
(
'AdminArea|User cap'
),
class:
'label-bold'
=
form
.
label
:new_user_signups_cap
,
s_
(
'AdminArea|User cap'
),
class:
'label-bold'
=
form
.
number_field
:new_user_signups_cap
,
class:
'form-control gl-form-input'
,
max:
License
.
current
&
.
restricted_user_count
=
form
.
number_field
:new_user_signups_cap
,
class:
'form-control gl-form-input'
,
max:
License
.
current
&
.
restricted_user_count
...
...
ee/config/feature_flags/development/admin_new_user_signups_cap.yml
deleted
100644 → 0
View file @
bd3a20b8
---
name
:
admin_new_user_signups_cap
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/45643
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/292600
milestone
:
'
13.6'
type
:
development
group
:
group::purchase
default_enabled
:
true
ee/spec/controllers/ee/registrations_controller_spec.rb
View file @
d908fcb2
...
@@ -74,39 +74,17 @@ RSpec.describe RegistrationsController do
...
@@ -74,39 +74,17 @@ RSpec.describe RegistrationsController do
end
end
end
end
context
'when user signup cap
setting is enabled
'
do
context
'when user signup cap
is set
'
do
before
do
before
do
stub_application_setting
(
new_user_signups_cap:
true
)
stub_application_setting
(
new_user_signups_cap:
1
)
end
end
it_behaves_like
'blocked user by default'
it_behaves_like
'blocked user by default'
context
'when feature flag is disabled'
do
before
do
stub_feature_flags
(
admin_new_user_signups_cap:
false
)
end
context
'when require admin approval setting is disabled'
do
before
do
stub_application_setting
(
require_admin_approval_after_user_signup:
false
)
end
it_behaves_like
'active user by default'
end
context
'when require admin approval setting is enabled'
do
before
do
stub_application_setting
(
require_admin_approval_after_user_signup:
true
)
end
it_behaves_like
'blocked user by default'
end
end
end
end
context
'when user signup cap
setting is disabled
'
do
context
'when user signup cap
is not set
'
do
before
do
before
do
stub_application_setting
(
admin_new_user_signups_cap:
false
)
stub_application_setting
(
new_user_signups_cap:
nil
)
end
end
context
'when require admin approval setting is disabled'
do
context
'when require admin approval setting is disabled'
do
...
...
ee/spec/features/admin/admin_settings_spec.rb
View file @
d908fcb2
...
@@ -281,70 +281,52 @@ RSpec.describe 'Admin updates EE-only settings' do
...
@@ -281,70 +281,52 @@ RSpec.describe 'Admin updates EE-only settings' do
end
end
context
'sign up settings'
do
context
'sign up settings'
do
context
'when feature flag is disabled'
do
context
'when license has active user count'
do
before
do
let
(
:license
)
{
create
(
:license
,
restrictions:
{
active_user_count:
1
})
}
stub_feature_flags
(
admin_new_user_signups_cap:
false
)
end
it
'does not render user cap form group'
do
visit
general_admin_application_settings_path
expect
(
page
).
not_to
have_field
(
'User cap'
)
end
end
context
'when feature flag is enabled'
do
before
do
before
do
stub_feature_flags
(
admin_new_user_signups_cap:
tru
e
)
allow
(
License
).
to
receive
(
:current
).
and_return
(
licens
e
)
end
end
context
'when license has active user count'
do
it
'disallows entering user cap greater then license allows'
,
:js
do
let
(
:license
)
{
create
(
:license
,
restrictions:
{
active_user_count:
1
})
}
visit
general_admin_application_settings_path
before
do
allow
(
License
).
to
receive
(
:current
).
and_return
(
license
)
end
it
'disallows entering user cap greater then license allows'
,
:js
do
visit
general_admin_application_settings_path
page
.
within
(
'#js-signup-settings'
)
do
page
.
within
(
'#js-signup-settings'
)
do
fill_in
'User cap'
,
with:
5
fill_in
'User cap'
,
with:
5
click_button
'Save changes'
click_button
'Save changes'
message
=
message
=
page
.
find
(
'#application_setting_new_user_signups_cap'
).
native
.
attribute
(
'validationMessage'
)
page
.
find
(
'#application_setting_new_user_signups_cap'
).
native
.
attribute
(
'validationMessage'
)
expect
(
message
).
to
eq
(
'Value must be less than or equal to 1.'
)
expect
(
message
).
to
eq
(
'Value must be less than or equal to 1.'
)
end
end
end
end
end
end
it
'changes the user cap from unlimited to 5'
do
it
'changes the user cap from unlimited to 5'
do
visit
general_admin_application_settings_path
visit
general_admin_application_settings_path
expect
(
current_settings
.
new_user_signups_cap
).
to
be_nil
expect
(
current_settings
.
new_user_signups_cap
).
to
be_nil
page
.
within
(
'#js-signup-settings'
)
do
page
.
within
(
'#js-signup-settings'
)
do
fill_in
'User cap'
,
with:
5
fill_in
'User cap'
,
with:
5
click_button
'Save changes'
click_button
'Save changes'
expect
(
current_settings
.
new_user_signups_cap
).
to
eq
(
5
)
expect
(
current_settings
.
new_user_signups_cap
).
to
eq
(
5
)
end
end
end
end
it
'changes the user cap to unlimited'
do
it
'changes the user cap to unlimited'
do
visit
general_admin_application_settings_path
visit
general_admin_application_settings_path
page
.
within
(
'#js-signup-settings'
)
do
page
.
within
(
'#js-signup-settings'
)
do
fill_in
'User cap'
,
with:
nil
fill_in
'User cap'
,
with:
nil
click_button
'Save changes'
click_button
'Save changes'
expect
(
current_settings
.
new_user_signups_cap
).
to
be_nil
expect
(
current_settings
.
new_user_signups_cap
).
to
be_nil
end
end
end
end
end
end
end
...
...
ee/spec/helpers/ee/user_callouts_helper_spec.rb
View file @
d908fcb2
...
@@ -351,15 +351,6 @@ RSpec.describe EE::UserCalloutsHelper do
...
@@ -351,15 +351,6 @@ RSpec.describe EE::UserCalloutsHelper do
it
{
is_expected
.
to
eq
(
false
)
}
it
{
is_expected
.
to
eq
(
false
)
}
end
end
context
'when feature flag is disabled'
do
before
do
allow
(
helper
).
to
receive
(
:current_user
).
and_return
(
admin
)
stub_feature_flags
(
admin_new_user_signups_cap:
false
)
end
it
{
is_expected
.
to
eq
(
false
)
}
end
context
'when feature flag is enabled'
do
context
'when feature flag is enabled'
do
where
(
:new_user_signups_cap
,
:active_user_count
,
:result
)
do
where
(
:new_user_signups_cap
,
:active_user_count
,
:result
)
do
nil
|
10
|
false
nil
|
10
|
false
...
...
ee/spec/models/application_setting_spec.rb
View file @
d908fcb2
...
@@ -766,30 +766,20 @@ RSpec.describe ApplicationSetting do
...
@@ -766,30 +766,20 @@ RSpec.describe ApplicationSetting do
describe
'#should_apply_user_signup_cap?'
do
describe
'#should_apply_user_signup_cap?'
do
subject
{
setting
.
should_apply_user_signup_cap?
}
subject
{
setting
.
should_apply_user_signup_cap?
}
context
'when feature admin_new_user_signups_cap is disabled'
do
before
do
before
do
allow
(
Gitlab
::
CurrentSettings
).
to
receive
(
:new_user_signups_cap
).
and_return
(
new_user_signups_cap
)
stub_feature_flags
(
admin_new_user_signups_cap:
false
)
end
it
{
is_expected
.
to
be
false
}
end
end
context
'when feature admin_new_user_signups_cap is enabled'
do
context
'when new_user_signups_cap setting is nil'
do
before
do
let
(
:new_user_signups_cap
)
{
nil
}
allow
(
Gitlab
::
CurrentSettings
).
to
receive
(
:new_user_signups_cap
).
and_return
(
new_user_signups_cap
)
end
context
'when new_user_signups_cap setting is nil'
do
let
(
:new_user_signups_cap
)
{
nil
}
it
{
is_expected
.
to
be
false
}
it
{
is_expected
.
to
be
false
}
end
end
context
'when new_user_signups_cap setting is set to any number'
do
context
'when new_user_signups_cap setting is set to any number'
do
let
(
:new_user_signups_cap
)
{
10
}
let
(
:new_user_signups_cap
)
{
10
}
it
{
is_expected
.
to
be
true
}
it
{
is_expected
.
to
be
true
}
end
end
end
end
end
end
end
ee/spec/models/ee/user_spec.rb
View file @
d908fcb2
...
@@ -107,18 +107,6 @@ RSpec.describe User do
...
@@ -107,18 +107,6 @@ RSpec.describe User do
allow
(
Gitlab
::
CurrentSettings
).
to
receive
(
:new_user_signups_cap
).
and_return
(
new_user_signups_cap
)
allow
(
Gitlab
::
CurrentSettings
).
to
receive
(
:new_user_signups_cap
).
and_return
(
new_user_signups_cap
)
end
end
context
'when feature is disabled'
do
before
do
stub_feature_flags
(
admin_new_user_signups_cap:
false
)
end
it
'does not call SetUserStatusBasedOnUserCapSettingWorker'
do
expect
(
SetUserStatusBasedOnUserCapSettingWorker
).
not_to
receive
(
:perform_async
)
create
(
:user
,
state:
'blocked_pending_approval'
)
end
end
context
'when user cap is not set'
do
context
'when user cap is not set'
do
it
'does not call SetUserStatusBasedOnUserCapSettingWorker'
do
it
'does not call SetUserStatusBasedOnUserCapSettingWorker'
do
expect
(
SetUserStatusBasedOnUserCapSettingWorker
).
not_to
receive
(
:perform_async
)
expect
(
SetUserStatusBasedOnUserCapSettingWorker
).
not_to
receive
(
:perform_async
)
...
...
ee/spec/requests/callout_spec.rb
View file @
d908fcb2
...
@@ -7,7 +7,6 @@ RSpec.describe 'callout alerts' do
...
@@ -7,7 +7,6 @@ RSpec.describe 'callout alerts' do
describe
'new_user_signups_cap_reached'
do
describe
'new_user_signups_cap_reached'
do
let_it_be
(
:user
)
{
create
(
:admin
)
}
let_it_be
(
:user
)
{
create
(
:admin
)
}
let
(
:enabled
)
{
true
}
let
(
:billable_users
)
{
[
double
(
:billable_user
)]
}
let
(
:billable_users
)
{
[
double
(
:billable_user
)]
}
let
(
:help_page_href
)
{
help_page_path
(
'user/admin_area/settings/sign_up_restrictions.md'
)
}
let
(
:help_page_href
)
{
help_page_path
(
'user/admin_area/settings/sign_up_restrictions.md'
)
}
let
(
:expected_content
)
{
'Your instance has reached its user cap'
}
let
(
:expected_content
)
{
'Your instance has reached its user cap'
}
...
@@ -30,7 +29,6 @@ RSpec.describe 'callout alerts' do
...
@@ -30,7 +29,6 @@ RSpec.describe 'callout alerts' do
end
end
before
do
before
do
stub_feature_flags
(
admin_new_user_signups_cap:
enabled
)
stub_application_setting
(
new_user_signups_cap:
1
)
stub_application_setting
(
new_user_signups_cap:
1
)
allow
(
User
).
to
receive
(
:billable
).
and_return
(
billable_users
)
allow
(
User
).
to
receive
(
:billable
).
and_return
(
billable_users
)
...
@@ -47,12 +45,6 @@ RSpec.describe 'callout alerts' do
...
@@ -47,12 +45,6 @@ RSpec.describe 'callout alerts' do
it_behaves_like
'a hidden alert'
it_behaves_like
'a hidden alert'
end
end
context
'when feature disabled'
do
let
(
:enabled
)
{
false
}
it_behaves_like
'a hidden alert'
end
context
'when user is not admin'
do
context
'when user is not admin'
do
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
...
...
ee/spec/services/application_settings/update_service_spec.rb
View file @
d908fcb2
...
@@ -234,16 +234,6 @@ RSpec.describe ApplicationSettings::UpdateService do
...
@@ -234,16 +234,6 @@ RSpec.describe ApplicationSettings::UpdateService do
include_examples
'worker is called'
include_examples
'worker is called'
end
end
end
end
context
'when feature is disabled'
do
let
(
:opts
)
{
{
new_user_signups_cap:
10
}
}
before
do
stub_feature_flags
(
admin_new_user_signups_cap:
false
)
end
include_examples
'worker is not called'
end
end
end
end
end
end
end
ee/spec/services/ee/users/build_service_spec.rb
View file @
d908fcb2
...
@@ -110,18 +110,6 @@ RSpec.describe Users::BuildService do
...
@@ -110,18 +110,6 @@ RSpec.describe Users::BuildService do
expect
(
user
).
to
be_active
expect
(
user
).
to
be_active
end
end
end
end
context
'when feature is disabled'
do
before
do
stub_feature_flags
(
admin_new_user_signups_cap:
false
)
end
it
'does not set the user state to blocked_pending_approval'
do
user
=
service
.
execute
expect
(
user
).
to
be_active
end
end
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