Commit 4718847c authored by Robert Speicher's avatar Robert Speicher

Merge branch 'file_lock_improvements' into 'master'

Address review comments for !440

See merge request !486
parents 8f8101d7 9a686542
......@@ -4,6 +4,6 @@ module PathLocksHelper
end
def license_allows_file_locks?
::License.current && ::License.current.add_on?('GitLab_FileLocks')
@license_allows_file_locks ||= (::License.current && ::License.current.add_on?('GitLab_FileLocks'))
end
end
......@@ -12,7 +12,7 @@
- if path_lock_info
:plain
var label = $("<span>")
.attr('title', 'Locked by #{escape_javascript path_lock_info.user.name }')
.attr('title', 'Locked by #{escape_javascript path_lock_info.user.name}')
.attr('data-toggle', 'tooltip')
.addClass('fa fa-lock prepend-left-5');
row.find('td.tree-item-file-name').append(label);
......
# The database stores locked paths as following:
# 'app/models/project.rb' or 'lib/gitlab'
# To determine that 'lib/gitlab/some_class.rb' is locked we need to generate
# 'app/models/user.rb' or 'app/models'
# To determine that 'app/models/user.rb' is locked we need to generate
# tokens for every requested paths and check every token whether it exist in path locks table or not.
# So for 'lib/gitlab/some_class.rb' path we would need to search next paths:
# 'lib', 'lib/gitlab' and 'lib/gitlab/some_class.rb'
# This class also implements a memoization for common paths like 'lib' 'lib/gitlab', 'app', etc.
# So for 'app/models/user.rb' path we would need to search next paths:
# 'app', 'app/models' and 'app/models/user.rb'
# This class also implements a memoization for common paths like 'app' 'app/models', 'vendor', etc.
class Gitlab::PathLocksFinder
def initialize(project)
......
FactoryGirl.define do
factory :path_lock do
project
user { build :user }
user
sequence(:path) { |n| "app/model#{n}" }
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment