diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-03 12:08:20 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-03 12:08:20 +0300 |
commit | a1aeaba23e388ac96d34c135c6c55e414f823487 (patch) | |
tree | 12ac28cdba58353efe18053028d6028a965c6358 | |
parent | d72fedf168dafcb38bd51b67f86804738000fb48 (diff) |
Add latest changes from gitlab-org/gitlab@master
39 files changed, 126 insertions, 120 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 82e59e0104b..6609868689d 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -548,13 +548,6 @@ Style/EachWithObject: Style/EmptyElse: Enabled: false -# Offense count: 11 -# Cop supports --auto-correct. -Style/EmptyLambdaParameter: - Exclude: - - 'app/models/ci/build.rb' - - 'app/models/ci/runner.rb' - # Offense count: 170 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. @@ -638,22 +631,6 @@ Style/ParallelAssignment: Style/PercentLiteralDelimiters: Enabled: false -# Offense count: 15 -# Cop supports --auto-correct. -Style/PerlBackrefs: - Exclude: - - 'app/controllers/projects/application_controller.rb' - - 'app/helpers/submodule_helper.rb' - - 'lib/backup/manager.rb' - - 'lib/banzai/filter/abstract_reference_filter.rb' - - 'lib/banzai/filter/autolink_filter.rb' - - 'lib/banzai/filter/emoji_filter.rb' - - 'lib/banzai/filter/gollum_tags_filter.rb' - - 'lib/expand_variables.rb' - - 'lib/gitlab/diff/highlight.rb' - - 'lib/gitlab/search_results.rb' - - 'lib/gitlab/sherlock/query.rb' - # Offense count: 200 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. diff --git a/app/assets/javascripts/deprecated_jquery_dropdown/render.js b/app/assets/javascripts/deprecated_jquery_dropdown/render.js index 66546aa834f..167bc4c286e 100644 --- a/app/assets/javascripts/deprecated_jquery_dropdown/render.js +++ b/app/assets/javascripts/deprecated_jquery_dropdown/render.js @@ -1,3 +1,5 @@ +import { slugify } from '~/lib/utils/text_utility'; + const renderersByType = { divider(element) { element.classList.add('divider'); @@ -95,15 +97,22 @@ function checkSelected(data, options) { return options.parent.querySelector(`input[name='${options.fieldName}']`) == null; } -function createLink(url, selected, options) { +function createLink(data, selected, options, index) { const link = document.createElement('a'); - link.href = url; + link.href = getPropertyWithDefault(data, options, 'url', '#'); if (options.icon) { link.classList.add('d-flex', 'align-items-center'); } + if (options.trackSuggestionClickedLabel) { + link.setAttribute('data-track-event', 'click_text'); + link.setAttribute('data-track-label', options.trackSuggestionClickedLabel); + link.setAttribute('data-track-value', index); + link.setAttribute('data-track-property', slugify(data.category || 'no-category')); + } + link.classList.toggle('is-active', selected); return link; @@ -123,8 +132,7 @@ function assignTextToLink(el, data, options) { function renderLink(row, data, { options, group, index }) { const selected = checkSelected(data, options); - const url = getPropertyWithDefault(data, options, 'url', '#'); - const link = createLink(url, selected, options); + const link = createLink(data, selected, options, index); assignTextToLink(link, data, options); diff --git a/app/assets/javascripts/issuables_list/components/issuable.vue b/app/assets/javascripts/issuables_list/components/issuable.vue index c92154017f8..adfb234fe7a 100644 --- a/app/assets/javascripts/issuables_list/components/issuable.vue +++ b/app/assets/javascripts/issuables_list/components/issuable.vue @@ -1,5 +1,4 @@ <script> -/* eslint-disable vue/no-v-html */ /* * This is tightly coupled to projects/issues/_issue.html.haml, * any changes done to the haml need to be reflected here. @@ -7,7 +6,14 @@ // TODO: need to move this component to graphql - https://gitlab.com/gitlab-org/gitlab/-/issues/221246 import { escape, isNumber } from 'lodash'; -import { GlLink, GlTooltipDirective as GlTooltip, GlSprintf, GlLabel, GlIcon } from '@gitlab/ui'; +import { + GlLink, + GlTooltipDirective as GlTooltip, + GlSprintf, + GlLabel, + GlIcon, + GlSafeHtmlDirective as SafeHtml, +} from '@gitlab/ui'; import jiraLogo from '@gitlab/svgs/dist/illustrations/logos/jira.svg'; import { dateInWords, @@ -42,6 +48,7 @@ export default { }, directives: { GlTooltip, + SafeHtml, }, mixins: [glFeatureFlagsMixin()], props: { @@ -299,9 +306,9 @@ export default { <span class="js-ref-path gl-mr-4 mr-sm-0"> <span v-if="isJiraIssue" + v-safe-html="jiraLogo" class="svg-container jira-logo-container" data-testid="jira-logo" - v-html="jiraLogo" ></span> {{ referencePath }} </span> diff --git a/app/assets/javascripts/profile/account/components/delete_account_modal.vue b/app/assets/javascripts/profile/account/components/delete_account_modal.vue index b99dd32c7b6..f06dc72d365 100644 --- a/app/assets/javascripts/profile/account/components/delete_account_modal.vue +++ b/app/assets/javascripts/profile/account/components/delete_account_modal.vue @@ -64,7 +64,7 @@ Once you confirm %{deleteAccount}, it cannot be undone or recovered.`), return { text: s__('Delete account'), attributes: [ - { variant: 'danger', 'data-qa-selector': 'confirm_deletion_button' }, + { variant: 'danger', 'data-qa-selector': 'confirm_delete_account_button' }, { category: 'primary' }, { disabled: !this.canSubmit }, ], diff --git a/app/assets/javascripts/search_autocomplete.js b/app/assets/javascripts/search_autocomplete.js index 8898d533c86..7073b9ca12d 100644 --- a/app/assets/javascripts/search_autocomplete.js +++ b/app/assets/javascripts/search_autocomplete.js @@ -135,6 +135,7 @@ export class SearchAutocomplete { data: this.getData.bind(this), selectable: true, clicked: this.onClick.bind(this), + trackSuggestionClickedLabel: 'search_autocomplete_suggestion', }); } diff --git a/app/assets/javascripts/sidebar/event_hub.js b/app/assets/javascripts/sidebar/event_hub.js index f35506fd5de..dd4bd9a5ab7 100644 --- a/app/assets/javascripts/sidebar/event_hub.js +++ b/app/assets/javascripts/sidebar/event_hub.js @@ -1,6 +1,6 @@ -import Vue from 'vue'; +import createEventHub from '~/helpers/event_hub_factory'; -const eventHub = new Vue(); +const eventHub = createEventHub(); // TODO: remove eventHub hack after code splitting refactor window.emitSidebarEvent = (...args) => eventHub.$emit(...args); diff --git a/app/assets/javascripts/vue_merge_request_widget/components/states/commits_header.vue b/app/assets/javascripts/vue_merge_request_widget/components/states/commits_header.vue index 6208457e5ab..bdcea9871ea 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/states/commits_header.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/states/commits_header.vue @@ -1,13 +1,12 @@ <script> /* eslint-disable vue/no-v-html */ -import { GlDeprecatedButton, GlIcon } from '@gitlab/ui'; +import { GlButton } from '@gitlab/ui'; import { escape } from 'lodash'; import { __, n__, sprintf, s__ } from '~/locale'; export default { components: { - GlIcon, - GlDeprecatedButton, + GlButton, }, props: { isSquashEnabled: { @@ -80,20 +79,19 @@ export default { class="js-mr-widget-commits-count mr-widget-extension clickable d-flex align-items-center px-3 py-2" @click="toggle()" > - <gl-deprecated-button + <gl-button :aria-label="ariaLabel" - variant="blank" - class="commit-edit-toggle square s24 gl-mr-3" + category="tertiary" + class="commit-edit-toggle gl-mr-3" + :icon="collapseIcon" @click.stop="toggle()" - > - <gl-icon :name="collapseIcon" :size="16" /> - </gl-deprecated-button> + /> <span v-if="expanded">{{ __('Collapse') }}</span> <span v-else> <span class="vertical-align-middle" v-html="message"></span> - <gl-deprecated-button variant="link" class="modify-message-button"> + <gl-button variant="link" class="modify-message-button"> {{ modifyLinkMessage }} - </gl-deprecated-button> + </gl-button> </span> </div> <div v-show="expanded"><slot></slot></div> diff --git a/app/controllers/projects/application_controller.rb b/app/controllers/projects/application_controller.rb index 518d414be1b..ca2692438e8 100644 --- a/app/controllers/projects/application_controller.rb +++ b/app/controllers/projects/application_controller.rb @@ -58,9 +58,9 @@ class Projects::ApplicationController < ApplicationController def method_missing(method_sym, *arguments, &block) case method_sym.to_s when /\Aauthorize_(.*)!\z/ - authorize_action!($1.to_sym) + authorize_action!(Regexp.last_match(1).to_sym) when /\Acheck_(.*)_available!\z/ - check_project_feature_available!($1.to_sym) + check_project_feature_available!(Regexp.last_match(1).to_sym) else super end diff --git a/app/helpers/submodule_helper.rb b/app/helpers/submodule_helper.rb index 06ea3dd8a81..2e7146eaa43 100644 --- a/app/helpers/submodule_helper.rb +++ b/app/helpers/submodule_helper.rb @@ -18,7 +18,7 @@ module SubmoduleHelper end if url =~ %r{([^/:]+)/([^/]+(?:\.git)?)\Z} - namespace, project = $1, $2 + namespace, project = Regexp.last_match(1), Regexp.last_match(2) gitlab_hosts = [Gitlab.config.gitlab.url, Gitlab.config.gitlab_shell.ssh_path_prefix] diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 3e35641ff56..97b1dba1fc6 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -90,9 +90,9 @@ module Ci Ci::BuildMetadata.scoped_build.with_interruptible.select(:id)) end - scope :unstarted, ->() { where(runner_id: nil) } - scope :ignore_failures, ->() { where(allow_failure: false) } - scope :with_downloadable_artifacts, ->() do + scope :unstarted, -> { where(runner_id: nil) } + scope :ignore_failures, -> { where(allow_failure: false) } + scope :with_downloadable_artifacts, -> do where('EXISTS (?)', Ci::JobArtifact.select(1) .where('ci_builds.id = ci_job_artifacts.job_id') @@ -104,11 +104,11 @@ module Ci where('EXISTS (?)', ::Ci::JobArtifact.select(1).where('ci_builds.id = ci_job_artifacts.job_id').merge(query)) end - scope :with_archived_trace, ->() do + scope :with_archived_trace, -> do with_existing_job_artifacts(Ci::JobArtifact.trace) end - scope :without_archived_trace, ->() do + scope :without_archived_trace, -> do where('NOT EXISTS (?)', Ci::JobArtifact.select(1).where('ci_builds.id = ci_job_artifacts.job_id').trace) end @@ -139,11 +139,11 @@ module Ci .includes(:metadata, :job_artifacts_metadata) end - scope :with_artifacts_not_expired, ->() { with_downloadable_artifacts.where('artifacts_expire_at IS NULL OR artifacts_expire_at > ?', Time.current) } - scope :with_expired_artifacts, ->() { with_downloadable_artifacts.where('artifacts_expire_at < ?', Time.current) } - scope :last_month, ->() { where('created_at > ?', Date.today - 1.month) } - scope :manual_actions, ->() { where(when: :manual, status: COMPLETED_STATUSES + %i[manual]) } - scope :scheduled_actions, ->() { where(when: :delayed, status: COMPLETED_STATUSES + %i[scheduled]) } + scope :with_artifacts_not_expired, -> { with_downloadable_artifacts.where('artifacts_expire_at IS NULL OR artifacts_expire_at > ?', Time.current) } + scope :with_expired_artifacts, -> { with_downloadable_artifacts.where('artifacts_expire_at < ?', Time.current) } + scope :last_month, -> { where('created_at > ?', Date.today - 1.month) } + scope :manual_actions, -> { where(when: :manual, status: COMPLETED_STATUSES + %i[manual]) } + scope :scheduled_actions, -> { where(when: :delayed, status: COMPLETED_STATUSES + %i[scheduled]) } scope :ref_protected, -> { where(protected: true) } scope :with_live_trace, -> { where('EXISTS (?)', Ci::BuildTraceChunk.where('ci_builds.id = ci_build_trace_chunks.build_id').select(1)) } scope :with_stale_live_trace, -> { with_live_trace.finished_before(12.hours.ago) } diff --git a/app/models/ci/runner.rb b/app/models/ci/runner.rb index 00ee45740bd..86879b9dc68 100644 --- a/app/models/ci/runner.rb +++ b/app/models/ci/runner.rb @@ -52,7 +52,7 @@ module Ci has_many :runner_namespaces, inverse_of: :runner has_many :groups, through: :runner_namespaces - has_one :last_build, ->() { order('id DESC') }, class_name: 'Ci::Build' + has_one :last_build, -> { order('id DESC') }, class_name: 'Ci::Build' before_save :ensure_token diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 618fa06745e..c31abc071bc 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -1350,7 +1350,6 @@ class MergeRequest < ApplicationRecord variables.append(key: 'CI_MERGE_REQUEST_PROJECT_URL', value: project.web_url) variables.append(key: 'CI_MERGE_REQUEST_TARGET_BRANCH_NAME', value: target_branch.to_s) variables.append(key: 'CI_MERGE_REQUEST_TITLE', value: title) - variables.append(key: 'CI_MERGE_REQUEST_DESCRIPTION', value: description) if Gitlab::Ci::Features.expose_mr_description_predefined_variable? variables.append(key: 'CI_MERGE_REQUEST_ASSIGNEES', value: assignee_username_list) if assignees.present? variables.append(key: 'CI_MERGE_REQUEST_MILESTONE', value: milestone.title) if milestone variables.append(key: 'CI_MERGE_REQUEST_LABELS', value: label_names.join(',')) if labels.present? diff --git a/app/presenters/alert_management/alert_presenter.rb b/app/presenters/alert_management/alert_presenter.rb index d8ad3c96646..2daa3bd09bf 100644 --- a/app/presenters/alert_management/alert_presenter.rb +++ b/app/presenters/alert_management/alert_presenter.rb @@ -31,8 +31,6 @@ module AlertManagement def issue_summary_markdown <<~MARKDOWN.chomp - #### Summary - #{metadata_list} #{alert_details}#{metric_embed_for_alert} MARKDOWN diff --git a/app/presenters/projects/prometheus/alert_presenter.rb b/app/presenters/projects/prometheus/alert_presenter.rb index 49859f27edd..694b9dff512 100644 --- a/app/presenters/projects/prometheus/alert_presenter.rb +++ b/app/presenters/projects/prometheus/alert_presenter.rb @@ -51,8 +51,6 @@ module Projects def issue_summary_markdown <<~MARKDOWN.chomp - #### Summary - #{metadata_list} #{alert_details}#{metric_embed_for_alert} MARKDOWN diff --git a/changelogs/unreleased/CI_MERGE_REQUEST_DESCRIPTION.yml b/changelogs/unreleased/CI_MERGE_REQUEST_DESCRIPTION.yml deleted file mode 100644 index 8099b2b6a8a..00000000000 --- a/changelogs/unreleased/CI_MERGE_REQUEST_DESCRIPTION.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: Add CI_MERGE_REQUEST_DESCRIPTION env variable -merge_request: 40771 -author: Paul Spooren @aparcar -type: added diff --git a/changelogs/unreleased/empty-lambda-cop.yml b/changelogs/unreleased/empty-lambda-cop.yml new file mode 100644 index 00000000000..48423cc271d --- /dev/null +++ b/changelogs/unreleased/empty-lambda-cop.yml @@ -0,0 +1,5 @@ +--- +title: Fix Style/EmptyLambdaParameter cop +merge_request: 41248 +author: Rajendra Kadam +type: fixed diff --git a/changelogs/unreleased/perl-backref-cop.yml b/changelogs/unreleased/perl-backref-cop.yml new file mode 100644 index 00000000000..d82bec75293 --- /dev/null +++ b/changelogs/unreleased/perl-backref-cop.yml @@ -0,0 +1,5 @@ +--- +title: Fix Style/PerlBackrefs cop +merge_request: 41246 +author: Rajendra Kadam +type: fixed diff --git a/config/feature_flags/development/expose_mr_description_predefined_variable.yml b/config/feature_flags/development/expose_mr_description_predefined_variable.yml deleted file mode 100644 index 8338b2937ae..00000000000 --- a/config/feature_flags/development/expose_mr_description_predefined_variable.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -name: expose_mr_description_predefined_variable -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/40771 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/243556 -group: group::continuous integration -type: development -default_enabled: true diff --git a/doc/api/graphql/reference/gitlab_schema.graphql b/doc/api/graphql/reference/gitlab_schema.graphql index 6d73c0d594a..7ae683ba705 100644 --- a/doc/api/graphql/reference/gitlab_schema.graphql +++ b/doc/api/graphql/reference/gitlab_schema.graphql @@ -16561,6 +16561,11 @@ input UpdateIssueInput { dueDate: Time """ + The ID of the parent epic. NULL when removing the association + """ + epicId: ID + + """ The desired health status """ healthStatus: HealthStatus diff --git a/doc/api/graphql/reference/gitlab_schema.json b/doc/api/graphql/reference/gitlab_schema.json index 7a58ee5d54b..7dab2b15dca 100644 --- a/doc/api/graphql/reference/gitlab_schema.json +++ b/doc/api/graphql/reference/gitlab_schema.json @@ -48798,6 +48798,16 @@ "defaultValue": null }, { + "name": "epicId", + "description": "The ID of the parent epic. NULL when removing the association", + "type": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + }, + "defaultValue": null + }, + { "name": "clientMutationId", "description": "A unique identifier for the client performing the mutation.", "type": { diff --git a/doc/ci/variables/predefined_variables.md b/doc/ci/variables/predefined_variables.md index 0150964ad28..5a5774a5c58 100644 --- a/doc/ci/variables/predefined_variables.md +++ b/doc/ci/variables/predefined_variables.md @@ -89,8 +89,7 @@ Kubernetes-specific environment variables are detailed in the | `CI_MERGE_REQUEST_SOURCE_PROJECT_URL` | 11.6 | all | The URL of the source project of the merge request if [the pipelines are for merge requests](../merge_request_pipelines/index.md). Available only if `only: [merge_requests]` or [`rules`](../yaml/README.md#rules) syntax is used and the merge request is created. | | `CI_MERGE_REQUEST_TARGET_BRANCH_NAME` | 11.6 | all | The target branch name of the merge request if [the pipelines are for merge requests](../merge_request_pipelines/index.md). Available only if `only: [merge_requests]` or [`rules`](../yaml/README.md#rules) syntax is used and the merge request is created. | | `CI_MERGE_REQUEST_TARGET_BRANCH_SHA` | 11.9 | all | The HEAD SHA of the target branch of the merge request if [the pipelines are for merge requests](../merge_request_pipelines/index.md). Available only if `only: [merge_requests]` or [`rules`](../yaml/README.md#rules) syntax is used, the merge request is created, and the pipeline is a [merged result pipeline](../merge_request_pipelines/pipelines_for_merged_results/index.md). **(PREMIUM)** | -| `CI_MERGE_REQUEST_TITLE` | 11.9 | all | The title of the merge request if [the pipelines are for merge requests](../merge_request_pipelines/index.md). Available only if `only: [merge_requests]` or [`rules`](../yaml/README.md#rules) syntax is used and the merge request is created. | -| `CI_MERGE_REQUEST_DESCRIPTION` | 13.3 | all | The description of the merge request if [the pipelines are for merge requests](../merge_request_pipelines/index.md). Available only if `only: [merge_requests]` or [`rules`](../yaml/README.md#rules) syntax is used and the merge request is created. | +| `CI_MERGE_REQUEST_TITLE` | 11.9 | all | The title of the merge request if [the pipelines are for merge requests](../merge_request_pipelines/index.md). Available only if `only: [merge_requests]` or [`rules`](../yaml/README.md#rules) syntax is used and the merge request is created. | | `CI_MERGE_REQUEST_EVENT_TYPE` | 12.3 | all | The event type of the merge request, if [the pipelines are for merge requests](../merge_request_pipelines/index.md). Can be `detached`, `merged_result` or `merge_train`. | | `CI_NODE_INDEX` | 11.5 | all | Index of the job in the job set. If the job is not parallelized, this variable is not set. | | `CI_NODE_TOTAL` | 11.5 | all | Total number of instances of this job running in parallel. If the job is not parallelized, this variable is set to `1`. | diff --git a/doc/user/project/code_intelligence.md b/doc/user/project/code_intelligence.md index be34053cdc7..5a55913af29 100644 --- a/doc/user/project/code_intelligence.md +++ b/doc/user/project/code_intelligence.md @@ -26,10 +26,9 @@ Enable code intelligence for a project by adding a GitLab CI/CD job to the proje ```yaml code_navigation: - image: golang:1.14.0 + image: sourcegraph/lsif-go:v1 allow_failure: true # recommended script: - - go get github.com/sourcegraph/lsif-go/cmd/lsif-go - lsif-go artifacts: reports: diff --git a/lib/backup/manager.rb b/lib/backup/manager.rb index 915567f8106..6bce9a2760d 100644 --- a/lib/backup/manager.rb +++ b/lib/backup/manager.rb @@ -88,7 +88,7 @@ module Backup # - 1495527097_2017_05_23_9.3.0-pre_gitlab_backup.tar next unless file =~ /^(\d{10})(?:_\d{4}_\d{2}_\d{2}(_\d+\.\d+\.\d+((-|\.)(pre|rc\d))?(-ee)?)?)?_gitlab_backup\.tar$/ - timestamp = $1.to_i + timestamp = Regexp.last_match(1).to_i if Time.at(timestamp) < (Time.now - keep_time) begin diff --git a/lib/banzai/filter/abstract_reference_filter.rb b/lib/banzai/filter/abstract_reference_filter.rb index b0a2f6f69d5..2448c2c2bb2 100644 --- a/lib/banzai/filter/abstract_reference_filter.rb +++ b/lib/banzai/filter/abstract_reference_filter.rb @@ -265,7 +265,7 @@ module Banzai extras = [] if matches.names.include?("anchor") && matches[:anchor] && matches[:anchor] =~ /\A\#note_(\d+)\z/ - extras << "comment #{$1}" + extras << "comment #{Regexp.last_match(1)}" end extension = matches[:extension] if matches.names.include?("extension") @@ -436,7 +436,7 @@ module Banzai escaped = escape_html_entities(text) escaped.gsub(REFERENCE_PLACEHOLDER_PATTERN) do |match| - placeholder_data[$1.to_i] + placeholder_data[Regexp.last_match(1).to_i] end end end diff --git a/lib/banzai/filter/autolink_filter.rb b/lib/banzai/filter/autolink_filter.rb index 4723bfbf261..0aa1ee8f604 100644 --- a/lib/banzai/filter/autolink_filter.rb +++ b/lib/banzai/filter/autolink_filter.rb @@ -86,7 +86,7 @@ module Banzai # outside the link element. The entity must be marked HTML safe in # order to be output literally rather than escaped. match.gsub!(/((?:&[\w#]+;)+)\z/, '') - dropped = ($1 || '').html_safe + dropped = (Regexp.last_match(1) || '').html_safe # To match the behaviour of Rinku, if the matched link ends with a # closing part of a matched pair of punctuation, we remove that trailing diff --git a/lib/banzai/filter/emoji_filter.rb b/lib/banzai/filter/emoji_filter.rb index fa1690f73ad..b32fe5e8301 100644 --- a/lib/banzai/filter/emoji_filter.rb +++ b/lib/banzai/filter/emoji_filter.rb @@ -33,7 +33,7 @@ module Banzai # Returns a String with :emoji: replaced with gl-emoji unicode. def emoji_name_element_unicode_filter(text) text.gsub(emoji_pattern) do |match| - name = $1 + name = Regexp.last_match(1) Gitlab::Emoji.gl_emoji_tag(name) end end diff --git a/lib/banzai/filter/gollum_tags_filter.rb b/lib/banzai/filter/gollum_tags_filter.rb index 7928272a2cf..e16de13725f 100644 --- a/lib/banzai/filter/gollum_tags_filter.rb +++ b/lib/banzai/filter/gollum_tags_filter.rb @@ -64,7 +64,7 @@ module Banzai next if has_ancestor?(node, IGNORED_ANCESTOR_TAGS) next unless node.content =~ TAGS_PATTERN - html = process_tag($1) + html = process_tag(Regexp.last_match(1)) node.replace(html) if html && html != node.content end diff --git a/lib/expand_variables.rb b/lib/expand_variables.rb index 45af30f46dc..3a50925d628 100644 --- a/lib/expand_variables.rb +++ b/lib/expand_variables.rb @@ -7,7 +7,7 @@ module ExpandVariables value.gsub(/\$([a-zA-Z_][a-zA-Z0-9_]*)|\${\g<1>}|%\g<1>%/) do variables_hash ||= transform_variables(variables) - variables_hash[$1 || $2] + variables_hash[Regexp.last_match(1) || Regexp.last_match(2)] end end diff --git a/lib/gitlab/ci/features.rb b/lib/gitlab/ci/features.rb index 957eee8587d..206ba029750 100644 --- a/lib/gitlab/ci/features.rb +++ b/lib/gitlab/ci/features.rb @@ -79,10 +79,6 @@ module Gitlab def self.coverage_report_view?(project) ::Feature.enabled?(:coverage_report_view, project) end - - def self.expose_mr_description_predefined_variable? - ::Feature.enabled?(:ci_expose_mr_description_predefined_variable, default_enabled: true) - end end end end diff --git a/lib/gitlab/diff/highlight.rb b/lib/gitlab/diff/highlight.rb index 0d027809ba8..a5259079345 100644 --- a/lib/gitlab/diff/highlight.rb +++ b/lib/gitlab/diff/highlight.rb @@ -60,7 +60,7 @@ module Gitlab # Only update text if line is found. This will prevent # issues with submodules given the line only exists in diff content. if rich_line - line_prefix = diff_line.text =~ /\A(.)/ ? $1 : ' ' + line_prefix = diff_line.text =~ /\A(.)/ ? Regexp.last_match(1) : ' ' "#{line_prefix}#{rich_line}".html_safe end end diff --git a/lib/gitlab/search_results.rb b/lib/gitlab/search_results.rb index 7198443f72e..33f28efe284 100644 --- a/lib/gitlab/search_results.rb +++ b/lib/gitlab/search_results.rb @@ -186,7 +186,7 @@ module Gitlab params[:sort] = 'updated_desc' if query =~ /#(\d+)\z/ - params[:iids] = $1 + params[:iids] = Regexp.last_match(1) else params[:search] = query end diff --git a/lib/gitlab/sherlock/query.rb b/lib/gitlab/sherlock/query.rb index cbd89b7629f..6f1d2ad23c1 100644 --- a/lib/gitlab/sherlock/query.rb +++ b/lib/gitlab/sherlock/query.rb @@ -105,7 +105,7 @@ module Gitlab query.each_line .map { |line| line.strip } .join("\n") - .gsub(PREFIX_NEWLINE) { "\n#{$1} " } + .gsub(PREFIX_NEWLINE) { "\n#{Regexp.last_match(1)} " } end end end diff --git a/qa/qa/page/profile/accounts/show.rb b/qa/qa/page/profile/accounts/show.rb index 2cd2d4597dc..cf7f7d80cfa 100644 --- a/qa/qa/page/profile/accounts/show.rb +++ b/qa/qa/page/profile/accounts/show.rb @@ -11,14 +11,14 @@ module QA view 'app/assets/javascripts/profile/account/components/delete_account_modal.vue' do element :password_confirmation_field - element :confirm_deletion_button + element :confirm_delete_account_button end def delete_account(password) click_element(:delete_account_button) find_element(:password_confirmation_field).set password - click_element(:confirm_deletion_button) + click_element(:confirm_delete_account_button) end end end diff --git a/spec/frontend/deprecated_jquery_dropdown_spec.js b/spec/frontend/deprecated_jquery_dropdown_spec.js index 077657cfee4..e6323859899 100644 --- a/spec/frontend/deprecated_jquery_dropdown_spec.js +++ b/spec/frontend/deprecated_jquery_dropdown_spec.js @@ -313,6 +313,42 @@ describe('deprecatedJQueryDropdown', () => { expect(li.childNodes.length).toEqual(1); expect(li.textContent).toEqual(text); }); + + describe('with a trackSuggestionsClickedLabel', () => { + it('it includes data-track attributes', () => { + const dropdown = dropdownWithOptions({ + trackSuggestionClickedLabel: 'some_value_for_label', + }); + const item = { + id: 'some-element-id', + text: 'the link text', + url: 'http://example.com', + category: 'Suggestion category', + }; + const li = dropdown.renderItem(item, null, 3); + const link = li.querySelector('a'); + + expect(link).toHaveAttr('data-track-event', 'click_text'); + expect(link).toHaveAttr('data-track-label', 'some_value_for_label'); + expect(link).toHaveAttr('data-track-value', '3'); + expect(link).toHaveAttr('data-track-property', 'suggestion-category'); + }); + + it('it defaults property to no_category when category not provided', () => { + const dropdown = dropdownWithOptions({ + trackSuggestionClickedLabel: 'some_value_for_label', + }); + const item = { + id: 'some-element-id', + text: 'the link text', + url: 'http://example.com', + }; + const li = dropdown.renderItem(item); + const link = li.querySelector('a'); + + expect(link).toHaveAttr('data-track-property', 'no-category'); + }); + }); }); it('should keep selected item after selecting a second time', () => { diff --git a/spec/frontend/vue_mr_widget/components/states/mr_widget_commits_header_spec.js b/spec/frontend/vue_mr_widget/components/states/mr_widget_commits_header_spec.js index 02b825b1579..62fc3330444 100644 --- a/spec/frontend/vue_mr_widget/components/states/mr_widget_commits_header_spec.js +++ b/spec/frontend/vue_mr_widget/components/states/mr_widget_commits_header_spec.js @@ -1,5 +1,4 @@ import { shallowMount } from '@vue/test-utils'; -import { GlIcon } from '@gitlab/ui'; import CommitsHeader from '~/vue_merge_request_widget/components/states/commits_header.vue'; describe('Commits header component', () => { @@ -23,7 +22,6 @@ describe('Commits header component', () => { const findHeaderWrapper = () => wrapper.find('.js-mr-widget-commits-count'); const findCommitToggle = () => wrapper.find('.commit-edit-toggle'); - const findIcon = () => wrapper.find(GlIcon); const findCommitsCountMessage = () => wrapper.find('.commits-count-message'); const findTargetBranchMessage = () => wrapper.find('.label-branch'); const findModifyButton = () => wrapper.find('.modify-message-button'); @@ -61,7 +59,7 @@ describe('Commits header component', () => { wrapper.setData({ expanded: false }); return wrapper.vm.$nextTick().then(() => { - expect(findIcon().props('name')).toBe('chevron-right'); + expect(findCommitToggle().props('icon')).toBe('chevron-right'); }); }); @@ -119,7 +117,7 @@ describe('Commits header component', () => { it('has a chevron-down icon', done => { wrapper.vm.$nextTick(() => { - expect(findIcon().props('name')).toBe('chevron-down'); + expect(findCommitToggle().props('icon')).toBe('chevron-down'); done(); }); }); diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb index ee2a2d80616..30d323b32d0 100644 --- a/spec/models/ci/pipeline_spec.rb +++ b/spec/models/ci/pipeline_spec.rb @@ -760,7 +760,6 @@ RSpec.describe Ci::Pipeline, :mailer, factory_default: :keep do 'CI_MERGE_REQUEST_SOURCE_BRANCH_NAME' => merge_request.source_branch.to_s, 'CI_MERGE_REQUEST_SOURCE_BRANCH_SHA' => pipeline.source_sha.to_s, 'CI_MERGE_REQUEST_TITLE' => merge_request.title, - 'CI_MERGE_REQUEST_DESCRIPTION' => merge_request.description, 'CI_MERGE_REQUEST_ASSIGNEES' => merge_request.assignee_username_list, 'CI_MERGE_REQUEST_MILESTONE' => milestone.title, 'CI_MERGE_REQUEST_LABELS' => labels.map(&:title).sort.join(','), diff --git a/spec/presenters/alert_management/alert_presenter_spec.rb b/spec/presenters/alert_management/alert_presenter_spec.rb index 6cd363193ab..365dc84ff53 100644 --- a/spec/presenters/alert_management/alert_presenter_spec.rb +++ b/spec/presenters/alert_management/alert_presenter_spec.rb @@ -27,8 +27,6 @@ RSpec.describe AlertManagement::AlertPresenter do it 'returns an alert issue description' do expect(presenter.issue_description).to eq( <<~MARKDOWN.chomp - #### Summary - **Start time:** #{presenter.start_time}#{markdown_line_break} **Severity:** #{presenter.severity}#{markdown_line_break} **Service:** #{alert.service}#{markdown_line_break} diff --git a/spec/presenters/alert_management/prometheus_alert_presenter_spec.rb b/spec/presenters/alert_management/prometheus_alert_presenter_spec.rb index e4bfda12af9..8ff51b9a8e1 100644 --- a/spec/presenters/alert_management/prometheus_alert_presenter_spec.rb +++ b/spec/presenters/alert_management/prometheus_alert_presenter_spec.rb @@ -30,8 +30,6 @@ RSpec.describe AlertManagement::PrometheusAlertPresenter do it 'returns an alert issue description' do expect(presenter.issue_description).to eq( <<~MARKDOWN.chomp - #### Summary - **Start time:** #{presenter.start_time}#{markdown_line_break} **Severity:** #{presenter.severity}#{markdown_line_break} **full_query:** `vector(1)`#{markdown_line_break} diff --git a/spec/presenters/projects/prometheus/alert_presenter_spec.rb b/spec/presenters/projects/prometheus/alert_presenter_spec.rb index 2d58a7f2cfa..1c37e551385 100644 --- a/spec/presenters/projects/prometheus/alert_presenter_spec.rb +++ b/spec/presenters/projects/prometheus/alert_presenter_spec.rb @@ -63,8 +63,6 @@ RSpec.describe Projects::Prometheus::AlertPresenter do it do is_expected.to eq( <<~MARKDOWN.chomp - #### Summary - **Start time:** #{presenter.start_time} MARKDOWN @@ -80,8 +78,6 @@ RSpec.describe Projects::Prometheus::AlertPresenter do it do is_expected.to eq( <<~MARKDOWN.chomp - #### Summary - **Start time:** #{presenter.start_time} #### Alert Details @@ -101,8 +97,6 @@ RSpec.describe Projects::Prometheus::AlertPresenter do it do is_expected.to eq( <<~MARKDOWN.chomp - #### Summary - **Start time:** #{presenter.start_time}#{markdown_line_break} **full_query:** `query` @@ -129,8 +123,6 @@ RSpec.describe Projects::Prometheus::AlertPresenter do it do is_expected.to eq( <<~MARKDOWN.chomp - #### Summary - **Start time:** #{presenter.start_time}#{markdown_line_break} **Service:** service_name#{markdown_line_break} **Monitoring tool:** monitoring_tool_name#{markdown_line_break} @@ -151,8 +143,6 @@ RSpec.describe Projects::Prometheus::AlertPresenter do it do is_expected.to eq( <<~MARKDOWN.chomp - #### Summary - **Start time:** #{presenter.start_time}#{markdown_line_break} **Hosts:** http://localhost:3000 @@ -168,8 +158,6 @@ RSpec.describe Projects::Prometheus::AlertPresenter do shared_examples_for 'markdown with metrics embed' do let(:expected_markdown) do <<~MARKDOWN.chomp - #### Summary - **Start time:** #{presenter.start_time}#{markdown_line_break} **full_query:** `avg(metric) > 1.0` @@ -222,8 +210,6 @@ RSpec.describe Projects::Prometheus::AlertPresenter do context 'when not enough information is present for an embed' do let(:expected_markdown) do <<~MARKDOWN.chomp - #### Summary - **Start time:** #{presenter.start_time}#{markdown_line_break} **full_query:** `avg(metric) > 1.0` @@ -249,8 +235,6 @@ RSpec.describe Projects::Prometheus::AlertPresenter do context 'without full_query' do let(:expected_markdown) do <<~MARKDOWN.chomp - #### Summary - **Start time:** #{presenter.start_time} MARKDOWN |