diff options
author | Sean McGivern <sean@gitlab.com> | 2019-07-12 19:30:31 +0300 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2019-07-12 19:30:31 +0300 |
commit | d8e642dece583aa1856a0476edfcc35cdef786ed (patch) | |
tree | a4132b8b68aa97956fc0a324a5c736531274252c /app | |
parent | f69232d506f82434e8b180e776c5b377fd461559 (diff) | |
parent | 60a6074dc977a72e00043596623094e006c84704 (diff) |
Merge branch '51952-redirect-to-webide-in-fork' into 'master'
Open WebIDE in fork when user doesn't have access
See merge request gitlab-org/gitlab-ce!30642
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/blob_helper.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/app/helpers/blob_helper.rb b/app/helpers/blob_helper.rb index 0d6a6496993..4b0713001a1 100644 --- a/app/helpers/blob_helper.rb +++ b/app/helpers/blob_helper.rb @@ -18,7 +18,16 @@ module BlobHelper end def ide_edit_path(project = @project, ref = @ref, path = @path, options = {}) - segments = [ide_path, 'project', project.full_path, 'edit', ref] + project_path = + if !current_user || can?(current_user, :push_code, project) + project.full_path + else + # We currently always fork to the user's namespace + # in edit_fork_button_tag + "#{current_user.namespace.full_path}/#{project.path}" + end + + segments = [ide_path, 'project', project_path, 'edit', ref] segments.concat(['-', encode_ide_path(path)]) if path.present? File.join(segments) end |