diff options
author | Paco Guzman <pacoguzmanp@gmail.com> | 2016-08-17 17:05:00 +0200 |
---|---|---|
committer | Paco Guzman <pacoguzmanp@gmail.com> | 2016-08-18 16:30:25 +0200 |
commit | 938f3b2a0b4bdf2047caf8735312c80e2291b274 (patch) | |
tree | 583dcadb643a9e9a0dd4864f7779166d9af9ccc2 /app/helpers/blob_helper.rb | |
parent | ac73de508e21af95b473bfafc2ca2543b234430d (diff) | |
download | gitlab-ce-938f3b2a0b4bdf2047caf8735312c80e2291b274.tar.gz |
edit_blob_link can receive the blob to avoid access to the repository20454-edit-button-mr
Diffstat (limited to 'app/helpers/blob_helper.rb')
-rw-r--r-- | app/helpers/blob_helper.rb | 9 |
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' } |