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
ae8d9d8d
Commit
ae8d9d8d
authored
Jul 06, 2017
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rationalise license codes
parent
691b0e8d
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
26 additions
and
26 deletions
+26
-26
app/controllers/projects/path_locks_controller.rb
app/controllers/projects/path_locks_controller.rb
+1
-1
app/controllers/projects/refs_controller.rb
app/controllers/projects/refs_controller.rb
+1
-1
app/helpers/tree_helper.rb
app/helpers/tree_helper.rb
+2
-2
app/models/license.rb
app/models/license.rb
+14
-14
app/views/projects/blob/_header.html.haml
app/views/projects/blob/_header.html.haml
+1
-1
app/views/projects/commits/_head.html.haml
app/views/projects/commits/_head.html.haml
+1
-1
app/views/projects/tree/_tree_content.html.haml
app/views/projects/tree/_tree_content.html.haml
+1
-1
lib/gitlab/checks/change_access.rb
lib/gitlab/checks/change_access.rb
+1
-1
spec/features/projects/path_locks_spec.rb
spec/features/projects/path_locks_spec.rb
+1
-1
spec/helpers/tree_helper_spec.rb
spec/helpers/tree_helper_spec.rb
+1
-1
spec/models/license_spec.rb
spec/models/license_spec.rb
+2
-2
No files found.
app/controllers/projects/path_locks_controller.rb
View file @
ae8d9d8d
...
@@ -45,7 +45,7 @@ class Projects::PathLocksController < Projects::ApplicationController
...
@@ -45,7 +45,7 @@ class Projects::PathLocksController < Projects::ApplicationController
private
private
def
check_license
def
check_license
unless
@project
.
feature_available?
(
:file_lock
)
unless
@project
.
feature_available?
(
:file_lock
s
)
flash
[
:alert
]
=
'You need a different license to enable FileLocks feature'
flash
[
:alert
]
=
'You need a different license to enable FileLocks feature'
redirect_to
admin_license_path
redirect_to
admin_license_path
end
end
...
...
app/controllers/projects/refs_controller.rb
View file @
ae8d9d8d
...
@@ -52,7 +52,7 @@ class Projects::RefsController < Projects::ApplicationController
...
@@ -52,7 +52,7 @@ class Projects::RefsController < Projects::ApplicationController
contents
.
push
(
*
tree
.
blobs
)
contents
.
push
(
*
tree
.
blobs
)
contents
.
push
(
*
tree
.
submodules
)
contents
.
push
(
*
tree
.
submodules
)
show_path_locks
=
@project
.
feature_available?
(
:file_lock
)
&&
@project
.
path_locks
.
any?
show_path_locks
=
@project
.
feature_available?
(
:file_lock
s
)
&&
@project
.
path_locks
.
any?
@logs
=
contents
[
@offset
,
@limit
].
to_a
.
map
do
|
content
|
@logs
=
contents
[
@offset
,
@limit
].
to_a
.
map
do
|
content
|
file
=
@path
?
File
.
join
(
@path
,
content
.
name
)
:
content
.
name
file
=
@path
?
File
.
join
(
@path
,
content
.
name
)
:
content
.
name
...
...
app/helpers/tree_helper.rb
View file @
ae8d9d8d
...
@@ -109,7 +109,7 @@ module TreeHelper
...
@@ -109,7 +109,7 @@ module TreeHelper
end
end
def
lock_file_link
(
project
=
@project
,
path
=
@path
,
html_options:
{})
def
lock_file_link
(
project
=
@project
,
path
=
@path
,
html_options:
{})
return
unless
project
.
feature_available?
(
:file_lock
)
&&
current_user
return
unless
project
.
feature_available?
(
:file_lock
s
)
&&
current_user
return
if
path
.
blank?
return
if
path
.
blank?
path_lock
=
project
.
find_path_lock
(
path
,
downstream:
true
)
path_lock
=
project
.
find_path_lock
(
path
,
downstream:
true
)
...
@@ -169,7 +169,7 @@ module TreeHelper
...
@@ -169,7 +169,7 @@ module TreeHelper
end
end
def
render_lock_icon
(
path
)
def
render_lock_icon
(
path
)
return
unless
@project
.
feature_available?
(
:file_lock
)
return
unless
@project
.
feature_available?
(
:file_lock
s
)
return
unless
@project
.
root_ref?
(
@ref
)
return
unless
@project
.
root_ref?
(
@ref
)
if
file_lock
=
@project
.
find_path_lock
(
path
,
exact_match:
true
)
if
file_lock
=
@project
.
find_path_lock
(
path
,
exact_match:
true
)
...
...
app/models/license.rb
View file @
ae8d9d8d
...
@@ -2,27 +2,27 @@ class License < ActiveRecord::Base
...
@@ -2,27 +2,27 @@ class License < ActiveRecord::Base
include
ActionView
::
Helpers
::
NumberHelper
include
ActionView
::
Helpers
::
NumberHelper
AUDITOR_USER_FEATURE
=
'GitLab_Auditor_User'
.
freeze
AUDITOR_USER_FEATURE
=
'GitLab_Auditor_User'
.
freeze
BURNDOWN_CHARTS_FEATURE
=
'BurndownCharts'
.
freeze
BURNDOWN_CHARTS_FEATURE
=
'
GitLab_
BurndownCharts'
.
freeze
CONTRIBUTION_ANALYTICS_FEATURE
=
'ContributionAnalytics'
.
freeze
CONTRIBUTION_ANALYTICS_FEATURE
=
'
GitLab_
ContributionAnalytics'
.
freeze
DEPLOY_BOARD_FEATURE
=
'GitLab_DeployBoard'
.
freeze
DEPLOY_BOARD_FEATURE
=
'GitLab_DeployBoard'
.
freeze
ELASTIC_SEARCH_FEATURE
=
'GitLab_ElasticSearch'
.
freeze
ELASTIC_SEARCH_FEATURE
=
'GitLab_ElasticSearch'
.
freeze
EXPORT_ISSUES_FEATURE
=
'GitLab_ExportIssues'
.
freeze
EXPORT_ISSUES_FEATURE
=
'GitLab_ExportIssues'
.
freeze
FAST_FORWARD_MERGE_FEATURE
=
'GitLab_FastForwardMerge'
.
freeze
FAST_FORWARD_MERGE_FEATURE
=
'GitLab_FastForwardMerge'
.
freeze
FILE_LOCK_FEATURE
=
'GitLab_FileLocks'
.
freeze
FILE_LOCK
S
_FEATURE
=
'GitLab_FileLocks'
.
freeze
GEO_FEATURE
=
'GitLab_Geo'
.
freeze
GEO_FEATURE
=
'GitLab_Geo'
.
freeze
GROUP_WEBHOOKS_FEATURE
=
'GroupWebhooks'
.
freeze
GROUP_WEBHOOKS_FEATURE
=
'G
itLab_G
roupWebhooks'
.
freeze
ISSUABLE_DEFAULT_TEMPLATES_FEATURE
=
'GitLab_IssuableDefaultTemplates'
.
freeze
ISSUABLE_DEFAULT_TEMPLATES_FEATURE
=
'GitLab_IssuableDefaultTemplates'
.
freeze
ISSUE_BOARD
S_FOCUS_MODE_FEATURE
=
'IssueBoards
FocusMode'
.
freeze
ISSUE_BOARD
_FOCUS_MODE_FEATURE
=
'GitLab_IssueBoard
FocusMode'
.
freeze
ISSUE_BOARD_MILESTONE_FEATURE
=
'IssueBoardMilestone'
.
freeze
ISSUE_BOARD_MILESTONE_FEATURE
=
'
GitLab_
IssueBoardMilestone'
.
freeze
ISSUE_WEIGHTS_FEATURE
=
'GitLab_IssueWeights'
.
freeze
ISSUE_WEIGHTS_FEATURE
=
'GitLab_IssueWeights'
.
freeze
MERGE_REQUEST_APPROVERS_FEATURE
=
'GitLab_MergeRequestApprovers'
.
freeze
MERGE_REQUEST_APPROVERS_FEATURE
=
'GitLab_MergeRequestApprovers'
.
freeze
MERGE_REQUEST_REBASE_FEATURE
=
'GitLab_MergeRequestRebase'
.
freeze
MERGE_REQUEST_REBASE_FEATURE
=
'GitLab_MergeRequestRebase'
.
freeze
MERGE_REQUEST_SQUASH_FEATURE
=
'GitLab_MergeRequestSquash'
.
freeze
MERGE_REQUEST_SQUASH_FEATURE
=
'GitLab_MergeRequestSquash'
.
freeze
OBJECT_STORAGE_FEATURE
=
'GitLab_ObjectStorage'
.
freeze
OBJECT_STORAGE_FEATURE
=
'GitLab_ObjectStorage'
.
freeze
PUSH_RULES_FEATURE
=
'GitLab_PushRules'
.
freeze
PUSH_RULES_FEATURE
=
'GitLab_PushRules'
.
freeze
RELATED_ISSUES_FEATURE
=
'RelatedIssues'
.
freeze
RELATED_ISSUES_FEATURE
=
'
GitLab_
RelatedIssues'
.
freeze
SERVICE_DESK_FEATURE
=
'GitLab_ServiceDesk'
.
freeze
SERVICE_DESK_FEATURE
=
'GitLab_ServiceDesk'
.
freeze
VARIABLE_ENVIRONMENT_SCOPE_FEATURE
=
'VariableEnvironmentScope'
.
freeze
VARIABLE_ENVIRONMENT_SCOPE_FEATURE
=
'
GitLab_
VariableEnvironmentScope'
.
freeze
FEATURE_CODES
=
{
FEATURE_CODES
=
{
auditor_user:
AUDITOR_USER_FEATURE
,
auditor_user:
AUDITOR_USER_FEATURE
,
...
@@ -39,10 +39,10 @@ class License < ActiveRecord::Base
...
@@ -39,10 +39,10 @@ class License < ActiveRecord::Base
deploy_board:
DEPLOY_BOARD_FEATURE
,
deploy_board:
DEPLOY_BOARD_FEATURE
,
export_issues:
EXPORT_ISSUES_FEATURE
,
export_issues:
EXPORT_ISSUES_FEATURE
,
fast_forward_merge:
FAST_FORWARD_MERGE_FEATURE
,
fast_forward_merge:
FAST_FORWARD_MERGE_FEATURE
,
file_lock
:
FILE_LOCK
_FEATURE
,
file_lock
s:
FILE_LOCKS
_FEATURE
,
group_webhooks:
GROUP_WEBHOOKS_FEATURE
,
group_webhooks:
GROUP_WEBHOOKS_FEATURE
,
issuable_default_templates:
ISSUABLE_DEFAULT_TEMPLATES_FEATURE
,
issuable_default_templates:
ISSUABLE_DEFAULT_TEMPLATES_FEATURE
,
issue_board_focus_mode:
ISSUE_BOARD
S
_FOCUS_MODE_FEATURE
,
issue_board_focus_mode:
ISSUE_BOARD_FOCUS_MODE_FEATURE
,
issue_board_milestone:
ISSUE_BOARD_MILESTONE_FEATURE
,
issue_board_milestone:
ISSUE_BOARD_MILESTONE_FEATURE
,
issue_weights:
ISSUE_WEIGHTS_FEATURE
,
issue_weights:
ISSUE_WEIGHTS_FEATURE
,
merge_request_approvers:
MERGE_REQUEST_APPROVERS_FEATURE
,
merge_request_approvers:
MERGE_REQUEST_APPROVERS_FEATURE
,
...
@@ -64,7 +64,7 @@ class License < ActiveRecord::Base
...
@@ -64,7 +64,7 @@ class License < ActiveRecord::Base
{
FAST_FORWARD_MERGE_FEATURE
=>
1
},
{
FAST_FORWARD_MERGE_FEATURE
=>
1
},
{
GROUP_WEBHOOKS_FEATURE
=>
1
},
{
GROUP_WEBHOOKS_FEATURE
=>
1
},
{
ISSUABLE_DEFAULT_TEMPLATES_FEATURE
=>
1
},
{
ISSUABLE_DEFAULT_TEMPLATES_FEATURE
=>
1
},
{
ISSUE_BOARD
S
_FOCUS_MODE_FEATURE
=>
1
},
{
ISSUE_BOARD_FOCUS_MODE_FEATURE
=>
1
},
{
ISSUE_BOARD_MILESTONE_FEATURE
=>
1
},
{
ISSUE_BOARD_MILESTONE_FEATURE
=>
1
},
{
ISSUE_WEIGHTS_FEATURE
=>
1
},
{
ISSUE_WEIGHTS_FEATURE
=>
1
},
{
MERGE_REQUEST_APPROVERS_FEATURE
=>
1
},
{
MERGE_REQUEST_APPROVERS_FEATURE
=>
1
},
...
@@ -78,7 +78,7 @@ class License < ActiveRecord::Base
...
@@ -78,7 +78,7 @@ class License < ActiveRecord::Base
*
EES_FEATURES
,
*
EES_FEATURES
,
{
AUDITOR_USER_FEATURE
=>
1
},
{
AUDITOR_USER_FEATURE
=>
1
},
{
DEPLOY_BOARD_FEATURE
=>
1
},
{
DEPLOY_BOARD_FEATURE
=>
1
},
{
FILE_LOCK_FEATURE
=>
1
},
{
FILE_LOCK
S
_FEATURE
=>
1
},
{
GEO_FEATURE
=>
1
},
{
GEO_FEATURE
=>
1
},
{
OBJECT_STORAGE_FEATURE
=>
1
},
{
OBJECT_STORAGE_FEATURE
=>
1
},
{
SERVICE_DESK_FEATURE
=>
1
},
{
SERVICE_DESK_FEATURE
=>
1
},
...
@@ -103,11 +103,11 @@ class License < ActiveRecord::Base
...
@@ -103,11 +103,11 @@ class License < ActiveRecord::Base
{
DEPLOY_BOARD_FEATURE
=>
1
},
{
DEPLOY_BOARD_FEATURE
=>
1
},
{
EXPORT_ISSUES_FEATURE
=>
1
},
{
EXPORT_ISSUES_FEATURE
=>
1
},
{
FAST_FORWARD_MERGE_FEATURE
=>
1
},
{
FAST_FORWARD_MERGE_FEATURE
=>
1
},
{
FILE_LOCK_FEATURE
=>
1
},
{
FILE_LOCK
S
_FEATURE
=>
1
},
{
GEO_FEATURE
=>
1
},
{
GEO_FEATURE
=>
1
},
{
GROUP_WEBHOOKS_FEATURE
=>
1
},
{
GROUP_WEBHOOKS_FEATURE
=>
1
},
{
ISSUABLE_DEFAULT_TEMPLATES_FEATURE
=>
1
},
{
ISSUABLE_DEFAULT_TEMPLATES_FEATURE
=>
1
},
{
ISSUE_BOARD
S
_FOCUS_MODE_FEATURE
=>
1
},
{
ISSUE_BOARD_FOCUS_MODE_FEATURE
=>
1
},
{
ISSUE_BOARD_MILESTONE_FEATURE
=>
1
},
{
ISSUE_BOARD_MILESTONE_FEATURE
=>
1
},
{
ISSUE_WEIGHTS_FEATURE
=>
1
},
{
ISSUE_WEIGHTS_FEATURE
=>
1
},
{
MERGE_REQUEST_APPROVERS_FEATURE
=>
1
},
{
MERGE_REQUEST_APPROVERS_FEATURE
=>
1
},
...
...
app/views/projects/blob/_header.html.haml
View file @
ae8d9d8d
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
=
render
'projects/fork_suggestion'
=
render
'projects/fork_suggestion'
-
if
@project
.
feature_available?
(
:file_lock
)
-
if
@project
.
feature_available?
(
:file_lock
s
)
:javascript
:javascript
PathLocks
.
init
(
PathLocks
.
init
(
'
#{
toggle_project_path_locks_path
(
@project
)
}
'
,
'
#{
toggle_project_path_locks_path
(
@project
)
}
'
,
...
...
app/views/projects/commits/_head.html.haml
View file @
ae8d9d8d
...
@@ -35,7 +35,7 @@
...
@@ -35,7 +35,7 @@
=
link_to
charts_project_graph_path
(
@project
,
current_ref
)
do
=
link_to
charts_project_graph_path
(
@project
,
current_ref
)
do
#{
_
(
'Charts'
)
}
#{
_
(
'Charts'
)
}
-
if
@project
.
feature_available?
(
:file_lock
)
-
if
@project
.
feature_available?
(
:file_lock
s
)
=
nav_link
(
controller:
[
:path_locks
])
do
=
nav_link
(
controller:
[
:path_locks
])
do
=
link_to
project_path_locks_path
(
@project
)
do
=
link_to
project_path_locks_path
(
@project
)
do
Locked Files
Locked Files
app/views/projects/tree/_tree_content.html.haml
View file @
ae8d9d8d
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
=
render
'projects/blob/upload'
,
title:
_
(
'Upload New File'
),
placeholder:
_
(
'Upload New File'
),
button_title:
_
(
'Upload file'
),
form_path:
project_create_blob_path
(
@project
,
@id
),
method: :post
=
render
'projects/blob/upload'
,
title:
_
(
'Upload New File'
),
placeholder:
_
(
'Upload New File'
),
button_title:
_
(
'Upload file'
),
form_path:
project_create_blob_path
(
@project
,
@id
),
method: :post
=
render
'projects/blob/new_dir'
=
render
'projects/blob/new_dir'
-
if
@project
.
feature_available?
(
:file_lock
)
-
if
@project
.
feature_available?
(
:file_lock
s
)
:javascript
:javascript
PathLocks
.
init
(
PathLocks
.
init
(
'
#{
toggle_project_path_locks_path
(
@project
)
}
'
,
'
#{
toggle_project_path_locks_path
(
@project
)
}
'
,
...
...
lib/gitlab/checks/change_access.rb
View file @
ae8d9d8d
...
@@ -248,7 +248,7 @@ module Gitlab
...
@@ -248,7 +248,7 @@ module Gitlab
end
end
def
validate_path_locks?
def
validate_path_locks?
@validate_path_locks
||=
@project
.
feature_available?
(
:file_lock
)
&&
@validate_path_locks
||=
@project
.
feature_available?
(
:file_lock
s
)
&&
project
.
path_locks
.
any?
&&
@newrev
&&
@oldrev
&&
project
.
path_locks
.
any?
&&
@newrev
&&
@oldrev
&&
project
.
default_branch
==
@branch_name
# locks protect default branch only
project
.
default_branch
==
@branch_name
# locks protect default branch only
end
end
...
...
spec/features/projects/path_locks_spec.rb
View file @
ae8d9d8d
...
@@ -6,7 +6,7 @@ feature 'Path Locks', feature: true, js: true do
...
@@ -6,7 +6,7 @@ feature 'Path Locks', feature: true, js: true do
let
(
:tree_path
)
{
project_tree_path
(
project
,
project
.
repository
.
root_ref
)
}
let
(
:tree_path
)
{
project_tree_path
(
project
,
project
.
repository
.
root_ref
)
}
before
do
before
do
allow
(
project
).
to
receive
(
:feature_available?
).
with
(
:file_lock
)
{
true
}
allow
(
project
).
to
receive
(
:feature_available?
).
with
(
:file_lock
s
)
{
true
}
project
.
team
<<
[
user
,
:master
]
project
.
team
<<
[
user
,
:master
]
gitlab_sign_in
(
user
)
gitlab_sign_in
(
user
)
...
...
spec/helpers/tree_helper_spec.rb
View file @
ae8d9d8d
...
@@ -35,7 +35,7 @@ describe TreeHelper do
...
@@ -35,7 +35,7 @@ describe TreeHelper do
before
do
before
do
allow
(
helper
).
to
receive
(
:can?
).
and_return
(
true
)
allow
(
helper
).
to
receive
(
:can?
).
and_return
(
true
)
allow
(
helper
).
to
receive
(
:current_user
).
and_return
(
user
)
allow
(
helper
).
to
receive
(
:current_user
).
and_return
(
user
)
allow
(
project
).
to
receive
(
:feature_available?
).
with
(
:file_lock
)
{
true
}
allow
(
project
).
to
receive
(
:feature_available?
).
with
(
:file_lock
s
)
{
true
}
project
.
reload
project
.
reload
end
end
...
...
spec/models/license_spec.rb
View file @
ae8d9d8d
...
@@ -389,9 +389,9 @@ describe License do
...
@@ -389,9 +389,9 @@ describe License do
context
'with add-ons'
do
context
'with add-ons'
do
it
'returns all available add-ons'
do
it
'returns all available add-ons'
do
license
=
build_license_with_add_ons
({
License
::
DEPLOY_BOARD_FEATURE
=>
1
,
License
::
FILE_LOCK_FEATURE
=>
2
})
license
=
build_license_with_add_ons
({
License
::
DEPLOY_BOARD_FEATURE
=>
1
,
License
::
FILE_LOCK
S
_FEATURE
=>
2
})
expect
(
license
.
add_ons
.
keys
).
to
include
(
License
::
DEPLOY_BOARD_FEATURE
,
License
::
FILE_LOCK_FEATURE
)
expect
(
license
.
add_ons
.
keys
).
to
include
(
License
::
DEPLOY_BOARD_FEATURE
,
License
::
FILE_LOCK
S
_FEATURE
)
end
end
it
'can return details about a single add-on'
do
it
'can return details about a single add-on'
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