diff options
116 files changed, 767 insertions, 187 deletions
diff --git a/.rubocop_todo/layout/space_inside_parens.yml b/.rubocop_todo/layout/space_inside_parens.yml index 8c60b40d72f..bfbbb6352b6 100644 --- a/.rubocop_todo/layout/space_inside_parens.yml +++ b/.rubocop_todo/layout/space_inside_parens.yml @@ -1,34 +1,10 @@ --- -# Cop supports --auto-correct. +# Cop supports --autocorrect. Layout/SpaceInsideParens: # Offense count: 701 # Temporarily disabled due to too many offenses Enabled: false Exclude: - - 'app/controllers/projects/environments_controller.rb' - - 'app/controllers/projects/pipeline_schedules_controller.rb' - - 'app/graphql/mutations/ci/job/base.rb' - - 'app/helpers/icons_helper.rb' - - 'app/helpers/projects_helper.rb' - - 'app/helpers/reminder_emails_helper.rb' - - 'app/models/alert_management/alert.rb' - - 'app/models/ci/build_metadata.rb' - - 'app/models/concerns/milestoneable.rb' - - 'app/models/concerns/mirror_authentication.rb' - - 'app/models/concerns/protected_ref_access.rb' - - 'app/models/cycle_analytics/project_level_stage_adapter.rb' - - 'app/models/merge_request.rb' - - 'app/models/pages_domain.rb' - - 'app/models/project.rb' - - 'app/services/ci/archive_trace_service.rb' - - 'app/services/jira_import/start_import_service.rb' - - 'app/services/labels/transfer_service.rb' - - 'app/services/packages/debian/create_distribution_service.rb' - - 'app/services/packages/debian/update_distribution_service.rb' - - 'app/services/packages/npm/create_package_service.rb' - - 'app/services/personal_access_tokens/revoke_service.rb' - - 'app/services/snippets/create_service.rb' - - 'app/services/spam/spam_verdict_service.rb' - 'config/initializers/wikicloth_redos_patch.rb' - 'db/post_migrate/20210722042939_update_issuable_slas_where_issue_closed.rb' - 'ee/app/graphql/resolvers/external_issue_resolver.rb' diff --git a/GITALY_SERVER_VERSION b/GITALY_SERVER_VERSION index 06bd7d509ce..0fdd05e194c 100644 --- a/GITALY_SERVER_VERSION +++ b/GITALY_SERVER_VERSION @@ -1 +1 @@ -bb32df05c777d0cd8a8d15249c99e2d8055e0769 +f94d4abfae5a3ee09caacd1b2dd28dca875eafa0 diff --git a/app/assets/javascripts/vue_shared/components/gitlab_version_check.vue b/app/assets/javascripts/vue_shared/components/gitlab_version_check.vue index 60282d435e0..e9f90910bb2 100644 --- a/app/assets/javascripts/vue_shared/components/gitlab_version_check.vue +++ b/app/assets/javascripts/vue_shared/components/gitlab_version_check.vue @@ -64,8 +64,9 @@ export default { if (res.data) { this.status = res.data.severity; - this.track('rendered_version_badge', { - label: this.title, + this.track('render', { + label: 'version_badge', + property: this.title, }); } }) @@ -77,7 +78,10 @@ export default { onClick() { if (!this.actionable) return; - this.track('click_version_badge', { label: this.title }); + this.track('click_link', { + label: 'version_badge', + property: this.title, + }); }, }, UPGRADE_DOCS_URL, diff --git a/app/controllers/projects/environments_controller.rb b/app/controllers/projects/environments_controller.rb index 4f037cc843e..67f2f85ce65 100644 --- a/app/controllers/projects/environments_controller.rb +++ b/app/controllers/projects/environments_controller.rb @@ -183,7 +183,7 @@ class Projects::EnvironmentsController < Projects::ApplicationController def metrics respond_to do |format| format.html do - redirect_to project_metrics_dashboard_path(project, environment: environment ) + redirect_to project_metrics_dashboard_path(project, environment: environment) end format.json do # Currently, this acts as a hint to load the metrics details into the cache diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb index 5b1117c0224..9ce4af3f56e 100644 --- a/app/controllers/projects/issues_controller.rb +++ b/app/controllers/projects/issues_controller.rb @@ -435,7 +435,11 @@ class Projects::IssuesController < Projects::ApplicationController return render_404 if issue.task? && !project.work_items_feature_flag_enabled? return unless issue.task? - redirect_to project_work_items_path(project, issue.id, params: request.query_parameters) + if Feature.enabled?(:use_iid_in_work_items_path, project.group) + redirect_to project_work_items_path(project, issue.iid, params: request.query_parameters.merge(iid_path: true)) + else + redirect_to project_work_items_path(project, issue.id, params: request.query_parameters) + end end end diff --git a/app/controllers/projects/pipeline_schedules_controller.rb b/app/controllers/projects/pipeline_schedules_controller.rb index ca787785901..31030d958df 100644 --- a/app/controllers/projects/pipeline_schedules_controller.rb +++ b/app/controllers/projects/pipeline_schedules_controller.rb @@ -98,7 +98,7 @@ class Projects::PipelineSchedulesController < Projects::ApplicationController def schedule_params params.require(:schedule) .permit(:description, :cron, :cron_timezone, :ref, :active, - variables_attributes: [:id, :variable_type, :key, :secret_value, :_destroy] ) + variables_attributes: [:id, :variable_type, :key, :secret_value, :_destroy]) end def authorize_play_pipeline_schedule! diff --git a/app/graphql/mutations/ci/job/artifacts_destroy.rb b/app/graphql/mutations/ci/job/artifacts_destroy.rb index 34c58fc1240..9171299f353 100644 --- a/app/graphql/mutations/ci/job/artifacts_destroy.rb +++ b/app/graphql/mutations/ci/job/artifacts_destroy.rb @@ -18,7 +18,7 @@ module Mutations null: false, description: 'Number of artifacts deleted.' - def find_object(id: ) + def find_object(id:) GlobalID::Locator.locate(id) end diff --git a/app/graphql/mutations/ci/job/base.rb b/app/graphql/mutations/ci/job/base.rb index 6ea8e25a58d..f68f0507b28 100644 --- a/app/graphql/mutations/ci/job/base.rb +++ b/app/graphql/mutations/ci/job/base.rb @@ -10,7 +10,7 @@ module Mutations required: true, description: 'ID of the job to mutate.' - def find_object(id: ) + def find_object(id:) GlobalID::Locator.locate(id) end end diff --git a/app/graphql/mutations/ci/job_artifact/destroy.rb b/app/graphql/mutations/ci/job_artifact/destroy.rb index 47b3535d631..add1b431fbf 100644 --- a/app/graphql/mutations/ci/job_artifact/destroy.rb +++ b/app/graphql/mutations/ci/job_artifact/destroy.rb @@ -20,7 +20,7 @@ module Mutations null: true, description: 'Deleted artifact.' - def find_object(id: ) + def find_object(id:) GlobalID::Locator.locate(id) end diff --git a/app/graphql/types/project_type.rb b/app/graphql/types/project_type.rb index a41af34ef4c..1ddc43475c3 100644 --- a/app/graphql/types/project_type.rb +++ b/app/graphql/types/project_type.rb @@ -532,6 +532,11 @@ module Types description: "Branch rules configured for the project.", resolver: Resolvers::Projects::BranchRulesResolver + field :languages, [Types::Projects::RepositoryLanguageType], + null: true, + description: "Programming languages used in the project.", + calls_gitaly: true + def timelog_categories object.project_namespace.timelog_categories if Feature.enabled?(:timelog_categories) end @@ -609,6 +614,10 @@ module Types object.service_desk_address end + def languages + ::Projects::RepositoryLanguagesService.new(project, current_user).execute + end + private def project diff --git a/app/graphql/types/projects/repository_language_type.rb b/app/graphql/types/projects/repository_language_type.rb new file mode 100644 index 00000000000..76c645c0e85 --- /dev/null +++ b/app/graphql/types/projects/repository_language_type.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module Types + module Projects + # rubocop: disable Graphql/AuthorizeTypes + class RepositoryLanguageType < BaseObject + graphql_name 'RepositoryLanguage' + + field :name, GraphQL::Types::String, null: false, + description: 'Name of the repository language.' + + field :share, GraphQL::Types::Float, null: true, + description: "Percentage of the repository's languages." + + field :color, Types::ColorType, null: true, + description: 'Color to visualize the repository language.' + end + # rubocop: enable Graphql/AuthorizeTypes + end +end diff --git a/app/helpers/icons_helper.rb b/app/helpers/icons_helper.rb index 6f7ac069fe4..5ecf32fc3f3 100644 --- a/app/helpers/icons_helper.rb +++ b/app/helpers/icons_helper.rb @@ -42,7 +42,7 @@ module IconsHelper content_tag( :svg, - content_tag(:use, '', { 'href' => "#{sprite_icon_path}##{icon_name}" } ), + content_tag(:use, '', { 'href' => "#{sprite_icon_path}##{icon_name}" }), class: css_classes.empty? ? nil : css_classes.join(' '), data: { testid: "#{icon_name}-icon" } ) diff --git a/app/helpers/issuables_helper.rb b/app/helpers/issuables_helper.rb index 2804a58da9e..e9e6241a6a7 100644 --- a/app/helpers/issuables_helper.rb +++ b/app/helpers/issuables_helper.rb @@ -157,9 +157,9 @@ module IssuablesHelper if issuable.respond_to?(:work_item_type) && WorkItems::Type::WI_TYPES_WITH_CREATED_HEADER.include?(issuable.work_item_type.base_type) output << content_tag(:span, sprite_icon("#{issuable.work_item_type.icon_name}", css_class: 'gl-icon gl-vertical-align-middle gl-text-gray-500'), class: 'gl-mr-2', aria: { hidden: 'true' }) - output << content_tag(:span, s_('IssuableStatus|%{wi_type} created %{created_at} by ').html_safe % { wi_type: issuable.issue_type.capitalize, created_at: time_ago_with_tooltip(issuable.created_at) }, class: 'gl-mr-2' ) + output << content_tag(:span, s_('IssuableStatus|%{wi_type} created %{created_at} by ').html_safe % { wi_type: issuable.issue_type.capitalize, created_at: time_ago_with_tooltip(issuable.created_at) }, class: 'gl-mr-2') else - output << content_tag(:span, s_('IssuableStatus|Created %{created_at} by').html_safe % { created_at: time_ago_with_tooltip(issuable.created_at) }, class: 'gl-mr-2' ) + output << content_tag(:span, s_('IssuableStatus|Created %{created_at} by').html_safe % { created_at: time_ago_with_tooltip(issuable.created_at) }, class: 'gl-mr-2') end if issuable.is_a?(Issue) && issuable.service_desk_reply_to diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index cddcdf77710..122a0ae5277 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -69,7 +69,7 @@ module ProjectsHelper if opts[:name] inject_classes.concat(["js-user-link", opts[:mobile_classes]]) else - inject_classes.append( "has-tooltip" ) + inject_classes.append("has-tooltip") end inject_classes = inject_classes.compact.join(" ") diff --git a/app/helpers/reminder_emails_helper.rb b/app/helpers/reminder_emails_helper.rb index 132fc3b784c..e46d9273100 100644 --- a/app/helpers/reminder_emails_helper.rb +++ b/app/helpers/reminder_emails_helper.rb @@ -41,7 +41,7 @@ module ReminderEmailsHelper body = invitation_reminder_body_text(reminder_index) - (format == :html ? html_escape(body) : body ) % options + (format == :html ? html_escape(body) : body) % options end def invitation_reminder_accept_link(token, format: nil) diff --git a/app/helpers/routing/projects_helper.rb b/app/helpers/routing/projects_helper.rb index 8c0bd9b1ecc..d0991196c4d 100644 --- a/app/helpers/routing/projects_helper.rb +++ b/app/helpers/routing/projects_helper.rb @@ -43,7 +43,14 @@ module Routing end def work_item_url(entity, *args) - project_work_items_url(entity.project, entity.id, *args) + unless Feature.enabled?(:use_iid_in_work_items_path, entity.project.group) + return project_work_items_url(entity.project, entity.id, *args) + end + + options = args.first || {} + options[:iid_path] = true + + project_work_items_url(entity.project, entity.iid, **options) end def merge_request_url(entity, *args) diff --git a/app/models/ci/build_metadata.rb b/app/models/ci/build_metadata.rb index b4f10758c1d..ae35e0c8d43 100644 --- a/app/models/ci/build_metadata.rb +++ b/app/models/ci/build_metadata.rb @@ -51,7 +51,7 @@ module Ci end def set_cancel_gracefully - runtime_runner_features.merge!( { cancel_gracefully: true } ) + runtime_runner_features.merge!({ cancel_gracefully: true }) end def cancel_gracefully? diff --git a/app/models/concerns/milestoneable.rb b/app/models/concerns/milestoneable.rb index 14c54d99ef3..a95bed7ad42 100644 --- a/app/models/concerns/milestoneable.rb +++ b/app/models/concerns/milestoneable.rb @@ -18,7 +18,7 @@ module Milestoneable scope :with_milestone, ->(title) { left_joins_milestones.where(milestones: { title: title }) } scope :without_particular_milestones, ->(titles) { left_outer_joins(:milestone).where("milestones.title NOT IN (?) OR milestone_id IS NULL", titles) } scope :any_release, -> { joins_milestone_releases } - scope :with_release, -> (tag, project_id) { joins_milestone_releases.where( milestones: { releases: { tag: tag, project_id: project_id } } ) } + scope :with_release, -> (tag, project_id) { joins_milestone_releases.where(milestones: { releases: { tag: tag, project_id: project_id } }) } scope :without_particular_release, -> (tag, project_id) { joins_milestone_releases.where.not(milestones: { releases: { tag: tag, project_id: project_id } }) } scope :left_joins_milestones, -> { joins("LEFT OUTER JOIN milestones ON #{table_name}.milestone_id = milestones.id") } diff --git a/app/models/concerns/mirror_authentication.rb b/app/models/concerns/mirror_authentication.rb index 14c8be93ce0..e3bfeaf7f95 100644 --- a/app/models/concerns/mirror_authentication.rb +++ b/app/models/concerns/mirror_authentication.rb @@ -11,7 +11,7 @@ module MirrorAuthentication # We should generate a key even if there's no SSH URL present before_validation :generate_ssh_private_key!, if: -> { - regenerate_ssh_private_key || ( auth_method == 'ssh_public_key' && ssh_private_key.blank? ) + regenerate_ssh_private_key || (auth_method == 'ssh_public_key' && ssh_private_key.blank?) } credentials_field :auth_method, reader: false diff --git a/app/models/concerns/protected_ref_access.rb b/app/models/concerns/protected_ref_access.rb index 618ad96905d..facf0808e7a 100644 --- a/app/models/concerns/protected_ref_access.rb +++ b/app/models/concerns/protected_ref_access.rb @@ -21,8 +21,8 @@ module ProtectedRefAccess included do scope :maintainer, -> { where(access_level: Gitlab::Access::MAINTAINER) } scope :developer, -> { where(access_level: Gitlab::Access::DEVELOPER) } - scope :by_user, -> (user) { where(user_id: user ) } - scope :by_group, -> (group) { where(group_id: group ) } + scope :by_user, -> (user) { where(user_id: user) } + scope :by_group, -> (group) { where(group_id: group) } scope :for_role, -> { where(user_id: nil, group_id: nil) } scope :for_user, -> { where.not(user_id: nil) } scope :for_group, -> { where.not(group_id: nil) } diff --git a/app/models/cycle_analytics/project_level_stage_adapter.rb b/app/models/cycle_analytics/project_level_stage_adapter.rb index 5538e93a39e..9b9c0822f63 100644 --- a/app/models/cycle_analytics/project_level_stage_adapter.rb +++ b/app/models/cycle_analytics/project_level_stage_adapter.rb @@ -4,7 +4,7 @@ # compatible with the old value stream controller actions. module CycleAnalytics class ProjectLevelStageAdapter - ProjectLevelStage = Struct.new(:title, :description, :legend, :name, :project_median, keyword_init: true ) + ProjectLevelStage = Struct.new(:title, :description, :legend, :name, :project_median, keyword_init: true) def initialize(stage, options) @stage = stage diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 0f47e6d3936..220dd104335 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -1677,7 +1677,7 @@ class MergeRequest < ApplicationRecord # TODO: consider renaming this as with exposed artifacts we generate reports, # not always compare # issue: https://gitlab.com/gitlab-org/gitlab/issues/34224 - def compare_reports(service_class, current_user = nil, report_type = nil, additional_params = {} ) + def compare_reports(service_class, current_user = nil, report_type = nil, additional_params = {}) with_reactive_cache(service_class.name, current_user&.id, report_type) do |data| unless service_class.new(project, current_user, id: id, report_type: report_type, additional_params: additional_params) .latest?(comparison_base_pipeline(service_class.name), actual_head_pipeline, data) diff --git a/app/models/pages_domain.rb b/app/models/pages_domain.rb index 16d5492a65e..8b15db7badc 100644 --- a/app/models/pages_domain.rb +++ b/app/models/pages_domain.rb @@ -50,7 +50,7 @@ class PagesDomain < ApplicationRecord scope :for_project, ->(project) { where(project: project) } - scope :enabled, -> { where('enabled_until >= ?', Time.current ) } + scope :enabled, -> { where('enabled_until >= ?', Time.current) } scope :needs_verification, -> do verified_at = arel_table[:verified_at] enabled_until = arel_table[:enabled_until] diff --git a/app/models/project.rb b/app/models/project.rb index 7b61010ab01..7accc208fc6 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -1616,7 +1616,7 @@ class Project < ApplicationRecord end def all_clusters - group_clusters = Clusters::Cluster.joins(:groups).where(cluster_groups: { group_id: ancestors_upto } ) + group_clusters = Clusters::Cluster.joins(:groups).where(cluster_groups: { group_id: ancestors_upto }) instance_clusters = Clusters::Cluster.instance_type Clusters::Cluster.from_union([clusters, group_clusters, instance_clusters]) diff --git a/app/models/wiki.rb b/app/models/wiki.rb index b718c3a096f..7d695537632 100644 --- a/app/models/wiki.rb +++ b/app/models/wiki.rb @@ -552,7 +552,7 @@ class Wiki def fetch_pages_content!(pages) blobs = repository - .blobs_at(pages.map { |page| [default_branch, page.path] } ) + .blobs_at(pages.map { |page| [default_branch, page.path] }) .to_h { |blob| [blob.path, blob.data] } pages.each do |page| diff --git a/app/services/ci/archive_trace_service.rb b/app/services/ci/archive_trace_service.rb index 566346a4b09..3d548c824c8 100644 --- a/app/services/ci/archive_trace_service.rb +++ b/app/services/ci/archive_trace_service.rb @@ -68,7 +68,7 @@ module Ci Gitlab::ErrorTracking .track_and_raise_for_dev_exception(error, issue_url: 'https://gitlab.com/gitlab-org/gitlab-foss/issues/51502', - job_id: job.id ) + job_id: job.id) end end end diff --git a/app/services/jira_import/start_import_service.rb b/app/services/jira_import/start_import_service.rb index 4d1f2c94ac8..9cd56cf339e 100644 --- a/app/services/jira_import/start_import_service.rb +++ b/app/services/jira_import/start_import_service.rb @@ -40,7 +40,7 @@ module JiraImport project.import_type = 'jira' project.save! && jira_import.schedule! - ServiceResponse.success(payload: { import_data: jira_import } ) + ServiceResponse.success(payload: { import_data: jira_import }) rescue StandardError => ex # in case project.save! raises an error Gitlab::ErrorTracking.track_exception(ex, project_id: project.id) diff --git a/app/services/labels/transfer_service.rb b/app/services/labels/transfer_service.rb index a79e5b00232..79e807d8010 100644 --- a/app/services/labels/transfer_service.rb +++ b/app/services/labels/transfer_service.rb @@ -51,7 +51,7 @@ module Labels # rubocop: disable CodeReuse/ActiveRecord def group_labels_applied_to_issues @labels_applied_to_issues ||= Label.joins(:issues) - .joins("INNER JOIN namespaces on namespaces.id = labels.group_id AND namespaces.type = 'Group'" ) + .joins("INNER JOIN namespaces on namespaces.id = labels.group_id AND namespaces.type = 'Group'") .where(issues: { project_id: project.id }).reorder(nil) end # rubocop: enable CodeReuse/ActiveRecord @@ -59,7 +59,7 @@ module Labels # rubocop: disable CodeReuse/ActiveRecord def group_labels_applied_to_merge_requests @labels_applied_to_mrs ||= Label.joins(:merge_requests) - .joins("INNER JOIN namespaces on namespaces.id = labels.group_id AND namespaces.type = 'Group'" ) + .joins("INNER JOIN namespaces on namespaces.id = labels.group_id AND namespaces.type = 'Group'") .where(merge_requests: { target_project_id: project.id }).reorder(nil) end # rubocop: enable CodeReuse/ActiveRecord diff --git a/app/services/packages/debian/create_distribution_service.rb b/app/services/packages/debian/create_distribution_service.rb index b4b1ec952ef..218423bb8e3 100644 --- a/app/services/packages/debian/create_distribution_service.rb +++ b/app/services/packages/debian/create_distribution_service.rb @@ -61,7 +61,7 @@ module Packages create_objects(distribution.architectures, architectures, error_label: 'Architecture') end - def create_objects(objects, object_names_from_params, error_label: ) + def create_objects(objects, object_names_from_params, error_label:) object_names_from_params.each do |name| new_object = objects.create(name: name) append_errors(new_object, error_label) diff --git a/app/services/packages/debian/update_distribution_service.rb b/app/services/packages/debian/update_distribution_service.rb index 218167ecdc5..5096bd5361f 100644 --- a/app/services/packages/debian/update_distribution_service.rb +++ b/app/services/packages/debian/update_distribution_service.rb @@ -58,7 +58,7 @@ module Packages update_objects(distribution.architectures, architectures, error_label: 'Architecture') end - def update_objects(objects, object_names_from_params, error_label: ) + def update_objects(objects, object_names_from_params, error_label:) current_object_names = objects.map(&:name) missing_object_names = object_names_from_params - current_object_names extra_object_names = current_object_names - object_names_from_params diff --git a/app/services/packages/npm/create_package_service.rb b/app/services/packages/npm/create_package_service.rb index a3596314199..dd074f7472b 100644 --- a/app/services/packages/npm/create_package_service.rb +++ b/app/services/packages/npm/create_package_service.rb @@ -81,7 +81,7 @@ module Packages # - https://blog.aaronlenoir.com/2017/11/10/get-original-length-from-base-64-string/ # - https://en.wikipedia.org/wiki/Base64#Decoding_Base64_with_padding encoded_data = attachment['data'] - ((encoded_data.length * 0.75 ) - encoded_data[-2..].count('=')).to_i + ((encoded_data.length * 0.75) - encoded_data[-2..].count('=')).to_i end end diff --git a/app/services/personal_access_tokens/revoke_service.rb b/app/services/personal_access_tokens/revoke_service.rb index 732da75da3a..5371b6c91ef 100644 --- a/app/services/personal_access_tokens/revoke_service.rb +++ b/app/services/personal_access_tokens/revoke_service.rb @@ -4,7 +4,7 @@ module PersonalAccessTokens class RevokeService < BaseService attr_reader :token, :current_user, :group - def initialize(current_user = nil, token: nil, group: nil ) + def initialize(current_user = nil, token: nil, group: nil) @current_user = current_user @token = token @group = group diff --git a/app/services/snippets/create_service.rb b/app/services/snippets/create_service.rb index e0bab4cd6ad..5cadff42958 100644 --- a/app/services/snippets/create_service.rb +++ b/app/services/snippets/create_service.rb @@ -34,7 +34,7 @@ module Snippets move_temporary_files - ServiceResponse.success(payload: { snippet: @snippet } ) + ServiceResponse.success(payload: { snippet: @snippet }) else snippet_error_response(@snippet, 400) end diff --git a/app/services/spam/spam_verdict_service.rb b/app/services/spam/spam_verdict_service.rb index 08634ec840c..0dcb3546034 100644 --- a/app/services/spam/spam_verdict_service.rb +++ b/app/services/spam/spam_verdict_service.rb @@ -24,7 +24,7 @@ module Spam label = spamcheck_error ? 'ERROR' : spamcheck_result.to_s.upcase - histogram.observe( { result: label }, external_spam_check_round_trip_time ) + histogram.observe({ result: label }, external_spam_check_round_trip_time) # assign result to a var for logging it before reassigning to nil when monitorMode is true original_spamcheck_result = spamcheck_result diff --git a/app/services/work_items/widgets/hierarchy_service/base_service.rb b/app/services/work_items/widgets/hierarchy_service/base_service.rb index bb681ef0083..8418bc4c5a7 100644 --- a/app/services/work_items/widgets/hierarchy_service/base_service.rb +++ b/app/services/work_items/widgets/hierarchy_service/base_service.rb @@ -65,7 +65,7 @@ module WorkItems end def invalid_args_error(params) - error(_("One or more arguments are invalid: %{args}." % { args: params.keys.to_sentence } )) + error(_("One or more arguments are invalid: %{args}." % { args: params.keys.to_sentence })) end def service_response!(result) diff --git a/app/views/layouts/header/_gitlab_version.html.haml b/app/views/layouts/header/_gitlab_version.html.haml index 80020e27741..875a89e1d9b 100644 --- a/app/views/layouts/header/_gitlab_version.html.haml +++ b/app/views/layouts/header/_gitlab_version.html.haml @@ -5,8 +5,9 @@ href: help_page_path('update/index'), data: { testid: 'gitlab-version-container', - track_action: 'click_version_help_dropdown', - track_label: "#{Gitlab.version_info.major}.#{Gitlab.version_info.minor}" + track_action: 'click_link', + track_label: 'version_help_dropdown', + track_property: "#{Gitlab.version_info.major}.#{Gitlab.version_info.minor}" } } %span diff --git a/config/feature_flags/development/use_iid_in_work_items_path.yml b/config/feature_flags/development/use_iid_in_work_items_path.yml new file mode 100644 index 00000000000..d2d328bbbc1 --- /dev/null +++ b/config/feature_flags/development/use_iid_in_work_items_path.yml @@ -0,0 +1,8 @@ +--- +name: use_iid_in_work_items_path +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/101451 +rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/378349 +milestone: '15.5' +type: development +group: group::project management +default_enabled: false diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb index ea22b6fdbc0..3accc1d3143 100644 --- a/config/initializers/1_settings.rb +++ b/config/initializers/1_settings.rb @@ -1023,6 +1023,7 @@ Settings.monitoring.sidekiq_health_checks['port'] ||= 8092 Settings.monitoring['web_exporter'] ||= Settingslogic.new({}) Settings.monitoring.web_exporter['enabled'] ||= false +Settings.monitoring.web_exporter['log_enabled'] ||= true Settings.monitoring.web_exporter['address'] ||= 'localhost' Settings.monitoring.web_exporter['port'] ||= 8083 Settings.monitoring.web_exporter['tls_enabled'] ||= false diff --git a/db/post_migrate/20221010162137_add_index_author_id_and_id_on_merge_requests.rb b/db/post_migrate/20221010162137_add_index_author_id_and_id_on_merge_requests.rb new file mode 100644 index 00000000000..36184b5f573 --- /dev/null +++ b/db/post_migrate/20221010162137_add_index_author_id_and_id_on_merge_requests.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class AddIndexAuthorIdAndIdOnMergeRequests < Gitlab::Database::Migration[2.0] + INDEX_NAME = 'index_merge_requests_on_author_id_and_id' + + disable_ddl_transaction! + + def up + add_concurrent_index :merge_requests, %i[author_id id], name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :merge_requests, INDEX_NAME + end +end diff --git a/db/schema_migrations/20221010162137 b/db/schema_migrations/20221010162137 new file mode 100644 index 00000000000..567b788a5c6 --- /dev/null +++ b/db/schema_migrations/20221010162137 @@ -0,0 +1 @@ +c9f5827072920fdc52efeaf1ab39c67c48896a6288c5720e4be96070340ce6d8
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 0a37fee1686..08f749b211d 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -29520,6 +29520,8 @@ CREATE INDEX index_merge_requests_on_assignee_id ON merge_requests USING btree ( CREATE INDEX index_merge_requests_on_author_id ON merge_requests USING btree (author_id); +CREATE INDEX index_merge_requests_on_author_id_and_id ON merge_requests USING btree (author_id, id); + CREATE INDEX index_merge_requests_on_author_id_and_target_project_id ON merge_requests USING btree (author_id, target_project_id); CREATE INDEX index_merge_requests_on_created_at ON merge_requests USING btree (created_at); diff --git a/doc/.vale/gitlab/Admin.yml b/doc/.vale/gitlab/Admin.yml index 78a86e27456..6160eb85c8e 100644 --- a/doc/.vale/gitlab/Admin.yml +++ b/doc/.vale/gitlab/Admin.yml @@ -3,7 +3,7 @@ # # Checks for "admin" and recommends using the full word instead. "Admin Area" is OK. # -# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: substitution message: 'Verify this use of the word "admin". Can it be updated to "administration", "administrator", "administer", or "Admin Area"?' link: https://docs.gitlab.com/ee/development/documentation/styleguide/index.html diff --git a/doc/.vale/gitlab/AlertBoxStyle.yml b/doc/.vale/gitlab/AlertBoxStyle.yml index 5912c4707fd..299bd334eed 100644 --- a/doc/.vale/gitlab/AlertBoxStyle.yml +++ b/doc/.vale/gitlab/AlertBoxStyle.yml @@ -7,7 +7,7 @@ # - Alert boxes with the note text on the same line # - Alert boxes using words other than "NOTE" or "WARNING" # -# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: existence message: 'Alert box "%s" must use the formatting in the style guide.' link: https://docs.gitlab.com/ee/development/documentation/styleguide/index.html#alert-boxes diff --git a/doc/.vale/gitlab/BadPlurals.yml b/doc/.vale/gitlab/BadPlurals.yml index 533805c67b0..a1f53855de2 100644 --- a/doc/.vale/gitlab/BadPlurals.yml +++ b/doc/.vale/gitlab/BadPlurals.yml @@ -3,7 +3,7 @@ # # Don't write plural words with the '(s)' construction. "HTTP(S)" is acceptable. # -# For a list of all options, see https://docs.errata.ai/vale/styles +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: existence message: 'Rewrite "%s" to be plural, without parentheses.' link: https://docs.gitlab.com/ee/development/documentation/styleguide/word_list.html#s diff --git a/doc/.vale/gitlab/BadgeCapitalization.yml b/doc/.vale/gitlab/BadgeCapitalization.yml index 33425693d53..b98ebf334e4 100644 --- a/doc/.vale/gitlab/BadgeCapitalization.yml +++ b/doc/.vale/gitlab/BadgeCapitalization.yml @@ -3,7 +3,7 @@ # # Verifies that badges are not mixed case, which won't render properly. # -# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: existence message: 'Badge "%s" must be capitalized.' link: https://docs.gitlab.com/ee/development/documentation/styleguide/index.html#product-tier-badges diff --git a/doc/.vale/gitlab/British.yml b/doc/.vale/gitlab/British.yml index c63cbd917c7..11652e41da7 100644 --- a/doc/.vale/gitlab/British.yml +++ b/doc/.vale/gitlab/British.yml @@ -3,7 +3,7 @@ # # Checks that US spelling is used instead of British spelling. # -# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: substitution message: 'Use the US spelling "%s" instead of the British "%s".' link: https://docs.gitlab.com/ee/development/documentation/styleguide/index.html#language diff --git a/doc/.vale/gitlab/CIConfigFile.yml b/doc/.vale/gitlab/CIConfigFile.yml index 5a65e51ea16..98fa1aa78e8 100644 --- a/doc/.vale/gitlab/CIConfigFile.yml +++ b/doc/.vale/gitlab/CIConfigFile.yml @@ -3,7 +3,7 @@ # # Checks that the `.gitlab-ci.yml` file is referenced properly. # -# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: existence message: 'The CI/CD configuration file should be exactly: `.gitlab-ci.yml`' link: https://docs.gitlab.com/ee/development/documentation/versions.html diff --git a/doc/.vale/gitlab/CodeblockFences.yml b/doc/.vale/gitlab/CodeblockFences.yml index 6c2d94e7b8d..6b7ad8d08b3 100644 --- a/doc/.vale/gitlab/CodeblockFences.yml +++ b/doc/.vale/gitlab/CodeblockFences.yml @@ -3,7 +3,7 @@ # # Ensures all codeblock language tags use the full name, not aliases. # -# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: existence message: 'Syntax highlighting hint "%s" must be one of: yaml, ruby, plaintext, markdown, javascript, shell, golang, python, dockerfile, or typescript.' link: https://docs.gitlab.com/ee/development/documentation/styleguide/index.html#code-blocks diff --git a/doc/.vale/gitlab/CurlStringsQuoted.yml b/doc/.vale/gitlab/CurlStringsQuoted.yml index a59fe64d990..8646ad45608 100644 --- a/doc/.vale/gitlab/CurlStringsQuoted.yml +++ b/doc/.vale/gitlab/CurlStringsQuoted.yml @@ -3,7 +3,7 @@ # # Ensures all code blocks using `curl` wrap URL strings in quotation marks. # -# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: existence message: 'For consistency across all cURL examples, always wrap the URL in double quotes ("): %s' link: https://docs.gitlab.com/ee/development/documentation/restful_api_styleguide.html#curl-commands diff --git a/doc/.vale/gitlab/CurrentStatus.yml b/doc/.vale/gitlab/CurrentStatus.yml index 040fd3d8a8f..213f470cb43 100644 --- a/doc/.vale/gitlab/CurrentStatus.yml +++ b/doc/.vale/gitlab/CurrentStatus.yml @@ -3,7 +3,7 @@ # # Checks for words that indicate a product or feature may change in the future. # -# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: existence message: 'Avoid words like "%s" when you write about future features. Our documentation is about the current state of the product.' level: suggestion diff --git a/doc/.vale/gitlab/DefaultBranch.yml b/doc/.vale/gitlab/DefaultBranch.yml index 4bc68433c6d..1ac7b84c440 100644 --- a/doc/.vale/gitlab/DefaultBranch.yml +++ b/doc/.vale/gitlab/DefaultBranch.yml @@ -3,7 +3,7 @@ # # Do not refer to the default branch as the "master" branch, if possible. # -# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: existence message: 'Use "default branch" or `main` instead of `master`, when possible.' level: warning diff --git a/doc/.vale/gitlab/Dropdown.yml b/doc/.vale/gitlab/Dropdown.yml index 691d44d1a48..6163e765989 100644 --- a/doc/.vale/gitlab/Dropdown.yml +++ b/doc/.vale/gitlab/Dropdown.yml @@ -3,7 +3,7 @@ # # Catches many ways the phrase 'dropdown list' can be fumbled. # -# For a list of all options, see https://errata-ai.github.io/vale/styles/ +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: existence message: 'Use "dropdown list".' link: https://docs.gitlab.com/ee/development/documentation/styleguide/word_list.html#dropdown-list diff --git a/doc/.vale/gitlab/EOLWhitespace.yml b/doc/.vale/gitlab/EOLWhitespace.yml index e160b706014..64f505b2bae 100644 --- a/doc/.vale/gitlab/EOLWhitespace.yml +++ b/doc/.vale/gitlab/EOLWhitespace.yml @@ -3,7 +3,7 @@ # # Checks that there is no useless whitespace at the end of lines. # -# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: existence message: 'Lines should not end with whitespace characters.' link: https://docs.gitlab.com/ee/development/documentation/versions.html diff --git a/doc/.vale/gitlab/ElementDescriptors.yml b/doc/.vale/gitlab/ElementDescriptors.yml index 36f1202aef1..06121492e99 100644 --- a/doc/.vale/gitlab/ElementDescriptors.yml +++ b/doc/.vale/gitlab/ElementDescriptors.yml @@ -3,7 +3,7 @@ # # Suggests the correct way to describe elements in a form. # -# For a list of all options, see https://errata-ai.github.io/vale/styles/ +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: substitution message: 'When describing elements, %s "%s".' link: https://docs.gitlab.com/ee/development/documentation/styleguide/index.html#language diff --git a/doc/.vale/gitlab/FirstPerson.yml b/doc/.vale/gitlab/FirstPerson.yml index 6fc93d9515c..ab7855a78db 100644 --- a/doc/.vale/gitlab/FirstPerson.yml +++ b/doc/.vale/gitlab/FirstPerson.yml @@ -3,7 +3,7 @@ # # Checks for use of first person pronouns. # -# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: existence message: '"%s" is a first-person pronoun. Use second- or third-person pronouns (like we, you, us, one) instead.' level: warning diff --git a/doc/.vale/gitlab/FutureTense.yml b/doc/.vale/gitlab/FutureTense.yml index 64e79612fff..0809f5f9063 100644 --- a/doc/.vale/gitlab/FutureTense.yml +++ b/doc/.vale/gitlab/FutureTense.yml @@ -3,7 +3,7 @@ # # Checks for use of future tense in sentences. Present tense is strongly preferred. # -# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: existence message: 'Avoid using future tense: "%s". Use present tense instead.' ignorecase: true diff --git a/doc/.vale/gitlab/HeadingContent.yml b/doc/.vale/gitlab/HeadingContent.yml index c2dd2a5c6c2..50af625ce19 100644 --- a/doc/.vale/gitlab/HeadingContent.yml +++ b/doc/.vale/gitlab/HeadingContent.yml @@ -3,7 +3,7 @@ # # Checks for generic, unhelpful subheadings. # -# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: existence message: 'Rename the subheading "%s", or re-purpose the content elsewhere.' level: warning diff --git a/doc/.vale/gitlab/InclusionAbleism.yml b/doc/.vale/gitlab/InclusionAbleism.yml index 1ebb6a97cf8..66d89a26717 100644 --- a/doc/.vale/gitlab/InclusionAbleism.yml +++ b/doc/.vale/gitlab/InclusionAbleism.yml @@ -3,7 +3,7 @@ # # Suggests alternatives for words that foster ableism. # -# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: substitution message: 'Use inclusive language. Consider "%s" instead of "%s".' link: https://docs.gitlab.com/ee/development/documentation/styleguide/index.html#inclusive-language diff --git a/doc/.vale/gitlab/InclusionCultural.yml b/doc/.vale/gitlab/InclusionCultural.yml index 6f63d1725fc..94662d4bc42 100644 --- a/doc/.vale/gitlab/InclusionCultural.yml +++ b/doc/.vale/gitlab/InclusionCultural.yml @@ -3,7 +3,7 @@ # # Suggests alternatives for words that are culturally inappropriate. # -# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: substitution message: 'Use inclusive language. Consider "%s" instead of "%s".' link: https://docs.gitlab.com/ee/development/documentation/styleguide/index.html#inclusive-language diff --git a/doc/.vale/gitlab/InclusionGender.yml b/doc/.vale/gitlab/InclusionGender.yml index 313a1cc42dc..62302d21ae7 100644 --- a/doc/.vale/gitlab/InclusionGender.yml +++ b/doc/.vale/gitlab/InclusionGender.yml @@ -3,7 +3,7 @@ # # Suggests alternatives for words that are gender-specific. # -# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: substitution message: 'Use inclusive language. Consider "%s" instead of "%s".' link: https://docs.gitlab.com/ee/development/documentation/styleguide/index.html#inclusive-language diff --git a/doc/.vale/gitlab/InternalLinkCase.yml b/doc/.vale/gitlab/InternalLinkCase.yml index c00e633426b..3e40f9f4a61 100644 --- a/doc/.vale/gitlab/InternalLinkCase.yml +++ b/doc/.vale/gitlab/InternalLinkCase.yml @@ -3,7 +3,7 @@ # # Checks that anchor fragments on internal links are in lower-case. # -# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: existence message: 'Links to subheadings in GitLab docs must be in lower-case: "%s"' link: https://docs.gitlab.com/ee/development/documentation/styleguide/index.html#links-to-internal-documentation diff --git a/doc/.vale/gitlab/InternalLinkExtension.yml b/doc/.vale/gitlab/InternalLinkExtension.yml index 52142b50dfc..45794708a3f 100644 --- a/doc/.vale/gitlab/InternalLinkExtension.yml +++ b/doc/.vale/gitlab/InternalLinkExtension.yml @@ -3,7 +3,7 @@ # # Checks that internal links have .md extenstion and not .html extension. # -# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: existence message: 'Link "%s" must link directly to a file and use the .md file extension.' link: https://docs.gitlab.com/ee/development/documentation/styleguide/index.html#links-to-internal-documentation diff --git a/doc/.vale/gitlab/InternalLinkFormat.yml b/doc/.vale/gitlab/InternalLinkFormat.yml index b9ee83b7f5c..d5572d8d485 100644 --- a/doc/.vale/gitlab/InternalLinkFormat.yml +++ b/doc/.vale/gitlab/InternalLinkFormat.yml @@ -3,7 +3,7 @@ # # Checks that internal link paths don't start with "./", which is not needed. # -# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: existence message: 'Link "%s" must not start with "./".' link: https://docs.gitlab.com/ee/development/documentation/styleguide/index.html#links-to-internal-documentation diff --git a/doc/.vale/gitlab/LatinTerms.yml b/doc/.vale/gitlab/LatinTerms.yml index 12553a801a1..306ffb08355 100644 --- a/doc/.vale/gitlab/LatinTerms.yml +++ b/doc/.vale/gitlab/LatinTerms.yml @@ -3,7 +3,7 @@ # # Checks for use of Latin terms. # -# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: substitution message: 'Use "%s" instead of "%s", but consider rewriting the sentence.' link: https://docs.gitlab.com/ee/development/documentation/styleguide/index.html#usage-list diff --git a/doc/.vale/gitlab/Markdown_emoji.yml b/doc/.vale/gitlab/Markdown_emoji.yml index ac0dab2d69d..2cb4f54859e 100644 --- a/doc/.vale/gitlab/Markdown_emoji.yml +++ b/doc/.vale/gitlab/Markdown_emoji.yml @@ -3,7 +3,7 @@ # # Check for use of GLFM emoji syntax (https://docs.gitlab.com/ee/user/markdown.html#emojis), which doesn't render correctly in documentation. # -# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: existence message: 'This appears to be GLFM emoji syntax. Replace "%s" with GitLab SVGs or Unicode emojis.' link: https://docs.gitlab.com/ee/development/documentation/styleguide/#gitlab-svg-icons diff --git a/doc/.vale/gitlab/MeaningfulLinkWords.yml b/doc/.vale/gitlab/MeaningfulLinkWords.yml index 4a255e5aae4..c13ec2f0221 100644 --- a/doc/.vale/gitlab/MeaningfulLinkWords.yml +++ b/doc/.vale/gitlab/MeaningfulLinkWords.yml @@ -3,7 +3,7 @@ # # Checks for the presence of semantically unhelpful words in link text. # -# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: existence message: 'Improve SEO and accessibility by rewriting "%s" in the link text.' level: warning diff --git a/doc/.vale/gitlab/MergeConflictMarkers.yml b/doc/.vale/gitlab/MergeConflictMarkers.yml index 4f216ac34c5..bbe01820a84 100644 --- a/doc/.vale/gitlab/MergeConflictMarkers.yml +++ b/doc/.vale/gitlab/MergeConflictMarkers.yml @@ -3,7 +3,7 @@ # # Checks for the presence of merge conflict markers. # -# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: existence message: 'Merge conflict marker "%s" found.' link: https://docs.gitlab.com/ee/development/code_review.html#merging-a-merge-request diff --git a/doc/.vale/gitlab/MultiLineLinks.yml b/doc/.vale/gitlab/MultiLineLinks.yml index 64ad017f16c..3e73306e97d 100644 --- a/doc/.vale/gitlab/MultiLineLinks.yml +++ b/doc/.vale/gitlab/MultiLineLinks.yml @@ -3,7 +3,7 @@ # # Checks that links are all on a single line. # -# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: existence message: 'Link "%s" must be on a single line, even if very long.' link: https://docs.gitlab.com/ee/development/documentation/styleguide/index.html#basic-link-criteria diff --git a/doc/.vale/gitlab/NonStandardQuotes.yml b/doc/.vale/gitlab/NonStandardQuotes.yml index f31d615eb19..c214488dfc0 100644 --- a/doc/.vale/gitlab/NonStandardQuotes.yml +++ b/doc/.vale/gitlab/NonStandardQuotes.yml @@ -3,7 +3,7 @@ # # Use only standard single and double quotes, not left or right quotes. # -# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: existence message: 'Use standard single quotes or double quotes only. Do not use left or right quotes.' level: warning diff --git a/doc/.vale/gitlab/OutdatedVersions.yml b/doc/.vale/gitlab/OutdatedVersions.yml index f25de44ad17..b469304977e 100644 --- a/doc/.vale/gitlab/OutdatedVersions.yml +++ b/doc/.vale/gitlab/OutdatedVersions.yml @@ -3,7 +3,7 @@ # # Checks for references to versions of GitLab that are no longer supported. # -# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: existence message: 'Can this reference to "%s" be refactored?' link: https://docs.gitlab.com/ee/development/documentation/styleguide/index.html#gitlab-versions diff --git a/doc/.vale/gitlab/OxfordComma.yml b/doc/.vale/gitlab/OxfordComma.yml index 1716145b26a..814b0157699 100644 --- a/doc/.vale/gitlab/OxfordComma.yml +++ b/doc/.vale/gitlab/OxfordComma.yml @@ -3,7 +3,7 @@ # # Checks for the lack of an Oxford comma. In some cases, will catch overly complex sentence structures with lots of commas. # -# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: existence message: 'Use a comma before the last "and" or "or" in a list of four or more items.' link: https://docs.gitlab.com/ee/development/documentation/styleguide/index.html#punctuation diff --git a/doc/.vale/gitlab/Possessive.yml b/doc/.vale/gitlab/Possessive.yml index 92ae66543a2..8f4f93ab93c 100644 --- a/doc/.vale/gitlab/Possessive.yml +++ b/doc/.vale/gitlab/Possessive.yml @@ -3,7 +3,7 @@ # # The word GitLab should not be used in the possessive form. # -# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: existence message: "Rewrite '%s' to not use 's." level: error diff --git a/doc/.vale/gitlab/ReadingLevel.yml b/doc/.vale/gitlab/ReadingLevel.yml index cd7597ee8dc..ca3ddea46bf 100644 --- a/doc/.vale/gitlab/ReadingLevel.yml +++ b/doc/.vale/gitlab/ReadingLevel.yml @@ -4,6 +4,8 @@ # Checks the Flesch-Kincaid reading level. # # https://docs.errata.ai/vale/styles#metric +# +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: metric message: "The grade level - %s - refers to how hard the content is to understand. Aim for 8th grade or lower by using shorter sentences and words." link: https://docs.gitlab.com/ee/development/documentation/testing.html#vale-readability-score diff --git a/doc/.vale/gitlab/ReferenceLinks.yml b/doc/.vale/gitlab/ReferenceLinks.yml index ca9948844f8..cc6f0c0a467 100644 --- a/doc/.vale/gitlab/ReferenceLinks.yml +++ b/doc/.vale/gitlab/ReferenceLinks.yml @@ -3,7 +3,7 @@ # # Checks for reference-style links that should be converted to inline links. # -# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: existence message: 'Link "%s" must be inline.' link: https://docs.gitlab.com/ee/development/documentation/styleguide/index.html#basic-link-criteria diff --git a/doc/.vale/gitlab/RelativeLinks.yml b/doc/.vale/gitlab/RelativeLinks.yml index 14ffc4bd0b8..582d0faba09 100644 --- a/doc/.vale/gitlab/RelativeLinks.yml +++ b/doc/.vale/gitlab/RelativeLinks.yml @@ -3,7 +3,7 @@ # # Checks for the presence of absolute hyperlinks that should be relative. # -# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: existence message: 'Link "%s" must be a relative link with a .md extension.' link: https://docs.gitlab.com/ee/development/documentation/styleguide/index.html#links-to-internal-documentation diff --git a/doc/.vale/gitlab/RelativeLinksDoubleSlashes.yml b/doc/.vale/gitlab/RelativeLinksDoubleSlashes.yml index ce6ce8b5691..0e0d1fdbb52 100644 --- a/doc/.vale/gitlab/RelativeLinksDoubleSlashes.yml +++ b/doc/.vale/gitlab/RelativeLinksDoubleSlashes.yml @@ -3,7 +3,7 @@ # # Checks for the presence of double slashes in relative URLs. # -# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: existence message: 'Relative links must not include a double slash.' link: https://docs.gitlab.com/ee/development/documentation/styleguide/index.html#links-to-internal-documentation diff --git a/doc/.vale/gitlab/Repetition.yml b/doc/.vale/gitlab/Repetition.yml index c4b0cc14192..8f9d482b22b 100644 --- a/doc/.vale/gitlab/Repetition.yml +++ b/doc/.vale/gitlab/Repetition.yml @@ -3,7 +3,7 @@ # # Checks for duplicate words, like `the the` or `and and`. # -# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: repetition message: '"%s" is repeated.' level: error diff --git a/doc/.vale/gitlab/SentenceLength.yml b/doc/.vale/gitlab/SentenceLength.yml index c60df1803e2..394bcbf3c70 100644 --- a/doc/.vale/gitlab/SentenceLength.yml +++ b/doc/.vale/gitlab/SentenceLength.yml @@ -3,7 +3,7 @@ # # Counts words in a sentence and alerts if a sentence exceeds 25 words. # -# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: occurrence message: 'Shorter sentences improve readability (max 25 words).' scope: sentence diff --git a/doc/.vale/gitlab/SentenceSpacing.yml b/doc/.vale/gitlab/SentenceSpacing.yml index 0288abe834f..8589f0ffa9b 100644 --- a/doc/.vale/gitlab/SentenceSpacing.yml +++ b/doc/.vale/gitlab/SentenceSpacing.yml @@ -3,7 +3,7 @@ # # Checks for incorrect spacing (no spaces, or more than one space) around punctuation. # -# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: existence message: '"%s" must contain one and only one space.' link: https://docs.gitlab.com/ee/development/documentation/styleguide/index.html#punctuation diff --git a/doc/.vale/gitlab/Simplicity.yml b/doc/.vale/gitlab/Simplicity.yml index 44e78f89c20..86f38045bc0 100644 --- a/doc/.vale/gitlab/Simplicity.yml +++ b/doc/.vale/gitlab/Simplicity.yml @@ -3,7 +3,7 @@ # # Checks for words implying ease of use, to avoid cognitive dissonance for frustrated users. # -# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: existence message: 'Avoid words like "%s" that imply ease of use, because the user may find this action hard.' level: suggestion diff --git a/doc/.vale/gitlab/Spelling.yml b/doc/.vale/gitlab/Spelling.yml index 4ebaf7bfb70..5ea813d62b0 100644 --- a/doc/.vale/gitlab/Spelling.yml +++ b/doc/.vale/gitlab/Spelling.yml @@ -8,7 +8,7 @@ # Commands, like `git clone` must use backticks, and must not be added to the # exceptions. # -# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: spelling message: 'Spelling check: "%s"?' level: warning diff --git a/doc/.vale/gitlab/SubstitutionSuggestions.yml b/doc/.vale/gitlab/SubstitutionSuggestions.yml index ce8868a82b9..164ea5a32b6 100644 --- a/doc/.vale/gitlab/SubstitutionSuggestions.yml +++ b/doc/.vale/gitlab/SubstitutionSuggestions.yml @@ -4,7 +4,7 @@ # Suggests better options for frequently misused terms that are often - but not always - incorrect. # SubstitutionWarning.yml and Substitutions.yml also exist. # -# For a list of all options, see https://errata-ai.github.io/vale/styles/ +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: substitution message: 'Consider %s instead of "%s".' link: https://docs.gitlab.com/ee/development/documentation/styleguide/word_list.html diff --git a/doc/.vale/gitlab/SubstitutionWarning.yml b/doc/.vale/gitlab/SubstitutionWarning.yml index d17015b97fd..65e4e7dacb2 100644 --- a/doc/.vale/gitlab/SubstitutionWarning.yml +++ b/doc/.vale/gitlab/SubstitutionWarning.yml @@ -4,7 +4,7 @@ # Checks for misused terms or common shorthand that should never be used at GitLab, but can't be flagged as errors. # Substitutions.yml and SubstitionSuggestions.yml also exist. # -# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: substitution message: 'If possible, use "%s" instead of "%s".' link: https://about.gitlab.com/handbook/communication/#top-misused-terms diff --git a/doc/.vale/gitlab/Substitutions.yml b/doc/.vale/gitlab/Substitutions.yml index af426fa7e06..cc299665331 100644 --- a/doc/.vale/gitlab/Substitutions.yml +++ b/doc/.vale/gitlab/Substitutions.yml @@ -4,7 +4,7 @@ # Checks for misused terms that should never be used at GitLab. # SubstitutionWarning.yml and SubstitionSuggestions.yml also exist. # -# For a list of all options, see https://docs.errata.ai/vale/styles +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: substitution message: 'Use "%s" instead of "%s".' link: https://about.gitlab.com/handbook/communication/#top-misused-terms diff --git a/doc/.vale/gitlab/ToDo.yml b/doc/.vale/gitlab/ToDo.yml index a3725cb7f6b..7781097c938 100644 --- a/doc/.vale/gitlab/ToDo.yml +++ b/doc/.vale/gitlab/ToDo.yml @@ -3,7 +3,7 @@ # # You should not use "To Do", unless it refers to the UI element. # -# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: substitution message: 'Use "to-do item" in most cases, or "Add a to do" if referring to the UI button.' link: https://docs.gitlab.com/ee/development/documentation/styleguide/index.html#feature-names diff --git a/doc/.vale/gitlab/UnclearAntecedent.yml b/doc/.vale/gitlab/UnclearAntecedent.yml index 5f238598d9f..36de9fa532b 100644 --- a/doc/.vale/gitlab/UnclearAntecedent.yml +++ b/doc/.vale/gitlab/UnclearAntecedent.yml @@ -3,7 +3,7 @@ # # Checks for words that need a noun for clarity. # -# For a list of all options, see https://docs.errata.ai/vale/styles +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: existence message: "'%s' is not precise. Try rewriting with a specific subject and verb." link: https://docs.gitlab.com/ee/development/documentation/styleguide/word_list.html#this-these-that-those diff --git a/doc/.vale/gitlab/Uppercase.yml b/doc/.vale/gitlab/Uppercase.yml index dc05aa05730..d966d7d3001 100644 --- a/doc/.vale/gitlab/Uppercase.yml +++ b/doc/.vale/gitlab/Uppercase.yml @@ -3,7 +3,7 @@ # # Checks for use of all uppercase letters with unknown reason. # -# For a list of all options, see https://docs.errata.ai/vale/styles. +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: conditional message: "'%s' is uppercase. Use lowercase or `backticks` if possible. Otherwise add this word to the rule's exception list." link: https://docs.gitlab.com/ee/development/documentation/testing.html#vale-uppercase-acronym-test diff --git a/doc/.vale/gitlab/VersionText.yml b/doc/.vale/gitlab/VersionText.yml index 571fba52ab7..6afce45e6d6 100644 --- a/doc/.vale/gitlab/VersionText.yml +++ b/doc/.vale/gitlab/VersionText.yml @@ -9,7 +9,7 @@ # - `> Introduced in GitLab 14.0. # - `> Removed in GitLab 15.0. # -# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: existence message: 'This introduced-in section is not formatted correctly. Each entry must start with `> -` and long entries must be on one line.' link: https://docs.gitlab.com/ee/development/documentation/versions.html diff --git a/doc/.vale/gitlab/VersionTextSingleLine.yml b/doc/.vale/gitlab/VersionTextSingleLine.yml index f76574bcf8a..e1f045efbd9 100644 --- a/doc/.vale/gitlab/VersionTextSingleLine.yml +++ b/doc/.vale/gitlab/VersionTextSingleLine.yml @@ -3,7 +3,7 @@ # # Verifies that single-item version notes don't have a hyphen. # -# For a list of all options, see https://errata-ai.gitbook.io/vale/getting-started/styles +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: existence message: 'Version text with only a single item must not start with a hyphen.' link: https://docs.gitlab.com/ee/development/documentation/versions.html#add-a-version-history-item diff --git a/doc/.vale/gitlab/Wordy.yml b/doc/.vale/gitlab/Wordy.yml index 7888d16dadb..047df02adce 100644 --- a/doc/.vale/gitlab/Wordy.yml +++ b/doc/.vale/gitlab/Wordy.yml @@ -3,7 +3,7 @@ # # Suggests shorter versions of wordy phrases. # -# For a list of all options, see https://docs.errata.ai/vale/styles +# For a list of all options, see https://vale.sh/docs/topics/styles/ extends: substitution message: '%s "%s".' link: https://docs.gitlab.com/ee/development/documentation/styleguide/word_list.html @@ -11,7 +11,6 @@ level: suggestion ignorecase: true swap: in order to: "Be concise: use 'to' rather than" - needs? to: "Rewrite the sentence, or use 'must', instead of" note that: "Be concise: rewrite the sentence to not use" please: "Remove this word from the sentence: " respectively: "Rewrite the sentence to be more precise, instead of using " diff --git a/doc/administration/file_hooks.md b/doc/administration/file_hooks.md index 8fafb258593..f8b55a7c680 100644 --- a/doc/administration/file_hooks.md +++ b/doc/administration/file_hooks.md @@ -7,10 +7,8 @@ type: reference # File hooks **(FREE SELF)** -> Renamed feature from Plugins to File hooks in GitLab 12.8. - -With custom file hooks, GitLab administrators can introduce custom integrations -without modifying the GitLab source code. +Use custom file hooks (not to be confused with [server hooks](server_hooks.md) or [system hooks](system_hooks.md)), +to introduce custom integrations without modifying the GitLab source code. A file hook runs on each event. You can filter events or projects in a file hook's code, and create many file hooks as you need. Each file hook is diff --git a/doc/administration/server_hooks.md b/doc/administration/server_hooks.md index 6ab4f476e5e..b14998fc80f 100644 --- a/doc/administration/server_hooks.md +++ b/doc/administration/server_hooks.md @@ -9,7 +9,8 @@ disqus_identifier: 'https://docs.gitlab.com/ee/administration/custom_hooks.html' > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/196051) in GitLab 12.8 replacing Custom Hooks. -Server hooks run custom logic on the GitLab server. Users can use them to run Git-related tasks such as: +Server hooks (not to be confused with [system hooks](system_hooks.md) or [file hooks](file_hooks.md)) run custom logic +on the GitLab server. You can use them to run Git-related tasks such as: - Enforcing specific commit policies. - Performing tasks based on the state of the repository. diff --git a/doc/administration/system_hooks.md b/doc/administration/system_hooks.md index 56e73150616..c8b985688b6 100644 --- a/doc/administration/system_hooks.md +++ b/doc/administration/system_hooks.md @@ -7,7 +7,8 @@ type: reference # System hooks **(FREE SELF)** -Your GitLab instance can perform HTTP POST requests on the following events: +System hooks (not to be confused with [server hooks](server_hooks.md) or [file hooks](file_hooks.md)) perform HTTP POST +requests and are triggered on the following events: - `group_create` - `group_destroy` @@ -31,21 +32,18 @@ Your GitLab instance can perform HTTP POST requests on the following events: - `user_update_for_group` - `user_update_for_team` -The triggers for most of these are self-explanatory, but `project_update` and -`project_rename` deserve some clarification: `project_update` is fired any time -an attribute of a project is changed (including name, description, and tags) -_unless_ the `path` attribute is also changed. In that case, a `project_rename` -is triggered instead (so that, for instance, if all you care about is the -repository URL, you can just listen for `project_rename`). +The triggers for most of these are self-explanatory, but `project_update` and `project_rename` require clarification: -`user_failed_login` is sent whenever a _blocked_ user attempts to sign in and is -denied access. +- `project_update` triggers when an attribute of a project is changed (including name, description, and tags) + **except** when the `path` attribute is also changed. +- `project_rename` triggers when an attribute of a project (including `path`) is changed. If you only care about the + repository URL, just listen for `project_rename`. -System hooks can be used, for example, for logging or changing information in an -LDAP server. +`user_failed_login` is sent whenever a **blocked** user attempts to sign in and is denied access. -In addition to these default events, you can enable triggers for other events, -such as push events, and disable the `repository_update` event +As an example, use system hooks for logging or changing information in an LDAP server. + +You can also enable triggers for other events, such as push events, and disable the `repository_update` event when you create a system hook. NOTE: diff --git a/doc/api/graphql/reference/index.md b/doc/api/graphql/reference/index.md index 23c36796f16..c2f431ce31c 100644 --- a/doc/api/graphql/reference/index.md +++ b/doc/api/graphql/reference/index.md @@ -16297,6 +16297,7 @@ Represents vulnerability finding of a security report on the pipeline. | <a id="projectjiraimportstatus"></a>`jiraImportStatus` | [`String`](#string) | Status of Jira import background job of the project. | | <a id="projectjiraimports"></a>`jiraImports` | [`JiraImportConnection`](#jiraimportconnection) | Jira imports into the project. (see [Connections](#connections)) | | <a id="projectjobsenabled"></a>`jobsEnabled` | [`Boolean`](#boolean) | Indicates if CI/CD pipeline jobs are enabled for the current user. | +| <a id="projectlanguages"></a>`languages` | [`[RepositoryLanguage!]`](#repositorylanguage) | Programming languages used in the project. | | <a id="projectlastactivityat"></a>`lastActivityAt` | [`Time`](#time) | Timestamp of the project last activity. | | <a id="projectlfsenabled"></a>`lfsEnabled` | [`Boolean`](#boolean) | Indicates if the project has Large File Storage (LFS) enabled. | | <a id="projectmergecommittemplate"></a>`mergeCommitTemplate` | [`String`](#string) | Template used to create merge commit message in merge requests. | @@ -17968,6 +17969,16 @@ Returns [`Tree`](#tree). | <a id="repositoryblobstoredexternally"></a>`storedExternally` | [`Boolean`](#boolean) | Whether the blob's content is stored externally (for instance, in LFS). | | <a id="repositoryblobwebpath"></a>`webPath` | [`String`](#string) | Web path of the blob. | +### `RepositoryLanguage` + +#### Fields + +| Name | Type | Description | +| ---- | ---- | ----------- | +| <a id="repositorylanguagecolor"></a>`color` | [`Color`](#color) | Color to visualize the repository language. | +| <a id="repositorylanguagename"></a>`name` | [`String!`](#string) | Name of the repository language. | +| <a id="repositorylanguageshare"></a>`share` | [`Float`](#float) | Percentage of the repository's languages. | + ### `Requirement` Represents a requirement. diff --git a/lib/bulk_imports/projects/pipelines/references_pipeline.rb b/lib/bulk_imports/projects/pipelines/references_pipeline.rb new file mode 100644 index 00000000000..9c76f96c7be --- /dev/null +++ b/lib/bulk_imports/projects/pipelines/references_pipeline.rb @@ -0,0 +1,103 @@ +# frozen_string_literal: true + +module BulkImports + module Projects + module Pipelines + class ReferencesPipeline + include Pipeline + + BATCH_SIZE = 100 + + def extract(_context) + data = Enumerator.new do |enum| + add_matching_objects(portable.issues, enum) + add_matching_objects(portable.merge_requests, enum) + end + + BulkImports::Pipeline::ExtractedData.new(data: data) + end + + def transform(_context, object) + body = object_body(object).dup + + matching_urls(object).each do |old_url, new_url| + body.gsub!(old_url, new_url) + end + + object.assign_attributes(body_field(object) => body) + + object + end + + def load(_context, object) + object.save! if object_body_changed?(object) + end + + private + + def add_matching_objects(collection, enum) + collection.each_batch(of: BATCH_SIZE, column: :iid) do |batch| + batch.each do |object| + enum << object if object_has_reference?(object) + + object.notes.each_batch(of: BATCH_SIZE) do |notes_batch| + notes_batch.each do |note| + enum << note if object_has_reference?(note) + end + end + end + end + end + + def object_has_reference?(object) + object_body(object).include?(source_full_path) + end + + def object_body(object) + call_object_method(object) + end + + def object_body_changed?(object) + call_object_method(object, suffix: '_changed?') + end + + def call_object_method(object, suffix: nil) + method = body_field(object) + method = "#{method}#{suffix}" if suffix.present? + + object.public_send(method) # rubocop:disable GitlabSecurity/PublicSend + end + + def body_field(object) + object.is_a?(Note) ? 'note' : 'description' + end + + def matching_urls(object) + URI.extract(object_body(object), %w[http https]).each_with_object([]) do |url, array| + parsed_url = URI.parse(url) + + next unless source_host == parsed_url.host + next unless parsed_url.path&.start_with?("/#{source_full_path}") + + array << [url, new_url(parsed_url)] + end + end + + def new_url(parsed_old_url) + parsed_old_url.host = ::Gitlab.config.gitlab.host + parsed_old_url.port = ::Gitlab.config.gitlab.port + parsed_old_url.scheme = ::Gitlab.config.gitlab.https ? 'https' : 'http' + parsed_old_url.to_s.gsub!(source_full_path, portable.full_path) + end + + def source_host + @source_host ||= URI.parse(context.configuration.url).host + end + + def source_full_path + context.entity.source_full_path + end + end + end + end +end diff --git a/lib/bulk_imports/projects/stage.rb b/lib/bulk_imports/projects/stage.rb index acfa9163eae..2fefdb9055e 100644 --- a/lib/bulk_imports/projects/stage.rb +++ b/lib/bulk_imports/projects/stage.rb @@ -129,6 +129,10 @@ module BulkImports pipeline: BulkImports::Projects::Pipelines::PipelineSchedulesPipeline, stage: 5 }, + references: { + pipeline: BulkImports::Projects::Pipelines::ReferencesPipeline, + stage: 5 + }, finisher: { pipeline: BulkImports::Common::Pipelines::EntityFinisher, stage: 6 diff --git a/lib/gitlab/kas.rb b/lib/gitlab/kas.rb index bf7b7f2d089..a1e290a54e6 100644 --- a/lib/gitlab/kas.rb +++ b/lib/gitlab/kas.rb @@ -34,7 +34,7 @@ module Gitlab end def version_info - Gitlab::VersionInfo.parse(version) + Gitlab::VersionInfo.parse(version, parse_suffix: true) end # Return GitLab KAS external_url diff --git a/qa/qa/page/project/pipeline_editor/show.rb b/qa/qa/page/project/pipeline_editor/show.rb index 32b32b9aa05..8fa20aa57cf 100644 --- a/qa/qa/page/project/pipeline_editor/show.rb +++ b/qa/qa/page/project/pipeline_editor/show.rb @@ -188,3 +188,5 @@ module QA end end end + +QA::Page::Project::PipelineEditor::Show.prepend_mod_with('Page::Project::PipelineEditor::Show', namespace: QA) diff --git a/qa/qa/page/project/sub_menus/ci_cd.rb b/qa/qa/page/project/sub_menus/ci_cd.rb index c8c90df2c1f..4ae51798e54 100644 --- a/qa/qa/page/project/sub_menus/ci_cd.rb +++ b/qa/qa/page/project/sub_menus/ci_cd.rb @@ -43,3 +43,5 @@ module QA end end end + +QA::Page::Project::SubMenus::CiCd.prepend_mod_with('Page::Project::SubMenus::CiCd', namespace: QA) diff --git a/spec/controllers/projects/issues_controller_spec.rb b/spec/controllers/projects/issues_controller_spec.rb index 55f76be3537..bb5dc4dfc46 100644 --- a/spec/controllers/projects/issues_controller_spec.rb +++ b/spec/controllers/projects/issues_controller_spec.rb @@ -170,37 +170,56 @@ RSpec.describe Projects::IssuesController do context 'when work_items feature flag is enabled' do shared_examples 'redirects to show work item page' do - it 'redirects to work item page' do - expect(response).to redirect_to(project_work_items_path(project, task.id, query)) + context 'when use_iid_in_work_items_path feature flag is disabled' do + before do + stub_feature_flags(use_iid_in_work_items_path: false) + end + + it 'redirects to work item page' do + make_request + + expect(response).to redirect_to(project_work_items_path(project, task.id, query)) + end + end + + it 'redirects to work item page using iid' do + make_request + + expect(response).to redirect_to(project_work_items_path(project, task.iid, query.merge(iid_path: true))) end end context 'show action' do let(:query) { { query: 'any' } } - before do - get :show, params: { namespace_id: project.namespace, project_id: project, id: task.iid, **query } + it_behaves_like 'redirects to show work item page' do + subject(:make_request) do + get :show, params: { namespace_id: project.namespace, project_id: project, id: task.iid, **query } + end end - - it_behaves_like 'redirects to show work item page' end context 'edit action' do let(:query) { { query: 'any' } } - before do - get :edit, params: { namespace_id: project.namespace, project_id: project, id: task.iid, **query } + it_behaves_like 'redirects to show work item page' do + subject(:make_request) do + get :edit, params: { namespace_id: project.namespace, project_id: project, id: task.iid, **query } + end end - - it_behaves_like 'redirects to show work item page' end context 'update action' do - before do - put :update, params: { namespace_id: project.namespace, project_id: project, id: task.iid, issue: { title: 'New title' } } + it_behaves_like 'redirects to show work item page' do + subject(:make_request) do + put :update, params: { + namespace_id: project.namespace, + project_id: project, + id: task.iid, + issue: { title: 'New title' } + } + end end - - it_behaves_like 'redirects to show work item page' end end diff --git a/spec/frontend/vue_shared/components/gitlab_version_check_spec.js b/spec/frontend/vue_shared/components/gitlab_version_check_spec.js index c92ab7713c9..c3703d50773 100644 --- a/spec/frontend/vue_shared/components/gitlab_version_check_spec.js +++ b/spec/frontend/vue_shared/components/gitlab_version_check_spec.js @@ -115,8 +115,9 @@ describe('GitlabVersionCheck', () => { }); it(`tracks rendered_version_badge with label ${expectedUI.title}`, () => { - expect(trackingSpy).toHaveBeenCalledWith(undefined, 'rendered_version_badge', { - label: expectedUI.title, + expect(trackingSpy).toHaveBeenCalledWith(undefined, 'render', { + label: 'version_badge', + property: expectedUI.title, }); }); @@ -127,8 +128,9 @@ describe('GitlabVersionCheck', () => { it(`tracks click_version_badge with label ${expectedUI.title} when badge is clicked`, async () => { await findGlBadgeClickWrapper().trigger('click'); - expect(trackingSpy).toHaveBeenCalledWith(undefined, 'click_version_badge', { - label: expectedUI.title, + expect(trackingSpy).toHaveBeenCalledWith(undefined, 'click_link', { + label: 'version_badge', + property: expectedUI.title, }); }); }); @@ -144,8 +146,9 @@ describe('GitlabVersionCheck', () => { }); it('tracks rendered_version_badge correctly', () => { - expect(trackingSpy).toHaveBeenCalledWith(undefined, 'rendered_version_badge', { - label: 'Up to date', + expect(trackingSpy).toHaveBeenCalledWith(undefined, 'render', { + label: 'version_badge', + property: 'Up to date', }); }); @@ -156,8 +159,9 @@ describe('GitlabVersionCheck', () => { it('does not track click_version_badge', async () => { await findGlBadgeClickWrapper().trigger('click'); - expect(trackingSpy).not.toHaveBeenCalledWith(undefined, 'click_version_badge', { - label: 'Up to date', + expect(trackingSpy).not.toHaveBeenCalledWith(undefined, 'click_link', { + label: 'version_badge', + property: 'Up to date', }); }); }); diff --git a/spec/graphql/types/project_type_spec.rb b/spec/graphql/types/project_type_spec.rb index b435f3ed5ff..9ae9536fcc4 100644 --- a/spec/graphql/types/project_type_spec.rb +++ b/spec/graphql/types/project_type_spec.rb @@ -36,7 +36,7 @@ RSpec.describe GitlabSchema.types['Project'] do cluster_agent cluster_agents agent_configurations ci_template timelogs merge_commit_template squash_commit_template work_item_types recent_issue_boards ci_config_path_or_default packages_cleanup_policy ci_variables - timelog_categories fork_targets branch_rules ci_config_variables pipeline_schedules + timelog_categories fork_targets branch_rules ci_config_variables pipeline_schedules languages ] expect(described_class).to include_graphql_fields(*expected_fields) @@ -731,4 +731,60 @@ RSpec.describe GitlabSchema.types['Project'] do end end end + + describe 'languages' do + let_it_be(:user) { create(:user) } + let_it_be(:project) do + create(:project, + :private, + :repository, + creator_id: user.id, + namespace: user.namespace) + end + + let(:query) do + %( + query { + project(fullPath: "#{project.full_path}") { + languages { + name + share + color + } + } + } + ) + end + + let(:mock_languages) { [] } + + before do + allow_next_instance_of(::Projects::RepositoryLanguagesService) do |service| + allow(service).to receive(:execute).and_return(mock_languages) + end + end + + subject { GitlabSchema.execute(query, context: { current_user: user }).as_json } + + let(:languages) { subject.dig('data', 'project', 'languages') } + + context "when the languages haven't been detected yet" do + it 'returns an empty array' do + expect(languages).to eq([]) + end + end + + context 'when the languages were detected before' do + let(:mock_languages) do + [{ share: 66.69, name: "Ruby", color: "#701516" }, + { share: 22.98, name: "JavaScript", color: "#f1e05a" }, + { share: 7.91, name: "HTML", color: "#e34c26" }, + { share: 2.42, name: "CoffeeScript", color: "#244776" }] + end + + it 'returns the repository languages' do + expect(languages).to eq(mock_languages.map(&:stringify_keys)) + end + end + end end diff --git a/spec/graphql/types/projects/repository_language_type_spec.rb b/spec/graphql/types/projects/repository_language_type_spec.rb new file mode 100644 index 00000000000..fd3e0ee4e90 --- /dev/null +++ b/spec/graphql/types/projects/repository_language_type_spec.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Types::Projects::RepositoryLanguageType do + specify { expect(described_class.graphql_name).to eq('RepositoryLanguage') } + + specify do + expect(described_class).to have_graphql_fields( + :name, + :share, + :color + ) + end +end diff --git a/spec/helpers/todos_helper_spec.rb b/spec/helpers/todos_helper_spec.rb index 49e3c6dd740..7c91dd0570f 100644 --- a/spec/helpers/todos_helper_spec.rb +++ b/spec/helpers/todos_helper_spec.rb @@ -127,10 +127,22 @@ RSpec.describe TodosHelper do context 'when given a task' do let(:todo) { task_todo } - it 'responds with an appropriate path' do + context 'when the use_iid_in_work_items_path feature flag is disabled' do + before do + stub_feature_flags(use_iid_in_work_items_path: false) + end + + it 'responds with an appropriate path' do + path = helper.todo_target_path(todo) + + expect(path).to eq("/#{todo.project.full_path}/-/work_items/#{todo.target.id}") + end + end + + it 'responds with an appropriate path using iid' do path = helper.todo_target_path(todo) - expect(path).to eq("/#{todo.project.full_path}/-/work_items/#{todo.target.id}") + expect(path).to eq("/#{todo.project.full_path}/-/work_items/#{todo.target.iid}?iid_path=true") end end diff --git a/spec/lib/bulk_imports/projects/pipelines/references_pipeline_spec.rb b/spec/lib/bulk_imports/projects/pipelines/references_pipeline_spec.rb new file mode 100644 index 00000000000..3c3d0a6d1c4 --- /dev/null +++ b/spec/lib/bulk_imports/projects/pipelines/references_pipeline_spec.rb @@ -0,0 +1,131 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe BulkImports::Projects::Pipelines::ReferencesPipeline do + let_it_be(:user) { create(:user) } + let_it_be(:project) { create(:project) } + let_it_be(:bulk_import) { create(:bulk_import, user: user) } + let_it_be(:config) { create(:bulk_import_configuration, bulk_import: bulk_import, url: 'https://my.gitlab.com') } + let_it_be(:entity) do + create( + :bulk_import_entity, + :project_entity, + project: project, + bulk_import: bulk_import, + source_full_path: 'source/full/path' + ) + end + + let_it_be(:tracker) { create(:bulk_import_tracker, entity: entity) } + let_it_be(:context) { BulkImports::Pipeline::Context.new(tracker) } + + let(:issue) { create(:issue, project: project, description: 'https://my.gitlab.com/source/full/path/-/issues/1') } + let(:mr) { create(:merge_request, source_project: project, description: 'https://my.gitlab.com/source/full/path/-/merge_requests/1') } + let(:issue_note) { create(:note, project: project, noteable: issue, note: 'https://my.gitlab.com/source/full/path/-/issues/1') } + let(:mr_note) { create(:note, project: project, noteable: mr, note: 'https://my.gitlab.com/source/full/path/-/merge_requests/1') } + + subject(:pipeline) { described_class.new(context) } + + before do + project.add_owner(user) + end + + def create_project_data + [issue, mr, issue_note, mr_note] + end + + describe '#extract' do + it 'returns ExtractedData containing issues, mrs & their notes' do + create_project_data + + extracted_data = subject.extract(context) + + expect(extracted_data).to be_instance_of(BulkImports::Pipeline::ExtractedData) + expect(extracted_data.data).to contain_exactly(issue_note, mr, issue, mr_note) + end + end + + describe '#transform' do + it 'updates matching urls with new ones' do + transformed_mr = subject.transform(context, mr) + transformed_note = subject.transform(context, mr_note) + + expected_url = URI('') + expected_url.scheme = ::Gitlab.config.gitlab.https ? 'https' : 'http' + expected_url.host = ::Gitlab.config.gitlab.host + expected_url.port = ::Gitlab.config.gitlab.port + expected_url.path = "/#{project.full_path}/-/merge_requests/#{mr.iid}" + + expect(transformed_mr.description).to eq(expected_url.to_s) + expect(transformed_note.note).to eq(expected_url.to_s) + end + + context 'when object does not have reference' do + it 'returns object unchanged' do + issue.update!(description: 'foo') + + transformed_issue = subject.transform(context, issue) + + expect(transformed_issue.description).to eq('foo') + end + end + + context 'when there are not matched urls' do + let(:url) { 'https://my.gitlab.com/another/project/path/-/issues/1' } + + shared_examples 'returns object unchanged' do + it 'returns object unchanged' do + issue.update!(description: url) + + transformed_issue = subject.transform(context, issue) + + expect(transformed_issue.description).to eq(url) + end + end + + include_examples 'returns object unchanged' + + context 'when url path does not start with source full path' do + let(:url) { 'https://my.gitlab.com/another/source/full/path/-/issues/1' } + + include_examples 'returns object unchanged' + end + + context 'when host does not match and url path starts with source full path' do + let(:url) { 'https://another.gitlab.com/source/full/path/-/issues/1' } + + include_examples 'returns object unchanged' + end + + context 'when url does not match at all' do + let(:url) { 'https://website.example/foo/bar' } + + include_examples 'returns object unchanged' + end + end + end + + describe '#load' do + it 'saves the object when object body changed' do + transformed_issue = subject.transform(context, issue) + transformed_note = subject.transform(context, issue_note) + + expect(transformed_issue).to receive(:save!) + expect(transformed_note).to receive(:save!) + + subject.load(context, transformed_issue) + subject.load(context, transformed_note) + end + + context 'when object body is not changed' do + it 'does not save the object' do + expect(mr).not_to receive(:save!) + expect(mr_note).not_to receive(:save!) + + subject.load(context, mr) + subject.load(context, mr_note) + end + end + end +end diff --git a/spec/lib/gitlab/kas_spec.rb b/spec/lib/gitlab/kas_spec.rb index 0fbb5f31210..34eb48a3221 100644 --- a/spec/lib/gitlab/kas_spec.rb +++ b/spec/lib/gitlab/kas_spec.rb @@ -125,6 +125,18 @@ RSpec.describe Gitlab::Kas do end end + describe '.version_info' do + let(:version) { '15.6.0-rc1' } + + before do + allow(described_class).to receive(:version).and_return(version) + end + + it 'returns gitlab_kas version config, including suffix' do + expect(described_class.version_info.to_s).to eq(version) + end + end + describe '.ensure_secret!' do context 'secret file exists' do before do diff --git a/spec/lib/gitlab/url_builder_spec.rb b/spec/lib/gitlab/url_builder_spec.rb index d6a1b207c87..f2b99fd4d26 100644 --- a/spec/lib/gitlab/url_builder_spec.rb +++ b/spec/lib/gitlab/url_builder_spec.rb @@ -22,8 +22,8 @@ RSpec.describe Gitlab::UrlBuilder do :group_board | ->(board) { "/groups/#{board.group.full_path}/-/boards/#{board.id}" } :commit | ->(commit) { "/#{commit.project.full_path}/-/commit/#{commit.id}" } :issue | ->(issue) { "/#{issue.project.full_path}/-/issues/#{issue.iid}" } - [:issue, :task] | ->(issue) { "/#{issue.project.full_path}/-/work_items/#{issue.id}" } - :work_item | ->(work_item) { "/#{work_item.project.full_path}/-/work_items/#{work_item.id}" } + [:issue, :task] | ->(issue) { "/#{issue.project.full_path}/-/work_items/#{issue.iid}?iid_path=true" } + :work_item | ->(work_item) { "/#{work_item.project.full_path}/-/work_items/#{work_item.iid}?iid_path=true" } :merge_request | ->(merge_request) { "/#{merge_request.project.full_path}/-/merge_requests/#{merge_request.iid}" } :project_milestone | ->(milestone) { "/#{milestone.project.full_path}/-/milestones/#{milestone.iid}" } :project_snippet | ->(snippet) { "/#{snippet.project.full_path}/-/snippets/#{snippet.id}" } @@ -239,5 +239,27 @@ RSpec.describe Gitlab::UrlBuilder do expect(subject.build(object, only_path: true)).to eq("/#{project.full_path}") end end + + context 'when use_iid_in_work_items_path feature flag is disabled' do + before do + stub_feature_flags(use_iid_in_work_items_path: false) + end + + context 'when a task issue is passed' do + it 'returns a path using the work item\'s ID and no query params' do + task = create(:issue, :task) + + expect(subject.build(task, only_path: true)).to eq("/#{task.project.full_path}/-/work_items/#{task.id}") + end + end + + context 'when a work item is passed' do + it 'returns a path using the work item\'s ID and no query params' do + work_item = create(:work_item) + + expect(subject.build(work_item, only_path: true)).to eq("/#{work_item.project.full_path}/-/work_items/#{work_item.id}") + end + end + end end end diff --git a/spec/presenters/issue_presenter_spec.rb b/spec/presenters/issue_presenter_spec.rb index e17ae218cd3..fff6e81a550 100644 --- a/spec/presenters/issue_presenter_spec.rb +++ b/spec/presenters/issue_presenter_spec.rb @@ -27,8 +27,20 @@ RSpec.describe IssuePresenter do let(:presented_issue) { task } context 'when work_items feature flag is enabled' do - it 'returns a work item url for the task' do - expect(presenter.web_url).to eq(project_work_items_url(project, work_items_path: presented_issue.id)) + context 'when use_iid_in_work_items_path feature flag is disabled' do + before do + stub_feature_flags(use_iid_in_work_items_path: false) + end + + it 'returns a work item url for the task' do + expect(presenter.web_url).to eq(project_work_items_url(project, work_items_path: presented_issue.id)) + end + end + + it 'returns a work item url using iid for the task' do + expect(presenter.web_url).to eq( + project_work_items_url(project, work_items_path: presented_issue.iid, iid_path: true) + ) end end @@ -67,8 +79,20 @@ RSpec.describe IssuePresenter do let(:presented_issue) { task } context 'when work_items feature flag is enabled' do - it 'returns a work item path for the task' do - expect(presenter.issue_path).to eq(project_work_items_path(project, work_items_path: presented_issue.id)) + context 'when use_iid_in_work_items_path feature flag is disabled' do + before do + stub_feature_flags(use_iid_in_work_items_path: false) + end + + it 'returns a work item path for the task' do + expect(presenter.issue_path).to eq(project_work_items_path(project, work_items_path: presented_issue.id)) + end + end + + it 'returns a work item path using iid for the task' do + expect(presenter.issue_path).to eq( + project_work_items_path(project, work_items_path: presented_issue.iid, iid_path: true) + ) end end diff --git a/spec/requests/api/graphql/project/languages_spec.rb b/spec/requests/api/graphql/project/languages_spec.rb new file mode 100644 index 00000000000..6ef500cde41 --- /dev/null +++ b/spec/requests/api/graphql/project/languages_spec.rb @@ -0,0 +1,62 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'Project.languages' do + include GraphqlHelpers + + let_it_be(:user) { create(:user) } + let_it_be(:project) { create(:project, :public, :repository) } + let_it_be(:query) do + %( + query { + project(fullPath: "#{project.full_path}") { + languages { + name + share + color + } + } + } + ) + end + + let_it_be(:test_languages) do + [{ value: 66.69, label: "Ruby", color: "#701516", highlight: "#701516" }, + { value: 22.98, label: "JavaScript", color: "#f1e05a", highlight: "#f1e05a" }, + { value: 7.91, label: "HTML", color: "#e34c26", highlight: "#e34c26" }, + { value: 2.42, label: "CoffeeScript", color: "#244776", highlight: "#244776" }] + end + + let_it_be(:expected_languages) do + test_languages.map { |lang| { 'name' => lang[:label], 'share' => lang[:value], 'color' => lang[:color] } } + end + + before do + allow(project.repository).to receive(:languages).and_return(test_languages) + end + + context "when the languages haven't been detected yet" do + it 'returns expected languages on second request as detection is done asynchronously', :sidekiq_inline do + post_graphql(query, current_user: user) + + expect(graphql_data_at(:project, :languages)).to eq([]) + + post_graphql(query, current_user: user) + + expect(graphql_data_at(:project, :languages)).to eq(expected_languages) + end + end + + context 'when the languages were detected before' do + before do + Projects::DetectRepositoryLanguagesService.new(project, project.first_owner).execute + end + + it 'returns repository languages' do + post_graphql(query, current_user: user) + + expect(graphql_data_at(:project, :languages)).to eq(expected_languages) + end + end +end diff --git a/spec/requests/projects/issue_links_controller_spec.rb b/spec/requests/projects/issue_links_controller_spec.rb index 81fd1adb1fd..e5f40625cfa 100644 --- a/spec/requests/projects/issue_links_controller_spec.rb +++ b/spec/requests/projects/issue_links_controller_spec.rb @@ -28,12 +28,28 @@ RSpec.describe Projects::IssueLinksController do context 'when linked issue is a task' do let(:issue_b) { create :issue, :task, project: project } - it 'returns a work item path for the linked task' do + context 'when the use_iid_in_work_items_path feature flag is disabled' do + before do + stub_feature_flags(use_iid_in_work_items_path: false) + end + + it 'returns a work item path for the linked task' do + get namespace_project_issue_links_path(issue_links_params) + + expect(json_response.count).to eq(1) + expect(json_response.first).to include( + 'path' => project_work_items_path(issue_b.project, issue_b.id), + 'type' => 'TASK' + ) + end + end + + it 'returns a work item path for the linked task using the iid in the path' do get namespace_project_issue_links_path(issue_links_params) expect(json_response.count).to eq(1) expect(json_response.first).to include( - 'path' => project_work_items_path(issue_b.project, issue_b.id), + 'path' => project_work_items_path(issue_b.project, issue_b.iid, iid_path: true), 'type' => 'TASK' ) end diff --git a/spec/serializers/issue_board_entity_spec.rb b/spec/serializers/issue_board_entity_spec.rb index 7a6a496912f..0c9c8f05e17 100644 --- a/spec/serializers/issue_board_entity_spec.rb +++ b/spec/serializers/issue_board_entity_spec.rb @@ -57,8 +57,18 @@ RSpec.describe IssueBoardEntity do context 'when issue is of type task' do let(:resource) { create(:issue, :task, project: project) } - it 'has a work item path' do - expect(subject[:real_path]).to eq(project_work_items_path(project, resource.id)) + context 'when the use_iid_in_work_items_path feature flag is disabled' do + before do + stub_feature_flags(use_iid_in_work_items_path: false) + end + + it 'has a work item path' do + expect(subject[:real_path]).to eq(project_work_items_path(project, resource.id)) + end + end + + it 'has a work item path with iid' do + expect(subject[:real_path]).to eq(project_work_items_path(project, resource.iid, iid_path: true)) end end end diff --git a/spec/serializers/issue_entity_spec.rb b/spec/serializers/issue_entity_spec.rb index 25e9e8c17e2..6161d4d7ec2 100644 --- a/spec/serializers/issue_entity_spec.rb +++ b/spec/serializers/issue_entity_spec.rb @@ -17,9 +17,19 @@ RSpec.describe IssueEntity do context 'when issue is of type task' do let(:resource) { create(:issue, :task, project: project) } - # This was already a path and not a url when the work items change was introduced - it 'has a work item path' do - expect(subject[:web_url]).to eq(project_work_items_path(project, resource.id)) + context 'when use_iid_in_work_items_path feature flag is disabled' do + before do + stub_feature_flags(use_iid_in_work_items_path: false) + end + + # This was already a path and not a url when the work items change was introduced + it 'has a work item path' do + expect(subject[:web_url]).to eq(project_work_items_path(project, resource.id)) + end + end + + it 'has a work item path with iid' do + expect(subject[:web_url]).to eq(project_work_items_path(project, resource.iid, iid_path: true)) end end end diff --git a/spec/serializers/linked_project_issue_entity_spec.rb b/spec/serializers/linked_project_issue_entity_spec.rb index c4646754f16..523b89921b6 100644 --- a/spec/serializers/linked_project_issue_entity_spec.rb +++ b/spec/serializers/linked_project_issue_entity_spec.rb @@ -51,8 +51,20 @@ RSpec.describe LinkedProjectIssueEntity do related_issue.update!(issue_type: :task, work_item_type: WorkItems::Type.default_by_type(:task)) end - it 'returns a work items path' do - expect(serialized_entity).to include(path: project_work_items_path(related_issue.project, related_issue.id)) + context 'when use_iid_in_work_items_path feature flag is disabled' do + before do + stub_feature_flags(use_iid_in_work_items_path: false) + end + + it 'returns a work items path' do + expect(serialized_entity).to include(path: project_work_items_path(related_issue.project, related_issue.id)) + end + end + + it 'returns a work items path using iid' do + expect(serialized_entity).to include( + path: project_work_items_path(related_issue.project, related_issue.iid, iid_path: true) + ) end end end diff --git a/spec/support/shared_examples/models/wiki_shared_examples.rb b/spec/support/shared_examples/models/wiki_shared_examples.rb index b1aa90449e1..1fa8ccf4b55 100644 --- a/spec/support/shared_examples/models/wiki_shared_examples.rb +++ b/spec/support/shared_examples/models/wiki_shared_examples.rb @@ -207,17 +207,7 @@ RSpec.shared_examples 'wiki model' do end end - context 'list pages with legacy wiki rpcs' do - before do - stub_feature_flags(wiki_list_page_with_normal_repository_rpcs: false) - end - - it_behaves_like 'wiki model #list_pages' - end - - context 'list pages with normal repository rpcs' do - it_behaves_like 'wiki model #list_pages' - end + it_behaves_like 'wiki model #list_pages' end describe '#sidebar_entries' do diff --git a/spec/views/events/event/_common.html.haml_spec.rb b/spec/views/events/event/_common.html.haml_spec.rb index ad8e5c2ef77..2160245fb63 100644 --- a/spec/views/events/event/_common.html.haml_spec.rb +++ b/spec/views/events/event/_common.html.haml_spec.rb @@ -18,9 +18,22 @@ RSpec.describe 'events/event/_common.html.haml' do create(:event, :created, project: project, target: work_item, target_type: 'WorkItem', author: user) end - it 'renders the correct url' do + context 'when use_iid_in_work_items_path feature flag is disabled' do + before do + stub_feature_flags(use_iid_in_work_items_path: false) + render partial: 'events/event/common', locals: { event: event.present } + end + + it 'renders the correct url' do + expect(rendered).to have_link( + work_item.reference_link_text, href: "/#{project.full_path}/-/work_items/#{work_item.id}" + ) + end + end + + it 'renders the correct url with iid' do expect(rendered).to have_link( - work_item.reference_link_text, href: "/#{project.full_path}/-/work_items/#{work_item.id}" + work_item.reference_link_text, href: "/#{project.full_path}/-/work_items/#{work_item.iid}?iid_path=true" ) end diff --git a/spec/views/layouts/header/_gitlab_version.html.haml_spec.rb b/spec/views/layouts/header/_gitlab_version.html.haml_spec.rb index d6706038066..8be874ba401 100644 --- a/spec/views/layouts/header/_gitlab_version.html.haml_spec.rb +++ b/spec/views/layouts/header/_gitlab_version.html.haml_spec.rb @@ -21,12 +21,16 @@ RSpec.describe 'layouts/header/_gitlab_version' do it 'renders the container with correct data-tracking attributes' do expect(rendered).to have_selector( - 'a[data-testid="gitlab-version-container"][data-track-action="click_version_help_dropdown"]' + 'a[data-testid="gitlab-version-container"][data-track-action="click_link"]' + ) + + expect(rendered).to have_selector( + 'a[data-testid="gitlab-version-container"][data-track-label="version_help_dropdown"]' ) expect(rendered).to have_selector( 'a[data-testid="gitlab-version-container"]' \ - "[data-track-label=\"#{Gitlab.version_info.major}.#{Gitlab.version_info.minor}\"]" + "[data-track-property=\"#{Gitlab.version_info.major}.#{Gitlab.version_info.minor}\"]" ) end end |