diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-30 12:09:48 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-30 12:09:48 +0000 |
commit | 96ee4961ce1984902f738ab651b99d2a1f01a65c (patch) | |
tree | 4add0def83c37189b44a15b203357303bba20582 /app | |
parent | 4ac9f1b8eaef29daa484b27a3113505cfa6a6dcb (diff) | |
download | gitlab-ce-96ee4961ce1984902f738ab651b99d2a1f01a65c.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
32 files changed, 56 insertions, 50 deletions
diff --git a/app/assets/javascripts/popovers/components/popovers.vue b/app/assets/javascripts/popovers/components/popovers.vue index 05a209a97ad..a758503b56b 100644 --- a/app/assets/javascripts/popovers/components/popovers.vue +++ b/app/assets/javascripts/popovers/components/popovers.vue @@ -1,11 +1,5 @@ <script> -// We can't use v-safe-html here as the popover's title or content might contains SVGs that would -// be stripped by the directive's sanitizer. Instead, we fallback on v-html and we use GitLab's -// dompurify config that lets SVGs be rendered properly. -// Context: https://gitlab.com/gitlab-org/gitlab/-/issues/247207 -/* eslint-disable vue/no-v-html */ -import { GlPopover } from '@gitlab/ui'; -import { sanitize } from '~/lib/dompurify'; +import { GlPopover, GlSafeHtmlDirective } from '@gitlab/ui'; const newPopover = (element) => { const { content, html, placement, title, triggers = 'focus' } = element.dataset; @@ -24,6 +18,9 @@ export default { components: { GlPopover, }, + directives: { + SafeHtml: GlSafeHtmlDirective, + }, data() { return { popovers: [], @@ -71,9 +68,9 @@ export default { popoverExists(element) { return this.popovers.some((popover) => popover.target === element); }, - getSafeHtml(html) { - return sanitize(html); - }, + }, + safeHtmlConfig: { + ADD_TAGS: ['use'], // to support icon SVGs }, }; </script> @@ -82,10 +79,10 @@ export default { <div> <gl-popover v-for="(popover, index) in popovers" :key="index" v-bind="popover"> <template #title> - <span v-if="popover.html" v-html="getSafeHtml(popover.title)"></span> + <span v-if="popover.html" v-safe-html:[$options.safeHtmlConfig]="popover.title"></span> <span v-else>{{ popover.title }}</span> </template> - <span v-if="popover.html" v-html="getSafeHtml(popover.content)"></span> + <span v-if="popover.html" v-safe-html:[$options.safeHtmlConfig]="popover.content"></span> <span v-else>{{ popover.content }}</span> </gl-popover> </div> diff --git a/app/models/error_tracking/error.rb b/app/models/error_tracking/error.rb index 32932c4d045..49c247657b6 100644 --- a/app/models/error_tracking/error.rb +++ b/app/models/error_tracking/error.rb @@ -22,11 +22,15 @@ class ErrorTracking::Error < ApplicationRecord def self.report_error(name:, description:, actor:, platform:, timestamp:) safe_find_or_create_by( name: name, - description: description, actor: actor, platform: platform - ) do |error| - error.update!(last_seen_at: timestamp) + ).tap do |error| + error.update!( + # Description can contain object id, so it can't be + # used as a group criteria for similar errors. + description: description, + last_seen_at: timestamp + ) end end diff --git a/app/models/protected_branch.rb b/app/models/protected_branch.rb index 3df8fe31826..3d32144e0f8 100644 --- a/app/models/protected_branch.rb +++ b/app/models/protected_branch.rb @@ -26,7 +26,9 @@ class ProtectedBranch < ApplicationRecord def self.protected?(project, ref_name) return true if project.empty_repo? && project.default_branch_protected? - self.matching(ref_name, protected_refs: protected_refs(project)).present? + Rails.cache.fetch("protected_ref-#{ref_name}-#{project.cache_key}") do + self.matching(ref_name, protected_refs: protected_refs(project)).present? + end end def self.allow_force_push?(project, ref_name) diff --git a/app/services/error_tracking/collect_error_service.rb b/app/services/error_tracking/collect_error_service.rb index bc1f238d81f..d9ba7ade6bd 100644 --- a/app/services/error_tracking/collect_error_service.rb +++ b/app/services/error_tracking/collect_error_service.rb @@ -18,7 +18,7 @@ module ErrorTracking # Together with occured_at these are 2 main attributes that we need to save here. error.events.create!( environment: event['environment'], - description: exception['type'], + description: exception['value'], level: event['level'], occurred_at: event['timestamp'], payload: event diff --git a/app/services/issues/base_service.rb b/app/services/issues/base_service.rb index 5e0a86fdeee..525447e1377 100644 --- a/app/services/issues/base_service.rb +++ b/app/services/issues/base_service.rb @@ -84,7 +84,8 @@ module Issues # @param object [Issue, Project] def issue_type_allowed?(object) - can?(current_user, :"create_#{params[:issue_type]}", object) + WorkItem::Type.base_types.key?(params[:issue_type]) && + can?(current_user, :"create_#{params[:issue_type]}", object) end # @param issue [Issue] diff --git a/app/services/merge_requests/mergeability_check_service.rb b/app/services/merge_requests/mergeability_check_service.rb index 3e294aeaa07..c3498c5ce97 100644 --- a/app/services/merge_requests/mergeability_check_service.rb +++ b/app/services/merge_requests/mergeability_check_service.rb @@ -157,7 +157,9 @@ module MergeRequests def merge_to_ref params = { allow_conflicts: Feature.enabled?(:display_merge_conflicts_in_diff, project) } - result = MergeRequests::MergeToRefService.new(project: project, current_user: merge_request.author, params: params).execute(merge_request) + result = MergeRequests::MergeToRefService + .new(project: project, current_user: merge_request.author, params: params) + .execute(merge_request, true) result[:status] == :success end diff --git a/app/views/admin/deploy_keys/new.html.haml b/app/views/admin/deploy_keys/new.html.haml index b0b12a01aed..fe2bc8530f7 100644 --- a/app/views/admin/deploy_keys/new.html.haml +++ b/app/views/admin/deploy_keys/new.html.haml @@ -7,4 +7,4 @@ = render partial: 'shared/deploy_keys/form', locals: { form: f, deploy_key: @deploy_key } .form-actions = f.submit 'Create', class: 'btn gl-button btn-confirm', data: { qa_selector: "add_deploy_key_button" } - = link_to 'Cancel', admin_deploy_keys_path, class: 'btn gl-button btn-default btn-cancel' + = link_to _('Cancel'), admin_deploy_keys_path, class: 'btn gl-button btn-default btn-cancel' diff --git a/app/views/admin/identities/edit.html.haml b/app/views/admin/identities/edit.html.haml index fa09138c502..0fd1f2f547f 100644 --- a/app/views/admin/identities/edit.html.haml +++ b/app/views/admin/identities/edit.html.haml @@ -1,6 +1,6 @@ -- add_to_breadcrumbs "Users", admin_users_path +- add_to_breadcrumbs _('Users'), admin_users_path - add_to_breadcrumbs @user.name, admin_user_identities_path(@user) -- breadcrumb_title "Edit Identity" +- breadcrumb_title _('Edit Identity') - page_title _("Edit"), @identity.provider, _("Identities"), @user.name, _("Users") %h3.page-title = _('Edit identity for %{user_name}') % { user_name: @user.name } diff --git a/app/views/admin/identities/index.html.haml b/app/views/admin/identities/index.html.haml index d85ab476693..3b3042b5506 100644 --- a/app/views/admin/identities/index.html.haml +++ b/app/views/admin/identities/index.html.haml @@ -1,4 +1,4 @@ -- add_to_breadcrumbs "Users", admin_users_path +- add_to_breadcrumbs _('Users'), admin_users_path - breadcrumb_title @user.name - page_title _("Identities"), @user.name, _("Users") = render 'admin/users/head' diff --git a/app/views/admin/identities/new.html.haml b/app/views/admin/identities/new.html.haml index c28d22625b5..b4f37057c51 100644 --- a/app/views/admin/identities/new.html.haml +++ b/app/views/admin/identities/new.html.haml @@ -1,7 +1,7 @@ -- add_to_breadcrumbs "Users", admin_users_path +- add_to_breadcrumbs _('Users'), admin_users_path - add_to_breadcrumbs @user.name, admin_user_identities_path(@user) -- breadcrumb_title "New Identity" -- page_title _("New Identity") +- breadcrumb_title _('New Identity') +- page_title _('New Identity') %h3.page-title= _('New identity') %hr = render 'form' diff --git a/app/views/admin/impersonation_tokens/index.html.haml b/app/views/admin/impersonation_tokens/index.html.haml index 1609687fc8d..26fbba83a32 100644 --- a/app/views/admin/impersonation_tokens/index.html.haml +++ b/app/views/admin/impersonation_tokens/index.html.haml @@ -1,4 +1,4 @@ -- add_to_breadcrumbs 'Users', admin_users_path +- add_to_breadcrumbs _('Users'), admin_users_path - breadcrumb_title @user.name - page_title _('Impersonation Tokens'), @user.name, _('Users') - type = _('impersonation token') diff --git a/app/views/admin/runners/show.html.haml b/app/views/admin/runners/show.html.haml index ffbf89585d0..1f45f3eae26 100644 --- a/app/views/admin/runners/show.html.haml +++ b/app/views/admin/runners/show.html.haml @@ -27,7 +27,7 @@ %strong = project.full_name .gl-alert-actions - = link_to s_('Disable'), admin_namespace_project_runner_project_path(project.namespace, project, runner_project), method: :delete, class: 'btn gl-alert-action btn-confirm btn-md gl-button' + = link_to _('Disable'), admin_namespace_project_runner_project_path(project.namespace, project, runner_project), method: :delete, class: 'btn gl-alert-action btn-confirm btn-md gl-button' %table.table{ data: { testid: 'unassigned-projects' } } %thead diff --git a/app/views/ci/group_variables/_variable_header.html.haml b/app/views/ci/group_variables/_variable_header.html.haml index 75a432e7f7c..5ef9dc96691 100644 --- a/app/views/ci/group_variables/_variable_header.html.haml +++ b/app/views/ci/group_variables/_variable_header.html.haml @@ -1,7 +1,7 @@ %tr %th - = s_('Key') + = _('Key') %th - = s_('Environments') + = _('Environments') %th - = s_('Group') + = _('Group') diff --git a/app/views/errors/access_denied.html.haml b/app/views/errors/access_denied.html.haml index ce921060cab..e368ee1a75a 100644 --- a/app/views/errors/access_denied.html.haml +++ b/app/views/errors/access_denied.html.haml @@ -12,5 +12,5 @@ = s_('403|Please contact your GitLab administrator to get permission.') .action-container.js-go-back{ hidden: true } %button{ type: 'button', class: 'gl-button btn btn-success' } - = s_('Go Back') + = _('Go Back') = render "errors/footer" diff --git a/app/views/groups/_home_panel.html.haml b/app/views/groups/_home_panel.html.haml index b7c2b4d86b2..a096cdb2e57 100644 --- a/app/views/groups/_home_panel.html.haml +++ b/app/views/groups/_home_panel.html.haml @@ -24,7 +24,7 @@ - if current_user .gl-display-flex.gl-flex-wrap.gl-lg-justify-content-end.gl-mx-n2{ data: { testid: 'group-buttons' } } - if current_user.admin? - = link_to [:admin, @group], class: 'btn btn-default gl-button btn-icon gl-mt-3 gl-mr-2', title: s_('View group in admin area'), + = link_to [:admin, @group], class: 'btn btn-default gl-button btn-icon gl-mt-3 gl-mr-2', title: _('View group in admin area'), data: {toggle: 'tooltip', placement: 'bottom', container: 'body'} do = sprite_icon('admin') - if @notification_setting diff --git a/app/views/profiles/keys/show.html.haml b/app/views/profiles/keys/show.html.haml index 360de7a0c11..09c16b0c038 100644 --- a/app/views/profiles/keys/show.html.haml +++ b/app/views/profiles/keys/show.html.haml @@ -1,4 +1,4 @@ -- add_to_breadcrumbs "SSH Keys", profile_keys_path +- add_to_breadcrumbs _('SSH Keys'), profile_keys_path - breadcrumb_title @key.title - page_title @key.title, _('SSH Keys') - @content_class = "limit-container-width" unless fluid_layout diff --git a/app/views/profiles/show.html.haml b/app/views/profiles/show.html.haml index 6eba0309a4f..6dcaf83cd9f 100644 --- a/app/views/profiles/show.html.haml +++ b/app/views/profiles/show.html.haml @@ -112,7 +112,7 @@ = f.text_field :organization, label: s_('Profiles|Organization'), class: 'input-md gl-form-input', help: s_("Profiles|Who you represent or work for") = f.text_area :bio, class: 'gl-form-input', label: s_('Profiles|Bio'), rows: 4, maxlength: 250, help: s_("Profiles|Tell us about yourself in fewer than 250 characters") %hr - %h5= s_("Private profile") + %h5= _('Private profile') .checkbox-icon-inline-wrapper - private_profile_label = capture do = s_("Profiles|Don't display activity-related personal information on your profiles") diff --git a/app/views/projects/_commit_button.html.haml b/app/views/projects/_commit_button.html.haml index 987ec74e4ba..2c18921d874 100644 --- a/app/views/projects/_commit_button.html.haml +++ b/app/views/projects/_commit_button.html.haml @@ -1,7 +1,7 @@ .form-actions.gl-display-flex = button_tag 'Commit changes', id: 'commit-changes', class: 'gl-button btn btn-confirm js-commit-button qa-commit-button' - = link_to 'Cancel', cancel_path, + = link_to _('Cancel'), cancel_path, class: 'gl-button btn btn-default gl-ml-3', data: {confirm: leave_edit_message} = render 'shared/projects/edit_information' diff --git a/app/views/projects/_home_panel.html.haml b/app/views/projects/_home_panel.html.haml index 8909536a1ec..e1769d40ce7 100644 --- a/app/views/projects/_home_panel.html.haml +++ b/app/views/projects/_home_panel.html.haml @@ -31,7 +31,7 @@ .project-repo-buttons.gl-display-flex.gl-justify-content-md-end.gl-align-items-start.gl-flex-wrap.gl-mt-5 - if current_user - if current_user.admin? - = link_to [:admin, @project], class: 'btn gl-button btn-icon gl-align-self-start gl-py-2! gl-mr-3', title: s_('View project in admin area'), + = link_to [:admin, @project], class: 'btn gl-button btn-icon gl-align-self-start gl-py-2! gl-mr-3', title: _('View project in admin area'), data: {toggle: 'tooltip', placement: 'bottom', container: 'body'} do = sprite_icon('admin') .gl-display-flex.gl-align-items-start.gl-mr-3 diff --git a/app/views/projects/_new_project_fields.html.haml b/app/views/projects/_new_project_fields.html.haml index af5e3f92f94..fd25d8609d0 100644 --- a/app/views/projects/_new_project_fields.html.haml +++ b/app/views/projects/_new_project_fields.html.haml @@ -11,7 +11,7 @@ = f.text_field :name, placeholder: "My awesome project", class: "form-control gl-form-input input-lg", autofocus: true, data: { track_label: "#{track_label}", track_event: "activate_form_input", track_property: "project_name", track_value: "" }, required: true, aria: { required: true } .form-group.project-path.col-sm-6 = f.label :namespace_id, class: 'label-bold' do - %span= s_("Project URL") + %span= _('Project URL') .input-group.gl-flex-nowrap - if current_user.can_select_namespace? - namespace_id = namespace_id_from(params) diff --git a/app/views/projects/blob/_new_dir.html.haml b/app/views/projects/blob/_new_dir.html.haml index 905dc2a49ec..3cc9fea56e2 100644 --- a/app/views/projects/blob/_new_dir.html.haml +++ b/app/views/projects/blob/_new_dir.html.haml @@ -16,6 +16,6 @@ .form-actions = submit_tag _("Create directory"), class: 'btn gl-button btn-confirm' - = link_to "Cancel", '#', class: "btn gl-button btn-default btn-cancel", "data-dismiss" => "modal" + = link_to _('Cancel'), '#', class: "btn gl-button btn-default btn-cancel", "data-dismiss" => "modal" = render 'shared/projects/edit_information' diff --git a/app/views/projects/blob/_remove.html.haml b/app/views/projects/blob/_remove.html.haml index 298a36e28ec..1463fcf8052 100644 --- a/app/views/projects/blob/_remove.html.haml +++ b/app/views/projects/blob/_remove.html.haml @@ -13,4 +13,4 @@ .form-group.row .offset-sm-2.col-sm-10 = button_tag 'Delete file', class: 'btn gl-button btn-danger btn-remove-file' - = link_to "Cancel", '#', class: "btn gl-button btn-cancel", "data-dismiss" => "modal" + = link_to _('Cancel'), '#', class: "btn gl-button btn-cancel", "data-dismiss" => "modal" diff --git a/app/views/projects/blob/show.html.haml b/app/views/projects/blob/show.html.haml index 1ba38808937..66e9badbafb 100644 --- a/app/views/projects/blob/show.html.haml +++ b/app/views/projects/blob/show.html.haml @@ -1,4 +1,4 @@ -- breadcrumb_title "Repository" +- breadcrumb_title _('Repository') - page_title @blob.path, @ref - signatures_path = namespace_project_signatures_path(namespace_id: @project.namespace.full_path, project_id: @project.path, id: @last_commit, limit: 1) - content_for :prefetch_asset_tags do diff --git a/app/views/projects/branches/new.html.haml b/app/views/projects/branches/new.html.haml index 6de50d48721..429db0ca2f4 100644 --- a/app/views/projects/branches/new.html.haml +++ b/app/views/projects/branches/new.html.haml @@ -30,5 +30,5 @@ .form-text.text-muted Existing branch name, tag, or commit SHA .form-actions = button_tag 'Create branch', class: 'gl-button btn btn-confirm' - = link_to 'Cancel', project_branches_path(@project), class: 'gl-button btn btn-default btn-cancel' + = link_to _('Cancel'), project_branches_path(@project), class: 'gl-button btn btn-default btn-cancel' %script#availableRefs{ type: "application/json" }= @project.repository.ref_names.to_json.html_safe diff --git a/app/views/projects/error_tracking/details.html.haml b/app/views/projects/error_tracking/details.html.haml index 4a14e34cbf1..eb26a299a66 100644 --- a/app/views/projects/error_tracking/details.html.haml +++ b/app/views/projects/error_tracking/details.html.haml @@ -1,5 +1,5 @@ - page_title _('Error Details') -- add_to_breadcrumbs 'Errors', project_error_tracking_index_path(@project) +- add_to_breadcrumbs _('Errors'), project_error_tracking_index_path(@project) - add_page_specific_style 'page_bundles/error_tracking_details' #js-error_details{ data: error_details_data(@project, @issue_id) } diff --git a/app/views/projects/mattermosts/_team_selection.html.haml b/app/views/projects/mattermosts/_team_selection.html.haml index 4109fdfc13b..4832880eefc 100644 --- a/app/views/projects/mattermosts/_team_selection.html.haml +++ b/app/views/projects/mattermosts/_team_selection.html.haml @@ -42,5 +42,5 @@ %hr .clearfix .float-right - = link_to 'Cancel', edit_project_service_path(@project, @integration), class: 'gl-button btn btn-lg' + = link_to _('Cancel'), edit_project_service_path(@project, @integration), class: 'gl-button btn btn-lg' = f.submit 'Install', class: 'gl-button btn btn-success btn-lg' diff --git a/app/views/projects/pipeline_schedules/_pipeline_schedule.html.haml b/app/views/projects/pipeline_schedules/_pipeline_schedule.html.haml index 190bf9bf071..f6a0638ccd0 100644 --- a/app/views/projects/pipeline_schedules/_pipeline_schedule.html.haml +++ b/app/views/projects/pipeline_schedules/_pipeline_schedule.html.haml @@ -27,7 +27,7 @@ %td .float-right.btn-group - if can?(current_user, :play_pipeline_schedule, pipeline_schedule) - = link_to play_pipeline_schedule_path(pipeline_schedule), method: :post, title: s_('Play'), class: 'btn gl-button btn-default btn-icon' do + = link_to play_pipeline_schedule_path(pipeline_schedule), method: :post, title: _('Play'), class: 'btn gl-button btn-default btn-icon' do = sprite_icon('play') - if can?(current_user, :take_ownership_pipeline_schedule, pipeline_schedule) = link_to take_ownership_pipeline_schedule_path(pipeline_schedule), method: :post, title: s_('PipelineSchedules|Take ownership'), class: 'btn gl-button btn-default' do diff --git a/app/views/projects/pipeline_schedules/new.html.haml b/app/views/projects/pipeline_schedules/new.html.haml index a2652304768..1b50090e445 100644 --- a/app/views/projects/pipeline_schedules/new.html.haml +++ b/app/views/projects/pipeline_schedules/new.html.haml @@ -1,4 +1,4 @@ -- breadcrumb_title "Schedules" +- breadcrumb_title _('Schedules') - @breadcrumb_link = namespace_project_pipeline_schedules_path(@project.namespace, @project) - page_title _("New Pipeline Schedule") - add_page_specific_style 'page_bundles/pipeline_schedules' diff --git a/app/views/projects/tags/releases/edit.html.haml b/app/views/projects/tags/releases/edit.html.haml index b03c646178e..c99f146ea7a 100644 --- a/app/views/projects/tags/releases/edit.html.haml +++ b/app/views/projects/tags/releases/edit.html.haml @@ -16,4 +16,4 @@ .error-alert .gl-mt-5.gl-display-flex = f.submit _('Save changes'), class: 'btn gl-button btn-confirm gl-mr-3' - = link_to "Cancel", project_tag_path(@project, @tag.name), class: "btn gl-button btn-default btn-cancel" + = link_to _('Cancel'), project_tag_path(@project, @tag.name), class: "btn gl-button btn-default btn-cancel" diff --git a/app/views/shared/labels/_form.html.haml b/app/views/shared/labels/_form.html.haml index 29f6cbd41dd..6f65dbe4811 100644 --- a/app/views/shared/labels/_form.html.haml +++ b/app/views/shared/labels/_form.html.haml @@ -31,4 +31,4 @@ = f.submit _('Save changes'), class: 'btn gl-button btn-confirm js-save-button' - else = f.submit 'Create label', class: 'btn gl-button btn-confirm js-save-button qa-label-create-button' - = link_to 'Cancel', back_path, class: 'btn gl-button btn-default btn-cancel' + = link_to _('Cancel'), back_path, class: 'btn gl-button btn-default btn-cancel' diff --git a/app/views/shared/runners/_runner_details.html.haml b/app/views/shared/runners/_runner_details.html.haml index 672f0b6a83f..a7b2947057d 100644 --- a/app/views/shared/runners/_runner_details.html.haml +++ b/app/views/shared/runners/_runner_details.html.haml @@ -60,4 +60,4 @@ - if runner.contacted_at = time_ago_with_tooltip runner.contacted_at - else - = s_('Never') + = _('Never') diff --git a/app/views/shared/wikis/pages.html.haml b/app/views/shared/wikis/pages.html.haml index c1918198594..0a8ca309823 100644 --- a/app/views/shared/wikis/pages.html.haml +++ b/app/views/shared/wikis/pages.html.haml @@ -1,4 +1,4 @@ -- add_to_breadcrumbs "Wiki", wiki_path(@wiki) +- add_to_breadcrumbs _('Wiki'), wiki_path(@wiki) - breadcrumb_title s_("Wiki|Pages") - page_title s_("Wiki|Pages"), _("Wiki") - sort_title = wiki_sort_title(params[:sort]) |