Commit 726914c2 authored by Rémy Coutable's avatar Rémy Coutable

Reduce complexity of TreeHelper#lock_file_link

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 23629867
...@@ -139,6 +139,11 @@ module TreeHelper ...@@ -139,6 +139,11 @@ module TreeHelper
end end
end end
else else
_lock_link(current_user: current_user, project: project, html_options: {})
end
end
def _lock_link(current_user: current_user, project: project, html_options: {})
if can?(current_user, :push_code, project) if can?(current_user, :push_code, project)
html_options[:data] = { state: :lock } html_options[:data] = { state: :lock }
enabled_lock_link("Lock", '', html_options) enabled_lock_link("Lock", '', html_options)
...@@ -146,7 +151,6 @@ module TreeHelper ...@@ -146,7 +151,6 @@ module TreeHelper
disabled_lock_link("Lock", "You do not have permission to lock this", html_options) disabled_lock_link("Lock", "You do not have permission to lock this", html_options)
end end
end end
end
def disabled_lock_link(label, title, html_options) def disabled_lock_link(label, title, html_options)
html_options['data-toggle'] = 'tooltip' html_options['data-toggle'] = 'tooltip'
......
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