From 4db74ea1477fe70d132bf75f1bf3f1a728fc72e4 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Mon, 14 Feb 2022 18:13:23 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- .rubocop.yml | 6 + .../upload_dropzone/upload_dropzone.vue | 37 ++++- app/models/container_repository.rb | 37 +++-- .../projects/usage_quotas/index.html.haml | 11 +- .../migration/enqueuer_worker.rb | 2 +- doc/administration/docs_self_host.md | 120 +++++++-------- doc/administration/incoming_email.md | 14 +- .../reference_architectures/index.md | 1 + doc/administration/server_hooks.md | 6 +- .../documentation/styleguide/word_list.md | 8 + doc/install/installation.md | 3 +- doc/user/admin_area/license.md | 6 +- doc/user/project/merge_requests/index.md | 1 + .../project/repository/branches/default.md | 4 +- .../project/repository/forking_workflow.md | 36 +---- doc/user/project/service_desk.md | 7 + lib/container_registry/gitlab_api_client.rb | 5 + locale/gitlab.pot | 15 ++ rubocop/cop/gitlab/event_store_subscriber.rb | 71 +++++++++ .../upload_dropzone_spec.js.snap | 7 + .../upload_dropzone/upload_dropzone_spec.js | 57 +++++++ .../gitlab_api_client_spec.rb | 32 +++- spec/models/container_repository_spec.rb | 140 +++++++++++++----- .../cop/gitlab/event_store_subscriber_spec.rb | 82 ++++++++++ spec/support/cross_database_modification.rb | 9 ++ .../migration/enqueuer_worker_spec.rb | 1 + 26 files changed, 568 insertions(+), 150 deletions(-) create mode 100644 rubocop/cop/gitlab/event_store_subscriber.rb create mode 100644 spec/rubocop/cop/gitlab/event_store_subscriber_spec.rb create mode 100644 spec/support/cross_database_modification.rb diff --git a/.rubocop.yml b/.rubocop.yml index 1b2e7ea470a..8416653d677 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -291,6 +291,12 @@ Gitlab/AvoidUploadedFileFromParams: - 'spec/**/*' - 'ee/spec/**/*' +Gitlab/EventStoreSubscriber: + Enabled: true + Exclude: + - 'spec/**/*' + - 'ee/spec/**/*' + GitlabSecurity/PublicSend: Enabled: true Exclude: diff --git a/app/assets/javascripts/vue_shared/components/upload_dropzone/upload_dropzone.vue b/app/assets/javascripts/vue_shared/components/upload_dropzone/upload_dropzone.vue index 0a7a22ed3a8..62de76e46b5 100644 --- a/app/assets/javascripts/vue_shared/components/upload_dropzone/upload_dropzone.vue +++ b/app/assets/javascripts/vue_shared/components/upload_dropzone/upload_dropzone.vue @@ -41,6 +41,16 @@ export default { required: false, default: false, }, + inputFieldName: { + type: String, + required: false, + default: 'upload_file', + }, + shouldUpdateInputOnFileDrop: { + type: Boolean, + required: false, + default: false, + }, }, data() { return { @@ -84,6 +94,30 @@ export default { return; } + // NOTE: This is a temporary solution to integrate dropzone into a Rails + // form. On file drop if `shouldUpdateInputOnFileDrop` is true, the file + // input value is updated. So that when the form is submitted — the file + // value would be send together with the form data. This solution should + // be removed when License file upload page is fully migrated: + // https://gitlab.com/gitlab-org/gitlab/-/issues/352501 + // NOTE: as per https://caniuse.com/mdn-api_htmlinputelement_files, IE11 + // is not able to set input.files property, thought the user would still + // be able to use the file picker dialogue option, by clicking the + // "openFileUpload" button + if (this.shouldUpdateInputOnFileDrop) { + // Since FileList cannot be easily manipulated, to match requirement of + // singleFileSelection, we're throwing an error if multiple files were + // dropped on the dropzone + // NOTE: we can drop this logic together with + // `shouldUpdateInputOnFileDrop` flag + if (this.singleFileSelection && files.length > 1) { + this.$emit('error'); + return; + } + + this.$refs.fileUpload.files = files; + } + this.$emit('change', this.singleFileSelection ? files[0] : files); }, ondragenter(e) { @@ -116,6 +150,7 @@ export default {