diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-16 03:06:12 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-16 03:06:12 +0000 |
commit | f155cc9034f2247c5d368f9b0212ad44248b0c5e (patch) | |
tree | 902480293b665d74a337aeae6a0521104f561988 /app | |
parent | c920712fab6abdc37de9444e6bbcd170c295b21a (diff) | |
download | gitlab-ce-f155cc9034f2247c5d368f9b0212ad44248b0c5e.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/blob_helper.rb | 8 | ||||
-rw-r--r-- | app/models/clusters/concerns/application_version.rb | 4 | ||||
-rw-r--r-- | app/models/concerns/prometheus_adapter.rb | 2 | ||||
-rw-r--r-- | app/models/note.rb | 2 | ||||
-rw-r--r-- | app/models/upload.rb | 2 | ||||
-rw-r--r-- | app/views/projects/tree/_tree_header.html.haml | 13 | ||||
-rw-r--r-- | app/views/shared/_confirm_fork_modal.html.haml | 12 |
7 files changed, 34 insertions, 9 deletions
diff --git a/app/helpers/blob_helper.rb b/app/helpers/blob_helper.rb index 6d1ec16b0c2..5c24b0e1704 100644 --- a/app/helpers/blob_helper.rb +++ b/app/helpers/blob_helper.rb @@ -32,6 +32,14 @@ module BlobHelper File.join(segments) end + def ide_fork_and_edit_path(project = @project, ref = @ref, path = @path, options = {}) + if current_user + project_forks_path(project, + namespace_key: current_user&.namespace&.id, + continue: edit_blob_fork_params(ide_edit_path(project, ref, path))) + end + end + def encode_ide_path(path) url_encode(path).gsub('%2F', '/') end diff --git a/app/models/clusters/concerns/application_version.rb b/app/models/clusters/concerns/application_version.rb index db94e8e08c9..6c0b014662c 100644 --- a/app/models/clusters/concerns/application_version.rb +++ b/app/models/clusters/concerns/application_version.rb @@ -8,13 +8,13 @@ module Clusters included do state_machine :status do before_transition any => [:installed, :updated] do |application| - application.version = application.class.const_get(:VERSION) + application.version = application.class.const_get(:VERSION, false) end end end def update_available? - version != self.class.const_get(:VERSION) + version != self.class.const_get(:VERSION, false) end end end diff --git a/app/models/concerns/prometheus_adapter.rb b/app/models/concerns/prometheus_adapter.rb index aab0589f7ca..9df77b565da 100644 --- a/app/models/concerns/prometheus_adapter.rb +++ b/app/models/concerns/prometheus_adapter.rb @@ -44,7 +44,7 @@ module PrometheusAdapter end def query_klass_for(query_name) - Gitlab::Prometheus::Queries.const_get("#{query_name.to_s.classify}Query") + Gitlab::Prometheus::Queries.const_get("#{query_name.to_s.classify}Query", false) end def build_query_args(*args) diff --git a/app/models/note.rb b/app/models/note.rb index 34736482387..4e9fd8d2dd1 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -24,7 +24,7 @@ class Note < ApplicationRecord class << self def values - constants.map {|const| self.const_get(const)} + constants.map {|const| self.const_get(const, false)} end def value?(val) diff --git a/app/models/upload.rb b/app/models/upload.rb index df8f9c56fa8..8c409641452 100644 --- a/app/models/upload.rb +++ b/app/models/upload.rb @@ -138,7 +138,7 @@ class Upload < ApplicationRecord end def uploader_class - Object.const_get(uploader) + Object.const_get(uploader, false) end def identifier diff --git a/app/views/projects/tree/_tree_header.html.haml b/app/views/projects/tree/_tree_header.html.haml index 41cd044a5b0..38422d4533d 100644 --- a/app/views/projects/tree/_tree_header.html.haml +++ b/app/views/projects/tree/_tree_header.html.haml @@ -41,7 +41,7 @@ %li = link_to '#modal-create-new-dir', { 'data-target' => '#modal-create-new-dir', 'data-toggle' => 'modal' } do #{ _('New directory') } - - elsif can?(current_user, :fork_project, @project) && can?(current_user, :create_merge_request_in, @project) + - elsif can_create_mr_from_fork %li - continue_params = { to: project_new_blob_path(@project, @id), notice: edit_in_new_fork_notice, @@ -81,10 +81,15 @@ = render 'projects/find_file_link' - - if can_collaborate + - if can_create_mr_from_fork = succeed " " do - = link_to ide_edit_path(@project, @ref, @path), class: 'btn btn-default qa-web-ide-button' do - = _('Web IDE') + - if can_collaborate || current_user&.already_forked?(@project) + = link_to ide_edit_path(@project, @ref, @path), class: 'btn btn-default qa-web-ide-button' do + = _('Web IDE') + - else + = link_to '#modal-confirm-fork', class: 'btn btn-default qa-web-ide-button', data: { target: '#modal-confirm-fork', toggle: 'modal'} do + = _('Web IDE') + = render 'shared/confirm_fork_modal', fork_path: ide_fork_and_edit_path(@project, @ref, @path) - if show_xcode_link?(@project) .project-action-button.project-xcode.inline diff --git a/app/views/shared/_confirm_fork_modal.html.haml b/app/views/shared/_confirm_fork_modal.html.haml new file mode 100644 index 00000000000..db50ea41387 --- /dev/null +++ b/app/views/shared/_confirm_fork_modal.html.haml @@ -0,0 +1,12 @@ +#modal-confirm-fork.modal.qa-confirm-fork-modal + .modal-dialog + .modal-content + .modal-header + %h3.page-title= _('Fork project?') + %button.close{ type: "button", "data-dismiss": "modal", "aria-label" => _('Close') } + %span{ "aria-hidden": true } × + .modal-body.p-3 + %p= _("You're not allowed to %{tag_start}edit%{tag_end} files in this project directly. Please fork this project, make your changes there, and submit a merge request.") % { tag_start: '', tag_end: ''} + .modal-footer + = link_to _('Cancel'), '#', class: "btn btn-cancel", "data-dismiss" => "modal" + = link_to _('Fork project'), fork_path, class: 'btn btn-success', method: :post |