Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaco Guzman <pacoguzmanp@gmail.com>2016-08-17 18:05:00 +0300
committerPaco Guzman <pacoguzmanp@gmail.com>2016-08-18 17:30:25 +0300
commit938f3b2a0b4bdf2047caf8735312c80e2291b274 (patch)
tree583dcadb643a9e9a0dd4864f7779166d9af9ccc2 /app/helpers/blob_helper.rb
parentac73de508e21af95b473bfafc2ca2543b234430d (diff)
edit_blob_link can receive the blob to avoid access to the repository
Diffstat (limited to 'app/helpers/blob_helper.rb')
-rw-r--r--app/helpers/blob_helper.rb9
1 files changed, 3 insertions, 6 deletions
diff --git a/app/helpers/blob_helper.rb b/app/helpers/blob_helper.rb
index 1cb5d847626..9ea03720c1e 100644
--- a/app/helpers/blob_helper.rb
+++ b/app/helpers/blob_helper.rb
@@ -11,17 +11,14 @@ module BlobHelper
def edit_blob_link(project = @project, ref = @ref, path = @path, options = {})
return unless current_user
- blob = project.repository.blob_at(ref, path) rescue nil
+ blob = options.delete(:blob)
+ blob ||= project.repository.blob_at(ref, path) rescue nil
return unless blob
- from_mr = options[:from_merge_request_id]
- link_opts = {}
- link_opts[:from_merge_request_id] = from_mr if from_mr
-
edit_path = namespace_project_edit_blob_path(project.namespace, project,
tree_join(ref, path),
- link_opts)
+ options[:link_opts])
if !on_top_of_branch?(project, ref)
button_tag "Edit", class: "btn disabled has-tooltip btn-file-option", title: "You can only edit files when you are on a branch", data: { container: 'body' }