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
918d9b5c
Commit
918d9b5c
authored
Oct 02, 2018
by
Kamil Trzciński
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename access token to instances
parent
e7e66184
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
8 deletions
+14
-8
ee/app/helpers/feature_flags_helper.rb
ee/app/helpers/feature_flags_helper.rb
+2
-2
ee/app/models/ee/project.rb
ee/app/models/ee/project.rb
+4
-3
ee/app/models/operations/feature_flags_instance.rb
ee/app/models/operations/feature_flags_instance.rb
+2
-2
ee/spec/factories/operations/feature_flags_instances.rb
ee/spec/factories/operations/feature_flags_instances.rb
+5
-0
ee/spec/models/project_spec.rb
ee/spec/models/project_spec.rb
+1
-1
No files found.
ee/app/helpers/feature_flags_helper.rb
View file @
918d9b5c
...
...
@@ -2,10 +2,10 @@
module
FeatureFlagsHelper
def
unleash_api_url
(
project
)
"
#{
root_url
(
only_path:
false
)
}
api/v4/feature_flags/
projects/
#{
project
.
id
}
/unleash
"
"
#{
root_url
(
only_path:
false
)
}
api/v4/feature_flags/
unleash/
#{
project
.
id
}
"
end
def
unleash_api_instanceid
(
project
)
project
.
feature_flag_
access
_token
project
.
feature_flag_
instance
_token
end
end
ee/app/models/ee/project.rb
View file @
918d9b5c
...
...
@@ -51,7 +51,7 @@ module EE
has_many
:prometheus_alert_events
,
inverse_of: :project
has_many
:operations_feature_flags
,
class_name:
'Operations::FeatureFlag'
has_one
:operations_feature_flags_
access_token
,
class_name:
'Operations::FeatureFlagsAccessToken
'
has_one
:operations_feature_flags_
instance
,
class_name:
'Operations::FeatureFlagsInstance
'
scope
:with_shared_runners_limit_enabled
,
->
{
with_shared_runners
.
non_public_only
}
...
...
@@ -562,8 +562,9 @@ module EE
change_head
(
root_ref
)
if
root_ref
.
present?
&&
root_ref
!=
default_branch
end
def
feature_flag_access_token
(
operations_feature_flags_access_token
||
create_operations_feature_flags_access_token!
).
token
def
feature_flags_instance_token
instance
=
operations_feature_flags_instance
||
create_operations_feature_flags_instance!
instance
.
token
end
private
...
...
ee/app/models/operations/feature_flags_
access_token
.rb
→
ee/app/models/operations/feature_flags_
instance
.rb
View file @
918d9b5c
module
Operations
class
FeatureFlags
AccessToken
<
ActiveRecord
::
Base
class
FeatureFlags
Instance
<
ActiveRecord
::
Base
include
TokenAuthenticatable
self
.
table_name
=
'operations_feature_flags_
access_token
s'
self
.
table_name
=
'operations_feature_flags_
instance
s'
belongs_to
:project
...
...
ee/spec/factories/operations/feature_flags_
access_token
s.rb
→
ee/spec/factories/operations/feature_flags_
instance
s.rb
View file @
918d9b5c
FactoryBot
.
define
do
factory
:operations_feature_flags_
access_token
,
class:
Operations
::
FeatureFlagsAccessToken
do
factory
:operations_feature_flags_
instance
,
class:
Operations
::
FeatureFlagsInstance
do
project
end
end
ee/spec/models/project_spec.rb
View file @
918d9b5c
...
...
@@ -1780,7 +1780,7 @@ describe Project do
end
context
'when there is access token'
do
let!
(
:
access_token
)
{
create
(
:operations_feature_flags_access_token
,
project:
project
,
token:
'token'
)
}
let!
(
:
instance
)
{
create
(
:operations_feature_flags_instance
,
project:
project
,
token:
'token'
)
}
it
"provides an existing one"
do
is_expected
.
to
eq
(
'token'
)
...
...
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