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
607fa30c
Commit
607fa30c
authored
Jul 28, 2020
by
Vitali Tatarintev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move UserCalloutEnums to Enums::UserCallout
Move enums related modules into a separate directory.
parent
cb5d8229
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
63 additions
and
59 deletions
+63
-59
app/models/concerns/enums/user_callout.rb
app/models/concerns/enums/user_callout.rb
+28
-0
app/models/user_callout.rb
app/models/user_callout.rb
+2
-2
app/models/user_callout_enums.rb
app/models/user_callout_enums.rb
+0
-26
db/post_migrate/20200710102418_delete_user_callout_alerts_moved.rb
...igrate/20200710102418_delete_user_callout_alerts_moved.rb
+1
-1
ee/app/models/concerns/ee/enums/user_callout.rb
ee/app/models/concerns/ee/enums/user_callout.rb
+32
-0
ee/app/models/ee/user_callout_enums.rb
ee/app/models/ee/user_callout_enums.rb
+0
-30
No files found.
app/models/concerns/enums/user_callout.rb
0 → 100644
View file @
607fa30c
# frozen_string_literal: true
module
Enums
module
UserCallout
# Returns the `Hash` to use for the `feature_name` enum in the `UserCallout`
# model.
#
# This method is separate from the `UserCallout` model so that it can be
# extended by EE.
#
# If you are going to add new items to this hash, check that you're not going
# to conflict with EE-only values: https://gitlab.com/gitlab-org/gitlab/blob/master/ee/app/models/concerns/ee/enums/user_callout.rb
def
self
.
feature_names
{
gke_cluster_integration:
1
,
gcp_signup_offer:
2
,
cluster_security_warning:
3
,
suggest_popover_dismissed:
9
,
tabs_position_highlight:
10
,
webhooks_moved:
13
,
admin_integrations_moved:
15
,
personal_access_token_expiry:
21
# EE-only
}
end
end
end
Enums
::
UserCallout
.
prepend_if_ee
(
'EE::Enums::UserCallout'
)
app/models/user_callout.rb
View file @
607fa30c
...
@@ -3,9 +3,9 @@
...
@@ -3,9 +3,9 @@
class
UserCallout
<
ApplicationRecord
class
UserCallout
<
ApplicationRecord
belongs_to
:user
belongs_to
:user
# We use `
UserCalloutEnums
.feature_names` here so that EE can more easily
# We use `
Enums::UserCallout
.feature_names` here so that EE can more easily
# extend this `Hash` with new values.
# extend this `Hash` with new values.
enum
feature_name:
::
UserCalloutEnums
.
feature_names
enum
feature_name:
Enums
::
UserCallout
.
feature_names
validates
:user
,
presence:
true
validates
:user
,
presence:
true
validates
:feature_name
,
validates
:feature_name
,
...
...
app/models/user_callout_enums.rb
deleted
100644 → 0
View file @
cb5d8229
# frozen_string_literal: true
module
UserCalloutEnums
# Returns the `Hash` to use for the `feature_name` enum in the `UserCallout`
# model.
#
# This method is separate from the `UserCallout` model so that it can be
# extended by EE.
#
# If you are going to add new items to this hash, check that you're not going
# to conflict with EE-only values: https://gitlab.com/gitlab-org/gitlab/blob/master/ee/app/models/ee/user_callout_enums.rb
def
self
.
feature_names
{
gke_cluster_integration:
1
,
gcp_signup_offer:
2
,
cluster_security_warning:
3
,
suggest_popover_dismissed:
9
,
tabs_position_highlight:
10
,
webhooks_moved:
13
,
admin_integrations_moved:
15
,
personal_access_token_expiry:
21
# EE-only
}
end
end
UserCalloutEnums
.
prepend_if_ee
(
'EE::UserCalloutEnums'
)
db/post_migrate/20200710102418_delete_user_callout_alerts_moved.rb
View file @
607fa30c
...
@@ -13,7 +13,7 @@ class DeleteUserCalloutAlertsMoved < ActiveRecord::Migration[6.0]
...
@@ -13,7 +13,7 @@ class DeleteUserCalloutAlertsMoved < ActiveRecord::Migration[6.0]
BATCH_SIZE
=
1_000
BATCH_SIZE
=
1_000
# Inlined from
UserCalloutEnums
.feature_names
# Inlined from
Enums::UserCallout
.feature_names
FEATURE_NAME_ALERTS_MOVED
=
20
FEATURE_NAME_ALERTS_MOVED
=
20
def
up
def
up
...
...
ee/app/models/concerns/ee/enums/user_callout.rb
0 → 100644
View file @
607fa30c
# frozen_string_literal: true
module
EE
module
Enums
module
UserCallout
extend
ActiveSupport
::
Concern
class_methods
do
extend
::
Gitlab
::
Utils
::
Override
# If you are going to add new items to this hash, check that you're not going
# to conflict with FOSS-only values: https://gitlab.com/gitlab-org/gitlab/blob/master/app/models/concerns/enums/user_callout.rb
override
:feature_names
def
feature_names
super
.
merge
(
gold_trial:
4
,
geo_enable_hashed_storage:
5
,
geo_migrate_hashed_storage:
6
,
canary_deployment:
7
,
gold_trial_billings:
8
,
threat_monitoring_info:
11
,
account_recovery_regular_check:
12
,
users_over_license_banner:
16
,
standalone_vulnerabilities_introduction_banner:
17
,
active_user_count_threshold:
18
,
buy_pipeline_minutes_notification_dot:
19
)
end
end
end
end
end
ee/app/models/ee/user_callout_enums.rb
deleted
100644 → 0
View file @
cb5d8229
# frozen_string_literal: true
module
EE
module
UserCalloutEnums
extend
ActiveSupport
::
Concern
class_methods
do
extend
::
Gitlab
::
Utils
::
Override
# If you are going to add new items to this hash, check that you're not going
# to conflict with FOSS-only values: https://gitlab.com/gitlab-org/gitlab/blob/master/app/models/user_callout_enums.rb
override
:feature_names
def
feature_names
super
.
merge
(
gold_trial:
4
,
geo_enable_hashed_storage:
5
,
geo_migrate_hashed_storage:
6
,
canary_deployment:
7
,
gold_trial_billings:
8
,
threat_monitoring_info:
11
,
account_recovery_regular_check:
12
,
users_over_license_banner:
16
,
standalone_vulnerabilities_introduction_banner:
17
,
active_user_count_threshold:
18
,
buy_pipeline_minutes_notification_dot:
19
)
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