summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-01-11 18:08:40 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-01-11 18:08:40 +0000
commit33f7ef81fd6bcab7bbdf0bc3f37d337256fb11fb (patch)
treeda5c4d1d60ca6674523ca431a285d78dab2917aa
parented94a4dd903dc4d20cbc1bce330b9c1b7a5f7fbf (diff)
downloadgitlab-ce-33f7ef81fd6bcab7bbdf0bc3f37d337256fb11fb.tar.gz
Add latest changes from gitlab-org/gitlab@master
-rw-r--r--.gitlab/ci/package-and-test/main.gitlab-ci.yml8
-rw-r--r--.rubocop_todo/rails/inverse_of.yml1
-rw-r--r--app/assets/javascripts/main.js2
-rw-r--r--app/assets/javascripts/pages/projects/index.js2
-rw-r--r--app/assets/stylesheets/fonts.scss23
-rw-r--r--app/controllers/pwa_controller.rb2
-rw-r--r--app/controllers/search_controller.rb19
-rw-r--r--app/models/analytics/cycle_analytics/project_stage.rb2
-rw-r--r--app/models/concerns/analytics/cycle_analytics/stageable.rb (renamed from app/models/concerns/analytics/cycle_analytics/stage.rb)56
-rw-r--r--app/models/concerns/work_item_resource_event.rb23
-rw-r--r--app/models/label_note.rb15
-rw-r--r--app/models/resource_event.rb6
-rw-r--r--app/models/resource_label_event.rb5
-rw-r--r--app/models/resource_milestone_event.rb4
-rw-r--r--app/models/resource_state_event.rb5
-rw-r--r--app/models/resource_timebox_event.rb5
-rw-r--r--app/services/search_service.rb19
-rw-r--r--app/views/layouts/_loading_hints.html.haml3
-rw-r--r--db/docs/analytics_cycle_analytics_group_stages.yml2
-rw-r--r--db/docs/analytics_cycle_analytics_group_value_streams.yml2
-rw-r--r--db/post_migrate/20230110172751_add_partial_index_on_group_path_id.rb15
-rw-r--r--db/schema_migrations/202301101727511
-rw-r--r--db/structure.sql2
-rw-r--r--doc/ci/runners/configure_runners.md7
-rw-r--r--doc/development/value_stream_analytics.md2
-rw-r--r--doc/operations/incident_management/slack.md4
-rw-r--r--doc/topics/gitlab_flow.md66
-rw-r--r--doc/user/admin_area/settings/instance_template_repository.md4
-rw-r--r--doc/user/project/integrations/slack.md1
-rw-r--r--doc/user/project/repository/img/web_editor_line_link_v13_10.pngbin42942 -> 0 bytes
-rw-r--r--doc/user/project/repository/img/web_editor_new_file_dropdown_v14_1.pngbin10851 -> 0 bytes
-rw-r--r--doc/user/project/repository/img/web_editor_new_file_editor_v14_1.pngbin60751 -> 0 bytes
-rw-r--r--doc/user/project/repository/img/web_editor_template_dropdown_buttons.pngbin5629 -> 0 bytes
-rw-r--r--doc/user/project/repository/img/web_editor_template_dropdown_first_file_v14_1.pngbin17652 -> 0 bytes
-rw-r--r--doc/user/project/repository/img/web_editor_template_dropdown_mit_license_v14_1.pngbin31321 -> 0 bytes
-rw-r--r--doc/user/project/repository/index.md1
-rw-r--r--doc/user/project/repository/web_editor.md89
-rw-r--r--lib/api/search.rb9
-rw-r--r--lib/gitlab/analytics/cycle_analytics/aggregated/data_collector.rb2
-rw-r--r--lib/gitlab/analytics/cycle_analytics/data_collector.rb2
-rw-r--r--locale/gitlab.pot12
-rw-r--r--package.json2
-rw-r--r--spec/db/schema_spec.rb2
-rw-r--r--spec/lib/gitlab/import_export/all_models.yml6
-rw-r--r--spec/models/resource_event_spec.rb19
-rw-r--r--spec/models/resource_label_event_spec.rb18
-rw-r--r--spec/models/resource_milestone_event_spec.rb3
-rw-r--r--spec/models/resource_state_event_spec.rb3
-rw-r--r--spec/requests/api/search_spec.rb20
-rw-r--r--spec/requests/pwa_controller_spec.rb17
-rw-r--r--spec/services/search_service_spec.rb28
-rw-r--r--spec/support/shared_examples/models/resource_event_shared_examples.rb12
-rw-r--r--yarn.lock8
53 files changed, 382 insertions, 177 deletions
diff --git a/.gitlab/ci/package-and-test/main.gitlab-ci.yml b/.gitlab/ci/package-and-test/main.gitlab-ci.yml
index 14ea310fdf0..48059d9518f 100644
--- a/.gitlab/ci/package-and-test/main.gitlab-ci.yml
+++ b/.gitlab/ci/package-and-test/main.gitlab-ci.yml
@@ -396,13 +396,13 @@ ee:update-major:
- if: $QA_SUITES =~ /Test::Instance::Smoke/
- !reference [.rules:test:manual, rules]
-ee:gitab-pages:
+ee:gitlab-pages:
extends: .qa
variables:
QA_SCENARIO: Test::Integration::GitlabPages
rules:
- !reference [.rules:test:qa, rules]
- - if: $QA_SUITES =~ /Test::Integration::GitlabPages/
+ - if: $QA_SUITES =~ /Test::Instance::GitlabPages/
- !reference [.rules:test:manual, rules]
ee:gitaly-cluster:
@@ -440,7 +440,7 @@ ee:jira:
JIRA_ADMIN_PASSWORD: $QA_JIRA_ADMIN_PASSWORD
rules:
- !reference [.rules:test:qa, rules]
- - if: $QA_SUITES =~ /Test::Integration::Jira/
+ - if: $QA_SUITES =~ /Test::Instance::Jira/
- !reference [.rules:test:manual, rules]
ee:integrations:
@@ -557,7 +557,7 @@ ee:cloud-activation:
QA_RSPEC_TAGS: --tag cloud_activation
rules:
- !reference [.rules:test:qa, rules]
- - if: $QA_SUITES =~ /Test::Integration::CloudActivation/
+ - if: $QA_SUITES =~ /Test::Instance::CloudActivation/
- !reference [.rules:test:manual, rules]
ee:large-setup:
diff --git a/.rubocop_todo/rails/inverse_of.yml b/.rubocop_todo/rails/inverse_of.yml
index a1f49aaf2f5..832767b7bb5 100644
--- a/.rubocop_todo/rails/inverse_of.yml
+++ b/.rubocop_todo/rails/inverse_of.yml
@@ -33,6 +33,7 @@ Rails/InverseOf:
- 'app/models/concerns/awardable.rb'
- 'app/models/concerns/commit_signature.rb'
- 'app/models/concerns/with_uploads.rb'
+ - 'app/models/concerns/work_item_resource_event.rb'
- 'app/models/custom_emoji.rb'
- 'app/models/customer_relations/contact.rb'
- 'app/models/customer_relations/organization.rb'
diff --git a/app/assets/javascripts/main.js b/app/assets/javascripts/main.js
index 21d0bda6b5d..fd5c4abe729 100644
--- a/app/assets/javascripts/main.js
+++ b/app/assets/javascripts/main.js
@@ -30,6 +30,7 @@ import initLogoAnimation from './logo';
import initBreadcrumbs from './breadcrumb';
import initPersistentUserCallouts from './persistent_user_callouts';
import { initUserTracking, initDefaultTrackers } from './tracking';
+import { initSidebarTracking } from './pages/shared/nav/sidebar_tracking';
import initServicePingConsent from './service_ping_consent';
import GlFieldErrors from './gl_field_errors';
import initUserPopovers from './user_popovers';
@@ -99,6 +100,7 @@ function deferredInitialisation() {
initBroadcastNotifications();
initPersistentUserCallouts();
initDefaultTrackers();
+ initSidebarTracking();
initFeatureHighlight();
initCopyCodeButton();
initGitlabVersionCheck();
diff --git a/app/assets/javascripts/pages/projects/index.js b/app/assets/javascripts/pages/projects/index.js
index 7380055cbbf..37cf345fe77 100644
--- a/app/assets/javascripts/pages/projects/index.js
+++ b/app/assets/javascripts/pages/projects/index.js
@@ -1,9 +1,7 @@
import ShortcutsNavigation from '~/behaviors/shortcuts/shortcuts_navigation';
import initTerraformNotification from '~/projects/terraform_notification';
-import { initSidebarTracking } from '../shared/nav/sidebar_tracking';
import Project from './project';
new Project(); // eslint-disable-line no-new
new ShortcutsNavigation(); // eslint-disable-line no-new
-initSidebarTracking();
initTerraformNotification();
diff --git a/app/assets/stylesheets/fonts.scss b/app/assets/stylesheets/fonts.scss
index 7ff05f99e3c..a023b41083d 100644
--- a/app/assets/stylesheets/fonts.scss
+++ b/app/assets/stylesheets/fonts.scss
@@ -26,6 +26,29 @@ Usage:
src: font-url('jetbrains-mono/JetBrainsMono.woff2') format('woff2');
}
+@font-face {
+ font-family: 'JetBrains Mono';
+ font-display: optional;
+ font-weight: bold;
+ src: font-url('jetbrains-mono/JetBrainsMono-Bold.woff2') format('woff2');
+}
+
+@font-face {
+ font-family: 'JetBrains Mono';
+ font-display: optional;
+ font-weight: normal;
+ font-style: italic;
+ src: font-url('jetbrains-mono/JetBrainsMono-Italic.woff2') format('woff2');
+}
+
+@font-face {
+ font-family: 'JetBrains Mono';
+ font-display: optional;
+ font-weight: bold;
+ font-style: italic;
+ src: font-url('jetbrains-mono/JetBrainsMono-BoldItalic.woff2') format('woff2');
+}
+
:root {
--default-mono-font: 'JetBrains Mono', 'Menlo';
--default-regular-font: 'GitLab Sans', -apple-system;
diff --git a/app/controllers/pwa_controller.rb b/app/controllers/pwa_controller.rb
index 8de1b10e1f1..bb47bdc8050 100644
--- a/app/controllers/pwa_controller.rb
+++ b/app/controllers/pwa_controller.rb
@@ -6,7 +6,7 @@ class PwaController < ApplicationController # rubocop:disable Gitlab/NamespacedC
feature_category :navigation
urgency :low
- skip_before_action :authenticate_user!
+ skip_before_action :authenticate_user!, :required_signup_info
def manifest
end
diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb
index ae5c112bcb8..38c773fa31d 100644
--- a/app/controllers/search_controller.rb
+++ b/app/controllers/search_controller.rb
@@ -212,24 +212,7 @@ class SearchController < ApplicationController
def check_scope_global_search_enabled
return unless search_service.global_search?
- search_allowed = case params[:scope]
- when 'blobs'
- Feature.enabled?(:global_search_code_tab, current_user, type: :ops)
- when 'commits'
- Feature.enabled?(:global_search_commits_tab, current_user, type: :ops)
- when 'issues'
- Feature.enabled?(:global_search_issues_tab, current_user, type: :ops)
- when 'merge_requests'
- Feature.enabled?(:global_search_merge_requests_tab, current_user, type: :ops)
- when 'wiki_blobs'
- Feature.enabled?(:global_search_wiki_tab, current_user, type: :ops)
- when 'users'
- Feature.enabled?(:global_search_users_tab, current_user, type: :ops)
- else
- true
- end
-
- return if search_allowed
+ return if search_service.global_search_enabled_for_scope?
redirect_to search_path, alert: _('Global Search is disabled for this scope')
end
diff --git a/app/models/analytics/cycle_analytics/project_stage.rb b/app/models/analytics/cycle_analytics/project_stage.rb
index 68fe43890bd..8a80514333f 100644
--- a/app/models/analytics/cycle_analytics/project_stage.rb
+++ b/app/models/analytics/cycle_analytics/project_stage.rb
@@ -3,7 +3,7 @@
module Analytics
module CycleAnalytics
class ProjectStage < ApplicationRecord
- include Analytics::CycleAnalytics::Stage
+ include Analytics::CycleAnalytics::Stageable
belongs_to :project, optional: false
belongs_to :value_stream, class_name: 'Analytics::CycleAnalytics::ProjectValueStream', foreign_key: :project_value_stream_id
diff --git a/app/models/concerns/analytics/cycle_analytics/stage.rb b/app/models/concerns/analytics/cycle_analytics/stageable.rb
index 9293002109b..d1f948d1366 100644
--- a/app/models/concerns/analytics/cycle_analytics/stage.rb
+++ b/app/models/concerns/analytics/cycle_analytics/stageable.rb
@@ -2,7 +2,7 @@
module Analytics
module CycleAnalytics
- module Stage
+ module Stageable
extend ActiveSupport::Concern
include RelativePositioning
include Gitlab::Utils::StrongMemoize
@@ -10,7 +10,7 @@ module Analytics
included do
belongs_to :start_event_label, class_name: 'GroupLabel', optional: true
belongs_to :end_event_label, class_name: 'GroupLabel', optional: true
- belongs_to :stage_event_hash, class_name: 'Analytics::CycleAnalytics::StageEventHash', foreign_key: :stage_event_hash_id, optional: true
+ belongs_to :stage_event_hash, class_name: 'Analytics::CycleAnalytics::StageEventHash', optional: true
validates :name, presence: true
validates :name, exclusion: { in: Gitlab::Analytics::CycleAnalytics::DefaultStages.names }, if: :custom?
@@ -21,39 +21,31 @@ module Analytics
validate :validate_stage_event_pairs
validate :validate_labels
- enum start_event_identifier: Gitlab::Analytics::CycleAnalytics::StageEvents.to_enum, _prefix: :start_event_identifier
- enum end_event_identifier: Gitlab::Analytics::CycleAnalytics::StageEvents.to_enum, _prefix: :end_event_identifier
+ enum start_event_identifier: Gitlab::Analytics::CycleAnalytics::StageEvents.to_enum,
+ _prefix: :start_event_identifier
+ enum end_event_identifier: Gitlab::Analytics::CycleAnalytics::StageEvents.to_enum,
+ _prefix: :end_event_identifier
alias_attribute :custom_stage?, :custom
scope :default_stages, -> { where(custom: false) }
scope :ordered, -> { order(:relative_position, :id) }
scope :with_preloaded_labels, -> { includes(:start_event_label, :end_event_label) }
scope :for_list, -> { with_preloaded_labels.ordered }
- scope :by_value_stream, -> (value_stream) { where(value_stream_id: value_stream.id) }
+ scope :by_value_stream, ->(value_stream) { where(value_stream_id: value_stream.id) }
before_save :ensure_stage_event_hash_id
after_commit :cleanup_old_stage_event_hash
end
- def parent=(_)
- raise NotImplementedError
- end
-
- def parent
- raise NotImplementedError
- end
-
def start_event
- strong_memoize(:start_event) do
- Gitlab::Analytics::CycleAnalytics::StageEvents[start_event_identifier].new(params_for_start_event)
- end
+ Gitlab::Analytics::CycleAnalytics::StageEvents[start_event_identifier].new(params_for_start_event)
end
+ strong_memoize_attr :start_event
def end_event
- strong_memoize(:end_event) do
- Gitlab::Analytics::CycleAnalytics::StageEvents[end_event_identifier].new(params_for_end_event)
- end
+ Gitlab::Analytics::CycleAnalytics::StageEvents[end_event_identifier].new(params_for_end_event)
end
+ strong_memoize_attr :end_event
def events_hash_code
Digest::SHA256.hexdigest("#{start_event.hash_code}-#{end_event.hash_code}")
@@ -109,9 +101,9 @@ module Analytics
def validate_stage_event_pairs
return if start_event_identifier.nil? || end_event_identifier.nil?
- unless pairing_rules.fetch(start_event.class, []).include?(end_event.class)
- errors.add(:end_event, s_('CycleAnalytics|not allowed for the given start event'))
- end
+ return if pairing_rules.fetch(start_event.class, []).include?(end_event.class)
+
+ errors.add(:end_event, s_('CycleAnalytics|not allowed for the given start event'))
end
def pairing_rules
@@ -126,13 +118,13 @@ module Analytics
def validate_label_within_namespace(association_name, label_id)
return unless label_id
- unless label_available_for_namespace?(label_id)
- errors.add(association_name, s_('CycleAnalyticsStage|is not available for the selected group'))
- end
+ return if label_available_for_namespace?(label_id)
+
+ errors.add(association_name, s_('CycleAnalyticsStage|is not available for the selected group'))
end
def label_available_for_namespace?(label_id)
- subject = is_a?(::Analytics::CycleAnalytics::GroupStage) ? namespace : project.group
+ subject = is_a?(::Analytics::CycleAnalytics::Stage) ? namespace : project.group
return unless subject
LabelsFinder.new(nil, { group_id: subject.id, include_ancestor_groups: true, only_group_labels: true })
@@ -144,15 +136,15 @@ module Analytics
def ensure_stage_event_hash_id
previous_stage_event_hash = stage_event_hash&.hash_sha256
- if previous_stage_event_hash.blank? || events_hash_code != previous_stage_event_hash
- self.stage_event_hash_id = Analytics::CycleAnalytics::StageEventHash.record_id_by_hash_sha256(events_hash_code)
- end
+ return unless previous_stage_event_hash.blank? || events_hash_code != previous_stage_event_hash
+
+ self.stage_event_hash_id = Analytics::CycleAnalytics::StageEventHash.record_id_by_hash_sha256(events_hash_code)
end
def cleanup_old_stage_event_hash
- if stage_event_hash_id_previously_changed? && stage_event_hash_id_previously_was
- Analytics::CycleAnalytics::StageEventHash.cleanup_if_unused(stage_event_hash_id_previously_was)
- end
+ return unless stage_event_hash_id_previously_changed? && stage_event_hash_id_previously_was
+
+ Analytics::CycleAnalytics::StageEventHash.cleanup_if_unused(stage_event_hash_id_previously_was)
end
end
end
diff --git a/app/models/concerns/work_item_resource_event.rb b/app/models/concerns/work_item_resource_event.rb
new file mode 100644
index 00000000000..d0323feb029
--- /dev/null
+++ b/app/models/concerns/work_item_resource_event.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+module WorkItemResourceEvent
+ extend ActiveSupport::Concern
+
+ included do
+ belongs_to :work_item, foreign_key: 'issue_id'
+ end
+
+ def work_item_synthetic_system_note(events: nil)
+ # System notes for label resource events are handled in batches, so that we have single system note for multiple
+ # label changes.
+ if is_a?(ResourceLabelEvent) && events.present?
+ return synthetic_note_class.from_events(events, resource: work_item, resource_parent: work_item.project)
+ end
+
+ synthetic_note_class.from_event(self, resource: work_item, resource_parent: work_item.project)
+ end
+
+ def synthetic_note_class
+ raise NoMethodError, 'must implement `synthetic_note_class` method'
+ end
+end
diff --git a/app/models/label_note.rb b/app/models/label_note.rb
index 19dede36abd..eda650f2fa2 100644
--- a/app/models/label_note.rb
+++ b/app/models/label_note.rb
@@ -4,12 +4,19 @@ class LabelNote < SyntheticNote
attr_accessor :resource_parent
attr_reader :events
+ def self.from_event(event, resource: nil, resource_parent: nil)
+ attrs = note_attributes('label', event, resource, resource_parent).merge(events: [event])
+
+ LabelNote.new(attrs)
+ end
+
def self.from_events(events, resource: nil, resource_parent: nil)
resource ||= events.first.issuable
- attrs = note_attributes('label', events.first, resource, resource_parent).merge(events: events)
+ label_note = from_event(events.first, resource: resource, resource_parent: resource_parent)
+ label_note.events = events
- LabelNote.new(attrs)
+ label_note
end
def events=(events)
@@ -37,8 +44,8 @@ class LabelNote < SyntheticNote
end
def note_text(html: false)
- added = labels_str(label_refs_by_action('add', html), prefix: 'added', suffix: added_suffix)
- removed = labels_str(label_refs_by_action('remove', html), prefix: removed_prefix)
+ added = labels_str(label_refs_by_action('add', html).uniq, prefix: 'added', suffix: added_suffix)
+ removed = labels_str(label_refs_by_action('remove', html).uniq, prefix: removed_prefix)
[added, removed].compact.join(' and ')
end
diff --git a/app/models/resource_event.rb b/app/models/resource_event.rb
index 8b82e0f343c..551ea984132 100644
--- a/app/models/resource_event.rb
+++ b/app/models/resource_event.rb
@@ -3,6 +3,8 @@
class ResourceEvent < ApplicationRecord
include Gitlab::Utils::StrongMemoize
include Importable
+ include IssueResourceEvent
+ include WorkItemResourceEvent
self.abstract_class = true
@@ -18,6 +20,10 @@ class ResourceEvent < ApplicationRecord
end
end
+ def issuable
+ raise NoMethodError, 'must implement `issuable` method'
+ end
+
private
def discussion_id_key
diff --git a/app/models/resource_label_event.rb b/app/models/resource_label_event.rb
index a1426540cf5..efffc1bd6dc 100644
--- a/app/models/resource_label_event.rb
+++ b/app/models/resource_label_event.rb
@@ -2,7 +2,6 @@
class ResourceLabelEvent < ResourceEvent
include CacheMarkdownField
- include IssueResourceEvent
include MergeRequestResourceEvent
cache_markdown_field :reference
@@ -39,6 +38,10 @@ class ResourceLabelEvent < ResourceEvent
issue || merge_request
end
+ def synthetic_note_class
+ LabelNote
+ end
+
def project
issuable.project
end
diff --git a/app/models/resource_milestone_event.rb b/app/models/resource_milestone_event.rb
index 5fd71612de0..def7e91af3f 100644
--- a/app/models/resource_milestone_event.rb
+++ b/app/models/resource_milestone_event.rb
@@ -19,4 +19,8 @@ class ResourceMilestoneEvent < ResourceTimeboxEvent
def milestone_parent
milestone&.parent
end
+
+ def synthetic_note_class
+ MilestoneNote
+ end
end
diff --git a/app/models/resource_state_event.rb b/app/models/resource_state_event.rb
index 6ebb9d5f176..134f71e35ad 100644
--- a/app/models/resource_state_event.rb
+++ b/app/models/resource_state_event.rb
@@ -1,7 +1,6 @@
# frozen_string_literal: true
class ResourceStateEvent < ResourceEvent
- include IssueResourceEvent
include MergeRequestResourceEvent
include Importable
@@ -26,6 +25,10 @@ class ResourceStateEvent < ResourceEvent
issue_id.present?
end
+ def synthetic_note_class
+ StateNote
+ end
+
private
def issue_usage_metrics
diff --git a/app/models/resource_timebox_event.rb b/app/models/resource_timebox_event.rb
index 26bf2a225d4..dddd4d0fe84 100644
--- a/app/models/resource_timebox_event.rb
+++ b/app/models/resource_timebox_event.rb
@@ -1,12 +1,11 @@
# frozen_string_literal: true
class ResourceTimeboxEvent < ResourceEvent
- self.abstract_class = true
-
- include IssueResourceEvent
include MergeRequestResourceEvent
include Importable
+ self.abstract_class = true
+
validate :exactly_one_issuable, unless: :importing?
enum action: {
diff --git a/app/services/search_service.rb b/app/services/search_service.rb
index 403a2f077b0..b4344a009b2 100644
--- a/app/services/search_service.rb
+++ b/app/services/search_service.rb
@@ -112,6 +112,25 @@ class SearchService
false
end
+ def global_search_enabled_for_scope?
+ case params[:scope]
+ when 'blobs'
+ Feature.enabled?(:global_search_code_tab, current_user, type: :ops)
+ when 'commits'
+ Feature.enabled?(:global_search_commits_tab, current_user, type: :ops)
+ when 'issues'
+ Feature.enabled?(:global_search_issues_tab, current_user, type: :ops)
+ when 'merge_requests'
+ Feature.enabled?(:global_search_merge_requests_tab, current_user, type: :ops)
+ when 'wiki_blobs'
+ Feature.enabled?(:global_search_wiki_tab, current_user, type: :ops)
+ when 'users'
+ Feature.enabled?(:global_search_users_tab, current_user, type: :ops)
+ else
+ true
+ end
+ end
+
private
def page
diff --git a/app/views/layouts/_loading_hints.html.haml b/app/views/layouts/_loading_hints.html.haml
index b1d1447ae2a..60ab6927fd2 100644
--- a/app/views/layouts/_loading_hints.html.haml
+++ b/app/views/layouts/_loading_hints.html.haml
@@ -18,4 +18,7 @@
-# See https://github.com/web-platform-tests/wpt/pull/36930
%link{ rel: 'preload', href: font_path('gitlab-sans/GitLabSans.woff2'), as: 'font', crossorigin: css_crossorigin }
%link{ rel: 'preload', href: font_path('jetbrains-mono/JetBrainsMono.woff2'), as: 'font', crossorigin: css_crossorigin }
+ %link{ rel: 'preload', href: font_path('jetbrains-mono/JetBrainsMono-Bold.woff2'), as: 'font', crossorigin: css_crossorigin }
+ %link{ rel: 'preload', href: font_path('jetbrains-mono/JetBrainsMono-Italic.woff2'), as: 'font', crossorigin: css_crossorigin }
+ %link{ rel: 'preload', href: font_path('jetbrains-mono/JetBrainsMono-BoldItalic.woff2'), as: 'font', crossorigin: css_crossorigin }
= preload_link_tag(path_to_stylesheet('fonts'), crossorigin: css_crossorigin)
diff --git a/db/docs/analytics_cycle_analytics_group_stages.yml b/db/docs/analytics_cycle_analytics_group_stages.yml
index 5dbb3eba2c0..12c7668632d 100644
--- a/db/docs/analytics_cycle_analytics_group_stages.yml
+++ b/db/docs/analytics_cycle_analytics_group_stages.yml
@@ -1,7 +1,7 @@
---
table_name: analytics_cycle_analytics_group_stages
classes:
-- Analytics::CycleAnalytics::GroupStage
+- Analytics::CycleAnalytics::Stage
feature_categories:
- value_stream_management
description: TODO
diff --git a/db/docs/analytics_cycle_analytics_group_value_streams.yml b/db/docs/analytics_cycle_analytics_group_value_streams.yml
index e29d07c5a72..1f8603ab294 100644
--- a/db/docs/analytics_cycle_analytics_group_value_streams.yml
+++ b/db/docs/analytics_cycle_analytics_group_value_streams.yml
@@ -1,7 +1,7 @@
---
table_name: analytics_cycle_analytics_group_value_streams
classes:
-- Analytics::CycleAnalytics::GroupValueStream
+- Analytics::CycleAnalytics::ValueStream
feature_categories:
- value_stream_management
description: Store group level Value Stream objects.
diff --git a/db/post_migrate/20230110172751_add_partial_index_on_group_path_id.rb b/db/post_migrate/20230110172751_add_partial_index_on_group_path_id.rb
new file mode 100644
index 00000000000..c04b71835a2
--- /dev/null
+++ b/db/post_migrate/20230110172751_add_partial_index_on_group_path_id.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddPartialIndexOnGroupPathId < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ INDEX_NAME = :index_groups_on_path_and_id
+
+ def up
+ add_concurrent_index :namespaces, [:path, :id], where: "type = 'Group'", name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :namespaces, INDEX_NAME
+ end
+end
diff --git a/db/schema_migrations/20230110172751 b/db/schema_migrations/20230110172751
new file mode 100644
index 00000000000..aabd27bcd3d
--- /dev/null
+++ b/db/schema_migrations/20230110172751
@@ -0,0 +1 @@
+0f3165c67b8b97901561614dfa54a50650c042df9b69ad0f2cc9ae793799a653 \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index bb71082d93a..7245b28f6e3 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -29678,6 +29678,8 @@ CREATE INDEX index_group_wiki_repositories_on_shard_id ON group_wiki_repositorie
CREATE INDEX index_groups_on_parent_id_id ON namespaces USING btree (parent_id, id) WHERE ((type)::text = 'Group'::text);
+CREATE INDEX index_groups_on_path_and_id ON namespaces USING btree (path, id) WHERE ((type)::text = 'Group'::text);
+
CREATE INDEX index_historical_data_on_recorded_at ON historical_data USING btree (recorded_at);
CREATE UNIQUE INDEX index_http_integrations_on_active_and_project_and_endpoint ON alert_management_http_integrations USING btree (active, project_id, endpoint_identifier) WHERE active;
diff --git a/doc/ci/runners/configure_runners.md b/doc/ci/runners/configure_runners.md
index abf9c1b8c22..28a856e3dda 100644
--- a/doc/ci/runners/configure_runners.md
+++ b/doc/ci/runners/configure_runners.md
@@ -971,10 +971,11 @@ To determine which runners need to be upgraded:
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/377963) in GitLab 15.8.
-As an administrator, you can view runner statistics to learn about the runner fleet performance.
+As an administrator, you can view runner statistics to learn about the performance of your runner fleet.
-1. Select **Main menu > Admin** and on the left sidebar, select **CI/CD > Runners**.
-1. Select **View metrics** under **Runners performance**.
+1. Select **Main menu > Admin**.
+1. On the left sidebar, select **CI/CD > Runners**.
+1. Select **View metrics**.
The **Median job queued time** value is calculated by sampling the queue duration of the
most recent 100 jobs that were run by Instance runners. Jobs from only the latest 5000
diff --git a/doc/development/value_stream_analytics.md b/doc/development/value_stream_analytics.md
index 2d5f33b5dae..33a6744d5cd 100644
--- a/doc/development/value_stream_analytics.md
+++ b/doc/development/value_stream_analytics.md
@@ -261,7 +261,7 @@ considered legacy, which will be phased out at some point.
- Rails Controller (`Analytics::CycleAnalytics` module): Value stream analytics exposes its data via JSON endpoints, implemented within the `analytics` workspace. Configuring the stages are also implements JSON endpoints (CRUD).
- Services (`Analytics::CycleAnalytics` module): All `Stage` related actions are delegated to respective service objects.
-- Models (`Analytics::CycleAnalytics` module): Models are used to persist the `Stage` objects `ProjectStage` and `GroupStage`.
+- Models (`Analytics::CycleAnalytics` module): Models are used to persist the `Stage` objects `ProjectStage` and `Stage`.
- Feature classes (`Gitlab::Analytics::CycleAnalytics` module):
- Responsible for composing queries and define feature specific business logic.
- `DataCollector`, `Event`, `StageEvents`, etc.
diff --git a/doc/operations/incident_management/slack.md b/doc/operations/incident_management/slack.md
index 1ab1391ea2a..0e7a85142f6 100644
--- a/doc/operations/incident_management/slack.md
+++ b/doc/operations/incident_management/slack.md
@@ -34,7 +34,7 @@ Prerequisites:
1. Install the [GitLab for Slack app](../../user/project/integrations/gitlab_slack_application.md).
This way, you can use slash commands in Slack to create and update GitLab incidents.
1. Enable [Slack notifications](../../user/project/integrations/slack.md). Be sure to enable
- notifications for `Issue` events, and to define a Slack channel to receive the relevant notifications.
+ notifications for `Incident` events, and to define a Slack channel to receive the relevant notifications.
1. Authorize GitLab to take actions on behalf of your Slack user.
Each user must do this before they can use any of the incident slash commands.
@@ -113,5 +113,5 @@ Slack shows a prompt asking you to confirm which incident you'd like to close.
## Send GitLab incident notifications to Slack
-If you have [enabled notifications](#manage-an-incident-from-slack) for issues, you should receive
+If you have [enabled notifications](#manage-an-incident-from-slack) for incidents, you should receive
notifications to the selected Slack channel every time an incident is opened, closed, or updated.
diff --git a/doc/topics/gitlab_flow.md b/doc/topics/gitlab_flow.md
index ffd9f36b369..2f3cd2b8588 100644
--- a/doc/topics/gitlab_flow.md
+++ b/doc/topics/gitlab_flow.md
@@ -7,14 +7,29 @@ disqus_identifier: 'https://docs.gitlab.com/ee/workflow/gitlab_flow.html'
# Introduction to GitLab Flow **(FREE)**
-Git allows a wide variety of branching strategies and workflows.
-Because of this, many organizations end up with workflows that are too complicated, not clearly defined, or not integrated with issue tracking systems.
-Therefore, we propose GitLab flow as a clearly defined set of best practices.
-It combines [feature-driven development](https://en.wikipedia.org/wiki/Feature-driven_development) and [feature branches](https://martinfowler.com/bliki/FeatureBranch.html) with issue tracking.
+With Git, you can use a variety of branching strategies and workflows.
-Organizations coming to Git from other version control systems frequently find it hard to develop a productive workflow.
-This article describes GitLab flow, which integrates the Git workflow with an issue tracking system.
-It offers a transparent and effective way to work with Git:
+Because the default workflow is not specifically defined, many organizations
+end up with workflows that are too complicated, not clearly defined, or
+not integrated with their issue tracking systems.
+
+Your organization can use GitLab with any workflow you choose.
+
+However, if you are looking for guidance on best practices, you can use
+the GitLab Flow. This workflow combines [feature-driven development](https://en.wikipedia.org/wiki/Feature-driven_development)
+and [feature branches](https://martinfowler.com/bliki/FeatureBranch.html) with issue tracking.
+
+While this workflow used at GitLab, you can choose whichever workflow
+suits your organization best.
+
+## Git workflow
+
+Most version control systems have only one step: committing from the working copy to a shared server.
+
+When you convert to Git, you have to get used to the fact that it takes three steps to share a commit with colleagues.
+
+In Git, you add files from the working copy to the staging area. After that, you commit them to your local repository.
+The third step is pushing to a shared remote repository.
```mermaid
graph LR
@@ -25,27 +40,18 @@ graph LR
end
```
-When converting to Git, you have to get used to the fact that it takes three steps to share a commit with colleagues.
-Most version control systems have only one step: committing from the working copy to a shared server.
-In Git, you add files from the working copy to the staging area. After that, you commit them to your local repository.
-The third step is pushing to a shared remote repository.
After getting used to these three steps, the next challenge is the branching model.
Because many organizations new to Git have no conventions for how to work with it, their repositories can quickly become messy.
The biggest problem is that many long-running branches emerge that all contain part of the changes.
People have a hard time figuring out which branch has the latest code, or which branch to deploy to production.
Frequently, the reaction to this problem is to adopt a standardized pattern such as [Git flow](https://nvie.com/posts/a-successful-git-branching-model/) and [GitHub flow](https://scottchacon.com/2011/08/31/github-flow.html).
-We think there is still room for improvement. In this document, we describe a set of practices we call GitLab flow.
-For a video introduction of how this works in GitLab, see [GitLab Flow](https://youtu.be/InKNIvky2KE).
+We think there is still room for improvement, and so we've proposed a set of practices called the GitLab Flow.
-## Git flow and its problems
+For a video introduction of this workflow in GitLab, see [GitLab Flow](https://youtu.be/InKNIvky2KE).
-<!-- vale gitlab.Spelling = NO -->
-
-![Git Flow timeline by Vincent Driessen, used with permission](img/gitlab_flow_gitdashflow.png)
-
-<!-- vale gitlab.Spelling = YES -->
+## Problems with the Git flow
Git flow was one of the first proposals to use Git branches, and it has received
a lot of attention. It suggests a `main` branch and a separate `develop` branch,
@@ -68,6 +74,12 @@ Frequently, developers make mistakes such as merging changes only into `main` an
The reason for these errors is that Git flow is too complicated for most use cases.
For example, many projects do releases but don't need to do hotfixes.
+<!-- vale gitlab.Spelling = NO -->
+
+![Git Flow timeline by Vincent Driessen, used with permission](img/gitlab_flow_gitdashflow.png)
+
+<!-- vale gitlab.Spelling = YES -->
+
## GitHub flow as a simpler alternative
In reaction to Git flow, GitHub created a simpler alternative.
@@ -100,22 +112,22 @@ While this is possible in some cases, such as SaaS applications, there are some
- You have deployment windows - for example, workdays from 10 AM to 4 PM when the
operations team is at full capacity - but you also merge code at other times.
-In these cases, you can make a production branch that reflects the deployed code.
-You can deploy a new version by merging `development` into the production branch:
+In these cases, you can create a production branch that reflects the deployed code.
+You can deploy a new version by merging `main` into the `production` branch.
+While not shown in the graph below, the work on the `main` branch works just like in GitHub flow, i.e. with feature-branches being merged into `main`.
```mermaid
graph TD
subgraph Production branch in GitLab Flow
- A[development] ==>B[development]
- B ==> C[development]
- C ==> D[development]
+ A[main branch] ==>B[development]
+ B ==> C[main branch]
+ C ==> D[main branch]
E[production] ====> F[production]
C --> |deployment| F
- D ==> G[development]
- F ==> H[production]
+ D ==> G[main branch]
+ F ==> H[main branch]
end
-```
If you need to know what code is in production, you can check out the production branch to see.
The approximate time of deployment is visible as the merge commit in the version control system.
diff --git a/doc/user/admin_area/settings/instance_template_repository.md b/doc/user/admin_area/settings/instance_template_repository.md
index bf07c5b2808..026782ae83b 100644
--- a/doc/user/admin_area/settings/instance_template_repository.md
+++ b/doc/user/admin_area/settings/instance_template_repository.md
@@ -13,7 +13,7 @@ type: reference
In hosted systems, enterprises often have a need to share their own templates
across teams. This feature allows an administrator to pick a project to be the
instance-wide collection of file templates. These templates are then exposed to
-all users [via the web editor](../../project/repository/web_editor.md#template-dropdowns)
+all users through the [Web Editor](../../project/repository/web_editor.md)
while the project remains secure.
## Configuration
@@ -28,7 +28,7 @@ To select a project to serve as the custom template repository:
1. Add custom templates to the selected repository.
After you add templates, you can use them for the entire instance.
-They are available in the [Web Editor's dropdown list](../../project/repository/web_editor.md#template-dropdowns)
+They are available in the [Web Editor](../../project/repository/web_editor.md)
and through the [API settings](../../../api/settings.md).
## Supported file types and locations
diff --git a/doc/user/project/integrations/slack.md b/doc/user/project/integrations/slack.md
index 2ded5799c23..5c1006b9044 100644
--- a/doc/user/project/integrations/slack.md
+++ b/doc/user/project/integrations/slack.md
@@ -59,6 +59,7 @@ The following triggers are available for Slack notifications:
|--------------------------------------------------------------------------|------------------------------------------------------|
| **Push** | A push to the repository. |
| **Issue** | An issue is created, updated, or closed. |
+| **Incident** | An incident is created, updated, or closed. |
| **Confidential issue** | A confidential issue is created, updated, or closed. |
| **Merge request** | A merge request is created, updated, or merged. |
| **Note** | A comment is added. |
diff --git a/doc/user/project/repository/img/web_editor_line_link_v13_10.png b/doc/user/project/repository/img/web_editor_line_link_v13_10.png
deleted file mode 100644
index 36347afcbe8..00000000000
--- a/doc/user/project/repository/img/web_editor_line_link_v13_10.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/repository/img/web_editor_new_file_dropdown_v14_1.png b/doc/user/project/repository/img/web_editor_new_file_dropdown_v14_1.png
deleted file mode 100644
index 1a92555457a..00000000000
--- a/doc/user/project/repository/img/web_editor_new_file_dropdown_v14_1.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/repository/img/web_editor_new_file_editor_v14_1.png b/doc/user/project/repository/img/web_editor_new_file_editor_v14_1.png
deleted file mode 100644
index 3c568e304b2..00000000000
--- a/doc/user/project/repository/img/web_editor_new_file_editor_v14_1.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/repository/img/web_editor_template_dropdown_buttons.png b/doc/user/project/repository/img/web_editor_template_dropdown_buttons.png
deleted file mode 100644
index 4608843b1f4..00000000000
--- a/doc/user/project/repository/img/web_editor_template_dropdown_buttons.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/repository/img/web_editor_template_dropdown_first_file_v14_1.png b/doc/user/project/repository/img/web_editor_template_dropdown_first_file_v14_1.png
deleted file mode 100644
index ecc4d8e8716..00000000000
--- a/doc/user/project/repository/img/web_editor_template_dropdown_first_file_v14_1.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/repository/img/web_editor_template_dropdown_mit_license_v14_1.png b/doc/user/project/repository/img/web_editor_template_dropdown_mit_license_v14_1.png
deleted file mode 100644
index 5a5562ed38c..00000000000
--- a/doc/user/project/repository/img/web_editor_template_dropdown_mit_license_v14_1.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/project/repository/index.md b/doc/user/project/repository/index.md
index 83389c15eba..13015c3f993 100644
--- a/doc/user/project/repository/index.md
+++ b/doc/user/project/repository/index.md
@@ -264,7 +264,6 @@ to fetch configuration from a project that is renamed or moved.
- [Repository API](../../../api/repositories.md).
- [Find files](file_finder.md) in a repository.
- [Branches](branches/index.md).
-- [File templates](web_editor.md#template-dropdowns).
- [Create a directory](web_editor.md#create-a-directory).
- [Start a merge request](web_editor.md#tips).
- [Find file history](git_history.md).
diff --git a/doc/user/project/repository/web_editor.md b/doc/user/project/repository/web_editor.md
index 2748fca3ffc..1c18824160f 100644
--- a/doc/user/project/repository/web_editor.md
+++ b/doc/user/project/repository/web_editor.md
@@ -4,63 +4,49 @@ group: Editor
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments
---
-# GitLab Web Editor **(FREE)**
+# Web Editor **(FREE)**
-Sometimes it's easier to make quick changes directly from the GitLab interface
-than to clone the project and use the Git command-line tool. In this feature
-highlight, we look at how you can create a new file, directory, branch, or
-tag from the file browser. All of these actions are available from a single
-dropdown list.
+You can use the Web Editor to make changes directly from the UI instead of
+cloning a project and using the command line.
+From any project page, you can create a file, directory, branch, or tag.
## Create a file
-From a project's files page, select the '+' button to the right of the branch selector.
-Choose **New file** from the dropdown list.
-![New file dropdown list](img/web_editor_new_file_dropdown_v14_1.png)
+To create a text file in the Web Editor:
-Enter a filename in the **Filename** box. Then, add file content in the editor
-area. Add a descriptive commit message and choose a branch. The branch field
-defaults to the branch you were viewing in the file browser. If you enter
-a new branch name, a checkbox displays, allowing you to start a new merge
-request after you commit the changes.
-
-When you are satisfied with your new file, select **Commit Changes** at the bottom.
-
-![Create file editor](img/web_editor_new_file_editor_v14_1.png)
-
-### Shortcuts
-
-You can use shortcuts when editing a file through the Web Editor. It uses the same shortcuts
-as the Web IDE. For details, read the documentation for [Command Palette](../web_ide/index.md#command-palette).
-
-### Template dropdowns
-
-When starting a new project, there are some common files that the new project
-might need. GitLab displays a message to help you:
-
-![First file for your project](img/web_editor_template_dropdown_first_file_v14_1.png)
+1. On the top bar, select **Main menu > Projects** and find your project.
+1. On the project page, next to the branch name, select the plus icon (**{plus}**).
+1. From the dropdown list, select **New file**.
+1. Complete the fields.
+ - From the **Select a template type** dropdown list, you can apply a template to the new file.
+ - To create a merge request with the new file, ensure the **Start a new merge request with these changes** checkbox is selected.
+1. Select **Commit changes**.
-When selecting either `LICENSE` or `.gitignore` and so on, a dropdown displays
-to provide you a template that may be suitable for your project:
+## Edit a file
-![MIT license selected](img/web_editor_template_dropdown_mit_license_v14_1.png)
+To edit a file in the Web Editor:
-The license, changelog, contribution guide, or `.gitlab-ci.yml` file can also
-be added through a button on the project page. In this example, the license
-has already been created, which creates a link to the license itself.
+1. On the top bar, select **Main menu > Projects** and find your project.
+1. Go to your file.
+1. Next to the display buttons, select **Edit**.
-![New file button](img/web_editor_template_dropdown_buttons.png)
+### Keyboard shortcuts
-NOTE:
-The **Set up CI/CD** button does not appear on an empty repository. For the button
-to display, add a file to your repository.
+When you [edit a file](#edit-a-file) in the Web Editor, you can use the same keyboard shortcuts for the Web IDE.
+See the [available shortcuts](../../shortcuts.md#web-ide).
## Preview Markdown
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/378966) in GitLab 15.6.
-To preview Markdown content in the Web Editor, select the **Preview** tab.
-In this tab, you can see a live Markdown preview that updates as you type alongside your content.
+To preview Markdown content in the Web Editor:
+
+1. [Edit a file](#edit-a-file).
+1. Do one of the following:
+ - Select the **Preview** tab.
+ - From the context menu, select **Preview Markdown**.
+
+In the **Preview** tab, you can see a live Markdown preview alongside your content.
To close the preview panel, do one of the following:
@@ -72,21 +58,16 @@ To close the preview panel, do one of the following:
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/56159) in GitLab 13.10 for GitLab SaaS instances.
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/56159) in GitLab 13.11 for self-managed instances.
-Web Editor enables you to highlight a single line by adding specially formatted
-hash information to the file path segment of the URL. For example, the file path segment
-`MY_FILE.js#L3` instructs the Web Editor to highlight line 3.
-
-The Web Editor also enables you to highlight multiple lines using a similar pattern. In
-this case, the file path segment `MY_FILE.js#L3-10` instructs the Web Editor to
-highlight lines 3 to 10 of the file.
+To highlight single or multiple lines in the Web Editor, add hash
+information to the filename segment of the URL. For example:
-You don't need to construct these lines manually. Instead, you can:
+- `MY_FILE.js#L3` highlights line 3 in `MY_FILE.js`.
+- `MY_FILE.js#L3-10` highlights lines 3 to 10 in `MY_FILE.js`.
-1. Hover over the number of a line you want to be highlighted when sharing.
-1. Right-click the number with your mouse.
-1. Select **Copy Link Address** in the context menu.
+To highlight a single line, you can also:
- ![Link to a line](img/web_editor_line_link_v13_10.png)
+1. [Edit a file](#edit-a-file).
+1. Select a line number.
## Upload a file
diff --git a/lib/api/search.rb b/lib/api/search.rb
index cf6a1385783..2204437f2ec 100644
--- a/lib/api/search.rb
+++ b/lib/api/search.rb
@@ -59,8 +59,13 @@ module API
end
def search(additional_params = {})
+ search_service = search_service(additional_params)
+ if search_service.global_search? && !search_service.global_search_enabled_for_scope?
+ forbidden!('Global Search is disabled for this scope')
+ end
+
@search_duration_s = Benchmark.realtime do
- @results = search_service(additional_params).search_objects(preload_method)
+ @results = search_service.search_objects(preload_method)
end
set_global_search_log_information(additional_params)
@@ -68,7 +73,7 @@ module API
Gitlab::Metrics::GlobalSearchSlis.record_apdex(
elapsed: @search_duration_s,
search_type: search_type(additional_params),
- search_level: search_service(additional_params).level,
+ search_level: search_service.level,
search_scope: search_scope
)
diff --git a/lib/gitlab/analytics/cycle_analytics/aggregated/data_collector.rb b/lib/gitlab/analytics/cycle_analytics/aggregated/data_collector.rb
index 22d8874db57..3abf380d461 100644
--- a/lib/gitlab/analytics/cycle_analytics/aggregated/data_collector.rb
+++ b/lib/gitlab/analytics/cycle_analytics/aggregated/data_collector.rb
@@ -5,7 +5,7 @@ module Gitlab
module CycleAnalytics
module Aggregated
# Arguments:
- # stage - an instance of CycleAnalytics::ProjectStage or CycleAnalytics::GroupStage
+ # stage - an instance of CycleAnalytics::ProjectStage or CycleAnalytics::Stage
# params:
# current_user: an instance of User
# from: DateTime
diff --git a/lib/gitlab/analytics/cycle_analytics/data_collector.rb b/lib/gitlab/analytics/cycle_analytics/data_collector.rb
index ae675b6ad27..0db027b9861 100644
--- a/lib/gitlab/analytics/cycle_analytics/data_collector.rb
+++ b/lib/gitlab/analytics/cycle_analytics/data_collector.rb
@@ -4,7 +4,7 @@ module Gitlab
module Analytics
module CycleAnalytics
# Arguments:
- # stage - an instance of CycleAnalytics::ProjectStage or CycleAnalytics::GroupStage
+ # stage - an instance of CycleAnalytics::ProjectStage or CycleAnalytics::Stage
# params:
# current_user: an instance of User
# from: DateTime
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index 9c0f5505c8c..57f26dd63e9 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -20638,9 +20638,6 @@ msgstr ""
msgid "How do I use a web terminal?"
msgstr ""
-msgid "How do I use file templates?"
-msgstr ""
-
msgid "How does pull mirroring work?"
msgstr ""
@@ -31921,6 +31918,9 @@ msgstr ""
msgid "ProductAnalytics|Browser Family"
msgstr ""
+msgid "ProductAnalytics|Cancel Edit"
+msgstr ""
+
msgid "ProductAnalytics|Choose a chart type on the right"
msgstr ""
@@ -31957,6 +31957,9 @@ msgstr ""
msgid "ProductAnalytics|Dimensions"
msgstr ""
+msgid "ProductAnalytics|Edit"
+msgstr ""
+
msgid "ProductAnalytics|Event Type"
msgstr ""
@@ -31975,6 +31978,9 @@ msgstr ""
msgid "ProductAnalytics|Feature usage"
msgstr ""
+msgid "ProductAnalytics|Go back"
+msgstr ""
+
msgid "ProductAnalytics|Host"
msgstr ""
diff --git a/package.json b/package.json
index 0e4ebacbcff..92de33c53ef 100644
--- a/package.json
+++ b/package.json
@@ -133,7 +133,7 @@
"fuzzaldrin-plus": "^0.6.0",
"graphql": "^15.7.2",
"graphql-tag": "^2.11.0",
- "gridstack": "^7.0.0",
+ "gridstack": "^7.1.2",
"highlight.js": "^11.5.1",
"immer": "^9.0.15",
"ipaddr.js": "^1.9.1",
diff --git a/spec/db/schema_spec.rb b/spec/db/schema_spec.rb
index 2eb23dd5bd9..4f28017c16b 100644
--- a/spec/db/schema_spec.rb
+++ b/spec/db/schema_spec.rb
@@ -184,7 +184,7 @@ RSpec.describe 'Database schema' do
# These pre-existing enums have limits > 2 bytes
IGNORED_LIMIT_ENUMS = {
- 'Analytics::CycleAnalytics::GroupStage' => %w[start_event_identifier end_event_identifier],
+ 'Analytics::CycleAnalytics::Stage' => %w[start_event_identifier end_event_identifier],
'Analytics::CycleAnalytics::ProjectStage' => %w[start_event_identifier end_event_identifier],
'Ci::Bridge' => %w[failure_reason],
'Ci::Build' => %w[failure_reason],
diff --git a/spec/lib/gitlab/import_export/all_models.yml b/spec/lib/gitlab/import_export/all_models.yml
index 74ff110e7bd..8750bf4387c 100644
--- a/spec/lib/gitlab/import_export/all_models.yml
+++ b/spec/lib/gitlab/import_export/all_models.yml
@@ -684,8 +684,6 @@ timelogs:
- note
push_event_payload:
- event
-issuable_severity:
-- issue
issue_assignees:
- issue
- assignee
@@ -710,6 +708,7 @@ metrics:
resource_label_events:
- user
- issue
+- work_item
- merge_request
- epic
- label
@@ -862,11 +861,13 @@ approvals:
resource_milestone_events:
- user
- issue
+ - work_item
- merge_request
- milestone
resource_state_events:
- user
- issue
+ - work_item
- merge_request
- source_merge_request
- epic
@@ -879,6 +880,7 @@ iteration:
resource_iteration_events:
- user
- issue
+ - work_item
- merge_request
- iteration
iterations_cadence:
diff --git a/spec/models/resource_event_spec.rb b/spec/models/resource_event_spec.rb
new file mode 100644
index 00000000000..f40c192ab2b
--- /dev/null
+++ b/spec/models/resource_event_spec.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe ResourceEvent, feature_category: :team_planing, type: :model do
+ let(:dummy_resource_label_event_class) do
+ Class.new(ResourceEvent) do
+ self.table_name = 'resource_label_events'
+ end
+ end
+
+ it 'raises error on not implemented `issuable` method' do
+ expect { dummy_resource_label_event_class.new.issuable }.to raise_error(NoMethodError)
+ end
+
+ it 'raises error on not implemented `synthetic_note_class` method' do
+ expect { dummy_resource_label_event_class.new.synthetic_note_class }.to raise_error(NoMethodError)
+ end
+end
diff --git a/spec/models/resource_label_event_spec.rb b/spec/models/resource_label_event_spec.rb
index 5087a8e8524..87f3b9fb2bb 100644
--- a/spec/models/resource_label_event_spec.rb
+++ b/spec/models/resource_label_event_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe ResourceLabelEvent, type: :model do
+RSpec.describe ResourceLabelEvent, feature_category: :team_planing, type: :model do
let_it_be(:project) { create(:project, :repository) }
let_it_be(:issue) { create(:issue, project: project) }
let_it_be(:merge_request) { create(:merge_request, source_project: project) }
@@ -15,6 +15,7 @@ RSpec.describe ResourceLabelEvent, type: :model do
it_behaves_like 'a resource event'
it_behaves_like 'a resource event for issues'
it_behaves_like 'a resource event for merge requests'
+ it_behaves_like 'a note for work item resource event'
describe 'associations' do
it { is_expected.to belong_to(:label) }
@@ -154,4 +155,19 @@ RSpec.describe ResourceLabelEvent, type: :model do
expect(event_1.discussion_id).not_to eq(event_2.discussion_id)
end
end
+
+ context 'with multiple label events' do
+ let_it_be(:user) { create(:user) }
+ let_it_be(:project) { create(:project) }
+ let_it_be(:work_item) { create(:work_item, :task, project: project, author: user) }
+ let_it_be(:events) { create_pair(:resource_label_event, issue: work_item) }
+
+ it 'builds synthetic note' do
+ first_event = events.first
+ synthetic_note = first_event.work_item_synthetic_system_note(events: events)
+
+ expect(synthetic_note.class.name).to eq(first_event.synthetic_note_class.name)
+ expect(synthetic_note.events).to match_array(events)
+ end
+ end
end
diff --git a/spec/models/resource_milestone_event_spec.rb b/spec/models/resource_milestone_event_spec.rb
index c1761e5b2e8..11b704ceadf 100644
--- a/spec/models/resource_milestone_event_spec.rb
+++ b/spec/models/resource_milestone_event_spec.rb
@@ -2,10 +2,11 @@
require 'spec_helper'
-RSpec.describe ResourceMilestoneEvent, type: :model do
+RSpec.describe ResourceMilestoneEvent, feature_category: :team_planing, type: :model do
it_behaves_like 'a resource event'
it_behaves_like 'a resource event for issues'
it_behaves_like 'a resource event for merge requests'
+ it_behaves_like 'a note for work item resource event'
it_behaves_like 'having unique enum values'
it_behaves_like 'timebox resource event validations'
diff --git a/spec/models/resource_state_event_spec.rb b/spec/models/resource_state_event_spec.rb
index f84634bd220..04e4359a3ff 100644
--- a/spec/models/resource_state_event_spec.rb
+++ b/spec/models/resource_state_event_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe ResourceStateEvent, type: :model do
+RSpec.describe ResourceStateEvent, feature_category: :team_planing, type: :model do
subject { build(:resource_state_event, issue: issue) }
let(:issue) { create(:issue) }
@@ -11,6 +11,7 @@ RSpec.describe ResourceStateEvent, type: :model do
it_behaves_like 'a resource event'
it_behaves_like 'a resource event for issues'
it_behaves_like 'a resource event for merge requests'
+ it_behaves_like 'a note for work item resource event'
describe 'validations' do
describe 'Issuable validation' do
diff --git a/spec/requests/api/search_spec.rb b/spec/requests/api/search_spec.rb
index 430d3b7d187..035f53db12e 100644
--- a/spec/requests/api/search_spec.rb
+++ b/spec/requests/api/search_spec.rb
@@ -377,6 +377,26 @@ RSpec.describe API::Search, feature_category: :global_search do
end
end
+ context 'global search is disabled for the given scope' do
+ it 'returns forbidden response' do
+ allow_next_instance_of(SearchService) do |instance|
+ allow(instance).to receive(:global_search_enabled_for_scope?).and_return false
+ end
+ get api(endpoint, user), params: { search: 'awesome', scope: 'issues' }
+ expect(response).to have_gitlab_http_status(:forbidden)
+ end
+ end
+
+ context 'global search is enabled for the given scope' do
+ it 'returns forbidden response' do
+ allow_next_instance_of(SearchService) do |instance|
+ allow(instance).to receive(:global_search_enabled_for_scope?).and_return true
+ end
+ get api(endpoint, user), params: { search: 'awesome', scope: 'issues' }
+ expect(response).to have_gitlab_http_status(:ok)
+ end
+ end
+
it 'increments the custom search sli error rate with error false if no error occurred' do
expect(Gitlab::Metrics::GlobalSearchSlis).to receive(:record_error_rate).with(
error: false,
diff --git a/spec/requests/pwa_controller_spec.rb b/spec/requests/pwa_controller_spec.rb
index fed78cc6c4b..a80d083c11f 100644
--- a/spec/requests/pwa_controller_spec.rb
+++ b/spec/requests/pwa_controller_spec.rb
@@ -28,6 +28,23 @@ RSpec.describe PwaController, feature_category: :navigation do
expect(response).to have_gitlab_http_status(:success)
end
end
+
+ context 'when user is signed in' do
+ before do
+ user = create(:user)
+ allow(user).to receive(:role_required?).and_return(true)
+
+ sign_in(user)
+ end
+
+ it 'skips the required signup info storing of user location' do
+ expect_next_instance_of(described_class) do |instance|
+ expect(instance).not_to receive(:store_location_for).with(:user, manifest_path(format: :json))
+ end
+
+ get manifest_path(format: :json)
+ end
+ end
end
describe 'GET #offline' do
diff --git a/spec/services/search_service_spec.rb b/spec/services/search_service_spec.rb
index 90e80a45515..d11fc377d83 100644
--- a/spec/services/search_service_spec.rb
+++ b/spec/services/search_service_spec.rb
@@ -471,4 +471,32 @@ RSpec.describe SearchService, feature_category: :global_search do
end
end
end
+
+ describe '.global_search_enabled_for_scope?' do
+ using RSpec::Parameterized::TableSyntax
+ let(:search) { 'foobar' }
+
+ where(:scope, :feature_flag, :enabled, :expected) do
+ 'blobs' | :global_search_code_tab | false | false
+ 'blobs' | :global_search_code_tab | true | true
+ 'commits' | :global_search_commits_tab | false | false
+ 'commits' | :global_search_commits_tab | true | true
+ 'issues' | :global_search_issues_tab | false | false
+ 'issues' | :global_search_issues_tab | true | true
+ 'merge_requests' | :global_search_merge_requests_tab | false | false
+ 'merge_requests' | :global_search_merge_requests_tab | true | true
+ 'wiki_blobs' | :global_search_wiki_tab | false | false
+ 'wiki_blobs' | :global_search_wiki_tab | true | true
+ 'users' | :global_search_users_tab | false | false
+ 'users' | :global_search_users_tab | true | true
+ 'random' | :random | nil | true
+ end
+
+ with_them do
+ it 'returns false when feature_flag is not enabled and returns true when feature_flag is enabled' do
+ stub_feature_flags(feature_flag => enabled)
+ expect(subject.global_search_enabled_for_scope?).to eq expected
+ end
+ end
+ end
end
diff --git a/spec/support/shared_examples/models/resource_event_shared_examples.rb b/spec/support/shared_examples/models/resource_event_shared_examples.rb
index 80806ee768a..8cab2de076d 100644
--- a/spec/support/shared_examples/models/resource_event_shared_examples.rb
+++ b/spec/support/shared_examples/models/resource_event_shared_examples.rb
@@ -161,3 +161,15 @@ RSpec.shared_examples 'a resource event for merge requests' do
end
end
end
+
+RSpec.shared_examples 'a note for work item resource event' do
+ let_it_be(:user) { create(:user) }
+ let_it_be(:project) { create(:project) }
+ let_it_be(:work_item) { create(:work_item, :task, project: project, author: user) }
+
+ it 'builds synthetic note with correct synthetic_note_class' do
+ event = build(described_class.name.underscore.to_sym, issue: work_item)
+
+ expect(event.work_item_synthetic_system_note.class.name).to eq(event.synthetic_note_class.name)
+ end
+end
diff --git a/yarn.lock b/yarn.lock
index 56a1baf3495..f205afc1d37 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -6507,10 +6507,10 @@ graphql@^15.7.2:
resolved "https://registry.yarnpkg.com/graphql/-/graphql-15.7.2.tgz#85ab0eeb83722977151b3feb4d631b5f2ab287ef"
integrity sha512-AnnKk7hFQFmU/2I9YSQf3xw44ctnSFCfp3zE0N6W174gqe9fWG/2rKaKxROK7CcI3XtERpjEKFqts8o319Kf7A==
-gridstack@^7.0.0:
- version "7.0.0"
- resolved "https://registry.yarnpkg.com/gridstack/-/gridstack-7.0.0.tgz#2d00b28efa8d22a8b9ad2640c8ab64b494bbfdc9"
- integrity sha512-iBts/PRuqg6OQvdpv7A84p3RROxzXVSKjM3SJHrdl2pdDZKmIpGo2oxjdCHv6l+SzU2EuptcHd1Rqouocwl1Cg==
+gridstack@^7.1.2:
+ version "7.1.2"
+ resolved "https://registry.yarnpkg.com/gridstack/-/gridstack-7.1.2.tgz#288ccccf786e0440094a48d5f8d654064fb18566"
+ integrity sha512-vc0sHheyOCKe2VE9JgNlNjHroaYJAbOsl/R4sF6TY5WqKTa6owJz4pj3D+W3QQZ43zS18yttLw6m+R9UNuoC3A==
gzip-size@^6.0.0:
version "6.0.0"