diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-03 15:09:52 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-03 15:09:52 +0300 |
commit | 546ddc3f6ac96fdf09934390a938bb391d07dc94 (patch) | |
tree | d0c92fca27ee76b5a20b7bfb56bda6f057424127 /app | |
parent | 04baa85554ff13bdd4d6f4e6bb24119d17608fee (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/snippets/components/snippet_header.vue | 38 | ||||
-rw-r--r-- | app/models/audit_event.rb | 16 | ||||
-rw-r--r-- | app/services/audit_event_service.rb | 10 | ||||
-rw-r--r-- | app/services/groups/deploy_tokens/create_service.rb | 2 | ||||
-rw-r--r-- | app/services/projects/deploy_tokens/create_service.rb | 2 | ||||
-rw-r--r-- | app/views/admin/application_settings/_repository_storage.html.haml | 6 |
6 files changed, 48 insertions, 26 deletions
diff --git a/app/assets/javascripts/snippets/components/snippet_header.vue b/app/assets/javascripts/snippets/components/snippet_header.vue index c280096b2bf..79b191cb25a 100644 --- a/app/assets/javascripts/snippets/components/snippet_header.vue +++ b/app/assets/javascripts/snippets/components/snippet_header.vue @@ -4,12 +4,12 @@ import { GlAvatar, GlIcon, GlSprintf, - GlDeprecatedButton, GlModal, GlAlert, GlLoadingIcon, GlDropdown, GlDropdownItem, + GlNewButton, } from '@gitlab/ui'; import TimeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue'; @@ -22,13 +22,13 @@ export default { GlAvatar, GlIcon, GlSprintf, - GlDeprecatedButton, GlModal, GlAlert, GlLoadingIcon, GlDropdown, GlDropdownItem, TimeAgoTooltip, + GlNewButton, }, apollo: { canCreateSnippet: { @@ -67,17 +67,14 @@ export default { condition: this.snippet.userPermissions.updateSnippet, text: __('Edit'), href: this.editLink, - click: undefined, - variant: 'outline-info', - cssClass: undefined, }, { condition: this.snippet.userPermissions.adminSnippet, text: __('Delete'), - href: undefined, click: this.showDeleteModal, - variant: 'outline-danger', - cssClass: 'btn-inverted btn-danger ml-2', + variant: 'danger', + category: 'secondary', + cssClass: 'ml-2', }, { condition: this.canCreateSnippet, @@ -85,9 +82,9 @@ export default { href: this.snippet.project ? `${this.snippet.project.webUrl}/snippets/new` : '/snippets/new', - click: undefined, - variant: 'outline-success', - cssClass: 'btn-inverted btn-success ml-2', + variant: 'success', + category: 'secondary', + cssClass: 'ml-2', }, ]; }, @@ -187,18 +184,20 @@ export default { </div> <div class="detail-page-header-actions"> - <div class="d-none d-sm-block"> + <div class="d-none d-sm-flex"> <template v-for="(action, index) in personalSnippetActions"> - <gl-deprecated-button + <gl-new-button v-if="action.condition" :key="index" + :disabled="action.disabled" :variant="action.variant" + :category="action.category" :class="action.cssClass" - :href="action.href || undefined" + :href="action.href" @click="action.click ? action.click() : undefined" > {{ action.text }} - </gl-deprecated-button> + </gl-new-button> </template> </div> <div class="d-block d-sm-none dropdown"> @@ -206,7 +205,7 @@ export default { <gl-dropdown-item v-for="(action, index) in personalSnippetActions" :key="index" - :href="action.href || undefined" + :href="action.href" @click="action.click ? action.click() : undefined" >{{ action.text }}</gl-dropdown-item > @@ -228,16 +227,17 @@ export default { </gl-sprintf> <template #modal-footer> - <gl-deprecated-button @click="closeDeleteModal">{{ __('Cancel') }}</gl-deprecated-button> - <gl-deprecated-button + <gl-new-button @click="closeDeleteModal">{{ __('Cancel') }}</gl-new-button> + <gl-new-button variant="danger" + category="primary" :disabled="isDeleting" data-qa-selector="delete_snippet_button" @click="deleteSnippet" > <gl-loading-icon v-if="isDeleting" inline /> {{ __('Delete snippet') }} - </gl-deprecated-button> + </gl-new-button> </template> </gl-modal> </div> diff --git a/app/models/audit_event.rb b/app/models/audit_event.rb index 03841917bbf..7ff0076c3e3 100644 --- a/app/models/audit_event.rb +++ b/app/models/audit_event.rb @@ -30,12 +30,26 @@ class AuditEvent < ApplicationRecord end def author_name - self.user.name + lazy_author.name end def formatted_details details.merge(details.slice(:from, :to).transform_values(&:to_s)) end + + def lazy_author + BatchLoader.for(author_id).batch(default_value: default_author_value) do |author_ids, loader| + User.where(id: author_ids).find_each do |user| + loader.call(user.id, user) + end + end + end + + private + + def default_author_value + ::Gitlab::Audit::NullAuthor.for(author_id, details[:author_name]) + end end AuditEvent.prepend_if_ee('EE::AuditEvent') diff --git a/app/services/audit_event_service.rb b/app/services/audit_event_service.rb index 42ed5f17d8d..d9e40c456aa 100644 --- a/app/services/audit_event_service.rb +++ b/app/services/audit_event_service.rb @@ -13,7 +13,7 @@ class AuditEventService # # @return [AuditEventService] def initialize(author, entity, details = {}) - @author = author + @author = build_author(author) @entity = entity @details = details end @@ -49,6 +49,14 @@ class AuditEventService private + def build_author(author) + if author.is_a?(User) + author + else + Gitlab::Audit::UnauthenticatedAuthor.new(name: author) + end + end + def base_payload { author_id: @author.id, diff --git a/app/services/groups/deploy_tokens/create_service.rb b/app/services/groups/deploy_tokens/create_service.rb index d747dabcd3c..81f761eb61d 100644 --- a/app/services/groups/deploy_tokens/create_service.rb +++ b/app/services/groups/deploy_tokens/create_service.rb @@ -9,7 +9,7 @@ module Groups deploy_token = create_deploy_token_for(@group, params) if deploy_token.persisted? - success(deploy_token: deploy_token, http_status: :ok) + success(deploy_token: deploy_token, http_status: :created) else error(deploy_token.errors.full_messages.to_sentence, :bad_request) end diff --git a/app/services/projects/deploy_tokens/create_service.rb b/app/services/projects/deploy_tokens/create_service.rb index e943b2489ac..2e71650b066 100644 --- a/app/services/projects/deploy_tokens/create_service.rb +++ b/app/services/projects/deploy_tokens/create_service.rb @@ -9,7 +9,7 @@ module Projects deploy_token = create_deploy_token_for(@project, params) if deploy_token.persisted? - success(deploy_token: deploy_token, http_status: :ok) + success(deploy_token: deploy_token, http_status: :created) else error(deploy_token.errors.full_messages.to_sentence, :bad_request) end diff --git a/app/views/admin/application_settings/_repository_storage.html.haml b/app/views/admin/application_settings/_repository_storage.html.haml index b97e9a194f3..c3ae39ddd48 100644 --- a/app/views/admin/application_settings/_repository_storage.html.haml +++ b/app/views/admin/application_settings/_repository_storage.html.haml @@ -9,13 +9,13 @@ = f.check_box :hashed_storage_enabled, class: 'form-check-input qa-hashed-storage-checkbox' = f.label :hashed_storage_enabled, _("Use hashed storage"), class: 'label-bold form-check-label' .form-text.text-muted - = _("Use hashed storage paths for newly created and renamed projects. Enable immutable, hash-based paths and repository names to store repositories on disk. This prevents repositories from having to be moved or renamed when the Project URL changes and may improve disk I/O performance.") + = _("Use hashed storage paths for newly created and renamed repositories. Enable immutable, hash-based paths and repository names to store repositories on disk. This prevents repositories from having to be moved or renamed when the Repository URL changes and may improve disk I/O performance.") .sub-section - %h4= _("Storage nodes for new projects") + %h4= _("Storage nodes for new repositories") .form-group .form-text %p.text-secondary - = _('Select the configured storaged available for new projects to be placed on.') + = _('Select the configured storage available for new repositories to be placed on.') = link_to icon('question-circle'), help_page_path('administration/repository_storage_paths') .form-check = f.collection_check_boxes :repository_storages, Gitlab.config.repositories.storages, :first, :first, include_hidden: false do |b| |