Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-03-03 03:10:50 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-03-03 03:10:50 +0300
commit8d9c82762d6c4f10f4d3eba5d484179f98c284b0 (patch)
tree4e89532d0d82bfaa1af660a76091528eb4aebc86
parenteb1755b2d90efcc161774f66ccd2317ad4c471de (diff)
Add latest changes from gitlab-org/gitlab@master
-rw-r--r--app/controllers/concerns/boards_responses.rb4
-rw-r--r--app/controllers/concerns/multiple_boards_actions.rb2
-rw-r--r--app/controllers/groups/boards_controller.rb2
-rw-r--r--app/controllers/projects/boards_controller.rb2
-rw-r--r--app/graphql/mutations/boards/create.rb2
-rw-r--r--app/graphql/mutations/boards/destroy.rb2
-rw-r--r--app/graphql/mutations/boards/issues/issue_move_list.rb2
-rw-r--r--app/graphql/mutations/boards/lists/create.rb2
-rw-r--r--app/graphql/mutations/boards/lists/destroy.rb2
-rw-r--r--app/graphql/mutations/boards/lists/update.rb2
-rw-r--r--app/graphql/mutations/boards/update.rb2
-rw-r--r--app/graphql/resolvers/board_lists_resolver.rb2
-rw-r--r--app/graphql/types/access_level_enum.rb13
-rw-r--r--app/graphql/types/board_type.rb2
-rw-r--r--app/mailers/emails/merge_requests.rb8
-rw-r--r--app/models/ci/runner.rb30
-rw-r--r--app/policies/concerns/readonly_abilities.rb2
-rw-r--r--app/policies/group_policy.rb8
-rw-r--r--app/policies/project_policy.rb20
-rw-r--r--app/services/boards/lists/update_service.rb4
-rw-r--r--app/services/ci/update_build_queue_service.rb2
-rw-r--r--app/services/merge_requests/update_service.rb9
-rw-r--r--app/services/notification_service.rb14
-rw-r--r--app/views/shared/boards/_show.html.haml2
-rw-r--r--app/views/shared/boards/_switcher.html.haml2
-rw-r--r--app/views/shared/issuable/_search_bar.html.haml4
-rw-r--r--changelogs/unreleased/15332-notify-when-merge-request-draft-status-changes.yml5
-rw-r--r--changelogs/unreleased/fp-reduce-queries-when-ticking-runner-queue.yml5
-rw-r--r--changelogs/unreleased/preload-runner-tags.yml5
-rw-r--r--config/feature_flags/development/ci_preload_runner_tags.yml8
-rw-r--r--config/feature_flags/development/ci_reduce_queries_when_ticking_runner_queue.yml8
-rw-r--r--doc/administration/geo/replication/datatypes.md2
-rw-r--r--doc/administration/instance_limits.md2
-rw-r--r--doc/administration/logs.md2
-rw-r--r--doc/api/graphql/reference/index.md13
-rw-r--r--doc/api/search.md2
-rw-r--r--doc/development/elasticsearch.md2
-rw-r--r--doc/integration/README.md3
-rw-r--r--doc/integration/elasticsearch.md5
-rw-r--r--doc/subscriptions/bronze_starter.md5
-rw-r--r--doc/topics/git/cherry_picking.md53
-rw-r--r--doc/university/training/topics/cherry_picking.md36
-rw-r--r--doc/university/training/topics/tags.md2
-rw-r--r--doc/user/clusters/applications.md2
-rw-r--r--doc/user/index.md2
-rw-r--r--doc/user/project/merge_requests/merge_request_approvals.md3
-rw-r--r--doc/user/search/advanced_global_search.md70
-rw-r--r--doc/user/search/advanced_search.md115
-rw-r--r--doc/user/search/advanced_search_syntax.md90
-rw-r--r--doc/user/search/img/advanced_global_search.pngbin15017 -> 0 bytes
-rw-r--r--doc/user/search/img/advanced_search_v13.10.pngbin0 -> 46767 bytes
-rw-r--r--doc/user/search/index.md8
-rw-r--r--lib/api/boards.rb20
-rw-r--r--lib/api/group_boards.rb16
-rw-r--r--spec/controllers/groups/boards_controller_spec.rb6
-rw-r--r--spec/controllers/projects/boards_controller_spec.rb8
-rw-r--r--spec/graphql/mutations/boards/update_spec.rb2
-rw-r--r--spec/graphql/types/access_level_enum_spec.rb2
-rw-r--r--spec/graphql/types/board_type_spec.rb2
-rw-r--r--spec/models/ci/runner_spec.rb43
-rw-r--r--spec/models/user_spec.rb2
-rw-r--r--spec/policies/project_policy_spec.rb4
-rw-r--r--spec/services/ci/update_build_queue_service_spec.rb57
-rw-r--r--spec/services/merge_requests/update_service_spec.rb42
-rw-r--r--spec/services/notification_service_spec.rb36
-rw-r--r--spec/support/shared_contexts/policies/group_policy_shared_context.rb4
-rw-r--r--spec/support/shared_contexts/policies/project_policy_shared_context.rb6
-rw-r--r--spec/support/shared_examples/requests/api/graphql/group_and_project_boards_query_shared_examples.rb2
68 files changed, 538 insertions, 308 deletions
diff --git a/app/controllers/concerns/boards_responses.rb b/app/controllers/concerns/boards_responses.rb
index 6e6686f225c..7307b7b4f8f 100644
--- a/app/controllers/concerns/boards_responses.rb
+++ b/app/controllers/concerns/boards_responses.rb
@@ -35,7 +35,7 @@ module BoardsResponses
end
def authorize_read_list
- authorize_action_for!(board, :read_list)
+ authorize_action_for!(board, :read_issue_board_list)
end
def authorize_read_issue
@@ -54,7 +54,7 @@ module BoardsResponses
end
def authorize_admin_list
- authorize_action_for!(board, :admin_list)
+ authorize_action_for!(board, :admin_issue_board_list)
end
def authorize_action_for!(resource, ability)
diff --git a/app/controllers/concerns/multiple_boards_actions.rb b/app/controllers/concerns/multiple_boards_actions.rb
index 5206f5759d8..85bb73463db 100644
--- a/app/controllers/concerns/multiple_boards_actions.rb
+++ b/app/controllers/concerns/multiple_boards_actions.rb
@@ -80,7 +80,7 @@ module MultipleBoardsActions
end
def authorize_admin_board!
- return render_404 unless can?(current_user, :admin_board, parent)
+ return render_404 unless can?(current_user, :admin_issue_board, parent)
end
def serializer
diff --git a/app/controllers/groups/boards_controller.rb b/app/controllers/groups/boards_controller.rb
index fa109021b7d..379fb7bb38b 100644
--- a/app/controllers/groups/boards_controller.rb
+++ b/app/controllers/groups/boards_controller.rb
@@ -44,6 +44,6 @@ class Groups::BoardsController < Groups::ApplicationController
end
def authorize_read_board!
- access_denied! unless can?(current_user, :read_board, group)
+ access_denied! unless can?(current_user, :read_issue_board, group)
end
end
diff --git a/app/controllers/projects/boards_controller.rb b/app/controllers/projects/boards_controller.rb
index d2e5d319f96..f9d84a9dcf7 100644
--- a/app/controllers/projects/boards_controller.rb
+++ b/app/controllers/projects/boards_controller.rb
@@ -45,6 +45,6 @@ class Projects::BoardsController < Projects::ApplicationController
end
def authorize_read_board!
- access_denied! unless can?(current_user, :read_board, project)
+ access_denied! unless can?(current_user, :read_issue_board, project)
end
end
diff --git a/app/graphql/mutations/boards/create.rb b/app/graphql/mutations/boards/create.rb
index 92bce557446..fe324f848e7 100644
--- a/app/graphql/mutations/boards/create.rb
+++ b/app/graphql/mutations/boards/create.rb
@@ -14,7 +14,7 @@ module Mutations
null: true,
description: 'The board after mutation.'
- authorize :admin_board
+ authorize :admin_issue_board
def resolve(args)
board_parent = authorized_resource_parent_find!(args)
diff --git a/app/graphql/mutations/boards/destroy.rb b/app/graphql/mutations/boards/destroy.rb
index 8ec13b885d5..4a0068edee2 100644
--- a/app/graphql/mutations/boards/destroy.rb
+++ b/app/graphql/mutations/boards/destroy.rb
@@ -14,7 +14,7 @@ module Mutations
required: true,
description: 'The global ID of the board to destroy.'
- authorize :admin_board
+ authorize :admin_issue_board
def resolve(id:)
board = authorized_find!(id: id)
diff --git a/app/graphql/mutations/boards/issues/issue_move_list.rb b/app/graphql/mutations/boards/issues/issue_move_list.rb
index 91dfd9fc3e9..6df4250fc67 100644
--- a/app/graphql/mutations/boards/issues/issue_move_list.rb
+++ b/app/graphql/mutations/boards/issues/issue_move_list.rb
@@ -83,7 +83,7 @@ module Mutations
end
def authorize_board!(board)
- return if Ability.allowed?(current_user, :read_board, board.resource_parent)
+ return if Ability.allowed?(current_user, :read_issue_board, board.resource_parent)
raise_resource_not_available_error!
end
diff --git a/app/graphql/mutations/boards/lists/create.rb b/app/graphql/mutations/boards/lists/create.rb
index f3aae9ac9c8..673fa95fc56 100644
--- a/app/graphql/mutations/boards/lists/create.rb
+++ b/app/graphql/mutations/boards/lists/create.rb
@@ -15,7 +15,7 @@ module Mutations
null: true,
description: 'Issue list in the issue board.'
- authorize :admin_list
+ authorize :admin_issue_board_list
private
diff --git a/app/graphql/mutations/boards/lists/destroy.rb b/app/graphql/mutations/boards/lists/destroy.rb
index 61ffae7c047..a50b5f73455 100644
--- a/app/graphql/mutations/boards/lists/destroy.rb
+++ b/app/graphql/mutations/boards/lists/destroy.rb
@@ -33,7 +33,7 @@ module Mutations
def can_admin_list?(list)
return false unless list.present?
- Ability.allowed?(current_user, :admin_list, list.board)
+ Ability.allowed?(current_user, :admin_issue_board_list, list.board)
end
end
end
diff --git a/app/graphql/mutations/boards/lists/update.rb b/app/graphql/mutations/boards/lists/update.rb
index 0a025a21353..504082ec22c 100644
--- a/app/graphql/mutations/boards/lists/update.rb
+++ b/app/graphql/mutations/boards/lists/update.rb
@@ -44,7 +44,7 @@ module Mutations
def can_read_list?(list)
return false unless list.present?
- Ability.allowed?(current_user, :read_list, list.board)
+ Ability.allowed?(current_user, :read_issue_board_list, list.board)
end
end
end
diff --git a/app/graphql/mutations/boards/update.rb b/app/graphql/mutations/boards/update.rb
index b4f8179829e..628b3a3fadb 100644
--- a/app/graphql/mutations/boards/update.rb
+++ b/app/graphql/mutations/boards/update.rb
@@ -17,7 +17,7 @@ module Mutations
null: true,
description: 'The board after mutation.'
- authorize :admin_board
+ authorize :admin_issue_board
def resolve(id:, **args)
board = authorized_find!(id: id)
diff --git a/app/graphql/resolvers/board_lists_resolver.rb b/app/graphql/resolvers/board_lists_resolver.rb
index a97ac3220d5..e66f7b97b40 100644
--- a/app/graphql/resolvers/board_lists_resolver.rb
+++ b/app/graphql/resolvers/board_lists_resolver.rb
@@ -9,7 +9,7 @@ module Resolvers
type Types::BoardListType, null: true
extras [:lookahead]
- authorize :read_list
+ authorize :read_issue_board_list
argument :id, Types::GlobalIDType[List],
required: false,
diff --git a/app/graphql/types/access_level_enum.rb b/app/graphql/types/access_level_enum.rb
index 6754d3d28ce..b7eb35ddfc9 100644
--- a/app/graphql/types/access_level_enum.rb
+++ b/app/graphql/types/access_level_enum.rb
@@ -5,11 +5,12 @@ module Types
graphql_name 'AccessLevelEnum'
description 'Access level to a resource'
- value 'NO_ACCESS', value: Gitlab::Access::NO_ACCESS
- value 'GUEST', value: Gitlab::Access::GUEST
- value 'REPORTER', value: Gitlab::Access::REPORTER
- value 'DEVELOPER', value: Gitlab::Access::DEVELOPER
- value 'MAINTAINER', value: Gitlab::Access::MAINTAINER
- value 'OWNER', value: Gitlab::Access::OWNER
+ value 'NO_ACCESS', value: Gitlab::Access::NO_ACCESS, description: 'No access'
+ value 'MINIMAL_ACCESS', value: Gitlab::Access::MINIMAL_ACCESS, description: 'Minimal access'
+ value 'GUEST', value: Gitlab::Access::GUEST, description: 'Guest access'
+ value 'REPORTER', value: Gitlab::Access::REPORTER, description: 'Reporter access'
+ value 'DEVELOPER', value: Gitlab::Access::DEVELOPER, description: 'Developer access'
+ value 'MAINTAINER', value: Gitlab::Access::MAINTAINER, description: 'Maintainer access'
+ value 'OWNER', value: Gitlab::Access::OWNER, description: 'Owner access'
end
end
diff --git a/app/graphql/types/board_type.rb b/app/graphql/types/board_type.rb
index d125ce352c4..f33f3f5e537 100644
--- a/app/graphql/types/board_type.rb
+++ b/app/graphql/types/board_type.rb
@@ -5,7 +5,7 @@ module Types
graphql_name 'Board'
description 'Represents a project or group issue board'
accepts ::Board
- authorize :read_board
+ authorize :read_issue_board
present_using BoardPresenter
diff --git a/app/mailers/emails/merge_requests.rb b/app/mailers/emails/merge_requests.rb
index 494d9875ce4..e538b5e4718 100644
--- a/app/mailers/emails/merge_requests.rb
+++ b/app/mailers/emails/merge_requests.rb
@@ -23,6 +23,14 @@ module Emails
mail_answer_thread(@merge_request, merge_request_thread_options(updated_by_user_id, recipient_id, reason))
end
+ def change_in_merge_request_draft_status_email(recipient_id, merge_request_id, updated_by_user_id, reason = nil)
+ setup_merge_request_mail(merge_request_id, recipient_id)
+
+ @updated_by_user = User.find(updated_by_user_id)
+
+ mail_answer_thread(@merge_request, merge_request_thread_options(updated_by_user_id, recipient_id, reason))
+ end
+
# rubocop: disable CodeReuse/ActiveRecord
def reassigned_merge_request_email(recipient_id, merge_request_id, previous_assignee_ids, updated_by_user_id, reason = nil)
setup_merge_request_mail(merge_request_id, recipient_id)
diff --git a/app/models/ci/runner.rb b/app/models/ci/runner.rb
index 36e61b0d9ec..f9abe6a0acb 100644
--- a/app/models/ci/runner.rb
+++ b/app/models/ci/runner.rb
@@ -253,9 +253,10 @@ module Ci
end
def can_pick?(build)
- return false if self.ref_protected? && !build.protected?
-
- assignable_for?(build.project_id) && accepting_tags?(build)
+ # Run `matches_build?` checks before, since they are cheaper than
+ # `assignable_for?`.
+ #
+ matches_build?(build) && assignable_for?(build.project_id)
end
def only_for?(project)
@@ -266,6 +267,16 @@ module Ci
token[0...8] if token
end
+ def tag_list
+ return super unless Feature.enabled?(:ci_preload_runner_tags, default_enabled: :yaml)
+
+ if tags.loaded?
+ tags.map(&:name)
+ else
+ super
+ end
+ end
+
def has_tags?
tag_list.any?
end
@@ -305,8 +316,10 @@ module Ci
end
def pick_build!(build)
- if can_pick?(build)
- tick_runner_queue
+ if Feature.enabled?(:ci_reduce_queries_when_ticking_runner_queue, self, default_enabled: :yaml)
+ tick_runner_queue if matches_build?(build)
+ else
+ tick_runner_queue if can_pick?(build)
end
end
@@ -370,6 +383,13 @@ module Ci
end
end
+ # TODO: choose a better name and consider splitting this method into two
+ def matches_build?(build)
+ return false if self.ref_protected? && !build.protected?
+
+ accepting_tags?(build)
+ end
+
def accepting_tags?(build)
(run_untagged? || build.has_tags?) && (build.tag_list - tag_list).empty?
end
diff --git a/app/policies/concerns/readonly_abilities.rb b/app/policies/concerns/readonly_abilities.rb
index a267e963541..0303d4cff14 100644
--- a/app/policies/concerns/readonly_abilities.rb
+++ b/app/policies/concerns/readonly_abilities.rb
@@ -17,7 +17,7 @@ module ReadonlyAbilities
READONLY_FEATURES = %i[
issue
- list
+ issue_board_list
merge_request
label
milestone
diff --git a/app/policies/group_policy.rb b/app/policies/group_policy.rb
index 7dd88fcc1ff..53286cf1fdf 100644
--- a/app/policies/group_policy.rb
+++ b/app/policies/group_policy.rb
@@ -97,9 +97,9 @@ class GroupPolicy < BasePolicy
rule { can?(:read_group) }.policy do
enable :read_milestone
- enable :read_list
+ enable :read_issue_board_list
enable :read_label
- enable :read_board
+ enable :read_issue_board
enable :read_group_member
enable :read_custom_emoji
end
@@ -122,9 +122,9 @@ class GroupPolicy < BasePolicy
rule { reporter }.policy do
enable :reporter_access
enable :read_container_image
- enable :admin_board
+ enable :admin_issue_board
enable :admin_label
- enable :admin_list
+ enable :admin_issue_board_list
enable :admin_issue
enable :read_metrics_dashboard_annotation
enable :read_prometheus
diff --git a/app/policies/project_policy.rb b/app/policies/project_policy.rb
index c15c4682654..de80f2f72b8 100644
--- a/app/policies/project_policy.rb
+++ b/app/policies/project_policy.rb
@@ -204,8 +204,8 @@ class ProjectPolicy < BasePolicy
rule { can?(:guest_access) }.policy do
enable :read_project
enable :create_merge_request_in
- enable :read_board
- enable :read_list
+ enable :read_issue_board
+ enable :read_issue_board_list
enable :read_wiki
enable :read_issue
enable :read_label
@@ -231,7 +231,7 @@ class ProjectPolicy < BasePolicy
rule { guest & can?(:read_container_image) }.enable :build_read_container_image
rule { can?(:reporter_access) }.policy do
- enable :admin_board
+ enable :admin_issue_board
enable :download_code
enable :read_statistics
enable :download_wiki_code
@@ -240,7 +240,7 @@ class ProjectPolicy < BasePolicy
enable :reopen_issue
enable :admin_issue
enable :admin_label
- enable :admin_list
+ enable :admin_issue_board_list
enable :admin_issue_link
enable :read_commit_status
enable :read_build
@@ -319,7 +319,7 @@ class ProjectPolicy < BasePolicy
rule { can?(:developer_access) }.policy do
enable :create_package
- enable :admin_board
+ enable :admin_issue_board
enable :admin_merge_request
enable :admin_milestone
enable :update_merge_request
@@ -369,7 +369,7 @@ class ProjectPolicy < BasePolicy
rule { can?(:maintainer_access) }.policy do
enable :destroy_package
- enable :admin_board
+ enable :admin_issue_board
enable :push_to_delete_protected_branch
enable :update_snippet
enable :admin_snippet
@@ -429,8 +429,8 @@ class ProjectPolicy < BasePolicy
rule { issues_disabled }.policy do
prevent(*create_read_update_admin_destroy(:issue))
- prevent(*create_read_update_admin_destroy(:board))
- prevent(*create_read_update_admin_destroy(:list))
+ prevent(*create_read_update_admin_destroy(:issue_board))
+ prevent(*create_read_update_admin_destroy(:issue_board_list))
end
rule { merge_requests_disabled | repository_disabled }.policy do
@@ -507,8 +507,8 @@ class ProjectPolicy < BasePolicy
rule { can?(:public_access) }.policy do
enable :read_package
enable :read_project
- enable :read_board
- enable :read_list
+ enable :read_issue_board
+ enable :read_issue_board_list
enable :read_wiki
enable :read_label
enable :read_milestone
diff --git a/app/services/boards/lists/update_service.rb b/app/services/boards/lists/update_service.rb
index 4a463372c82..e2d9c371ca2 100644
--- a/app/services/boards/lists/update_service.rb
+++ b/app/services/boards/lists/update_service.rb
@@ -47,11 +47,11 @@ module Boards
end
def can_read?(list)
- Ability.allowed?(current_user, :read_list, parent)
+ Ability.allowed?(current_user, :read_issue_board_list, parent)
end
def can_admin?(list)
- Ability.allowed?(current_user, :admin_list, parent)
+ Ability.allowed?(current_user, :admin_issue_board_list, parent)
end
end
end
diff --git a/app/services/ci/update_build_queue_service.rb b/app/services/ci/update_build_queue_service.rb
index 6b21a6aaa57..cf629b879b3 100644
--- a/app/services/ci/update_build_queue_service.rb
+++ b/app/services/ci/update_build_queue_service.rb
@@ -10,6 +10,8 @@ module Ci
def tick_for(build, runners, metrics)
runners = runners.with_recent_runner_queue
+ runners = runners.with_tags if Feature.enabled?(:ci_preload_runner_tags, default_enabled: :yaml)
+
metrics.observe_active_runners(-> { runners.to_a.size })
runners.each do |runner|
diff --git a/app/services/merge_requests/update_service.rb b/app/services/merge_requests/update_service.rb
index 6745143de22..38df3ee0e43 100644
--- a/app/services/merge_requests/update_service.rb
+++ b/app/services/merge_requests/update_service.rb
@@ -154,11 +154,20 @@ module MergeRequests
elsif old_title_wip && !new_title_wip
# Unmarked as Draft/WIP
#
+ notify_draft_status_changed(merge_request)
+
merge_request_activity_counter
.track_unmarked_as_draft_action(user: current_user)
end
end
+ def notify_draft_status_changed(merge_request)
+ notification_service.async.change_in_merge_request_draft_status(
+ merge_request,
+ current_user
+ )
+ end
+
def handle_milestone_change(merge_request)
return if skip_milestone_email
diff --git a/app/services/notification_service.rb b/app/services/notification_service.rb
index ff652cc2098..1cd4b5407ef 100644
--- a/app/services/notification_service.rb
+++ b/app/services/notification_service.rb
@@ -189,6 +189,20 @@ class NotificationService
end
end
+ def change_in_merge_request_draft_status(merge_request, current_user)
+ recipients = NotificationRecipients::BuildService.build_recipients(merge_request, current_user, action: "draft_status_change")
+
+ recipients.each do |recipient|
+ mailer.send(
+ :change_in_merge_request_draft_status_email,
+ recipient.user.id,
+ merge_request.id,
+ current_user.id,
+ recipient.reason
+ ).deliver_later
+ end
+ end
+
# When a merge request is found to be unmergeable, we should send an email to:
#
# * mr author
diff --git a/app/views/shared/boards/_show.html.haml b/app/views/shared/boards/_show.html.haml
index ababbdc7eb9..8c0893adaaa 100644
--- a/app/views/shared/boards/_show.html.haml
+++ b/app/views/shared/boards/_show.html.haml
@@ -2,7 +2,7 @@
- group = local_assigns.fetch(:group, false)
-# TODO: Move group_id and can_admin_list to the board store
See: https://gitlab.com/gitlab-org/gitlab/-/issues/213082
-- can_admin_list = can?(current_user, :admin_list, current_board_parent) == true
+- can_admin_list = can?(current_user, :admin_issue_board_list, current_board_parent) == true
- @no_breadcrumb_container = true
- @no_container = true
- @content_class = "issue-boards-content js-focus-mode-board"
diff --git a/app/views/shared/boards/_switcher.html.haml b/app/views/shared/boards/_switcher.html.haml
index 58e877f20fe..18e0ca20cf7 100644
--- a/app/views/shared/boards/_switcher.html.haml
+++ b/app/views/shared/boards/_switcher.html.haml
@@ -7,7 +7,7 @@
milestone_path: milestones_filter_path(milestone_filter_opts),
board_base_url: board_base_url,
has_missing_boards: (!multiple_boards_available? && current_board_parent.boards.size > 1).to_s,
- can_admin_board: can?(current_user, :admin_board, parent).to_s,
+ can_admin_board: can?(current_user, :admin_issue_board, parent).to_s,
multiple_issue_boards_available: parent.multiple_issue_boards_available?.to_s,
labels_path: labels_filter_path_with_defaults(only_group_labels: true, include_descendant_groups: true),
labels_web_url: parent.is_a?(Project) ? project_labels_path(@project) : group_labels_path(@group),
diff --git a/app/views/shared/issuable/_search_bar.html.haml b/app/views/shared/issuable/_search_bar.html.haml
index 0a77f59e1e0..bfa31206a85 100644
--- a/app/views/shared/issuable/_search_bar.html.haml
+++ b/app/views/shared/issuable/_search_bar.html.haml
@@ -5,7 +5,7 @@
- placeholder = local_assigns[:placeholder] || _('Search or filter results...')
- is_not_boards_modal_or_productivity_analytics = type != :boards_modal && type != :productivity_analytics
- block_css_class = is_not_boards_modal_or_productivity_analytics ? 'row-content-block second-block' : ''
-- user_can_admin_list = board && can?(current_user, :admin_list, board.resource_parent)
+- user_can_admin_list = board && can?(current_user, :admin_issue_board_list, board.resource_parent)
.issues-filters{ class: ("w-100" if type == :boards_modal) }
.issues-details-filters.filtered-search-block.d-flex.flex-column.flex-lg-row{ class: block_css_class, "v-pre" => type == :boards_modal }
@@ -202,7 +202,7 @@
- else
= render 'shared/issuable/board_create_list_dropdown', board: board
- if @project
- #js-add-issues-btn{ data: { can_admin_list: can?(current_user, :admin_list, @project) } }
+ #js-add-issues-btn{ data: { can_admin_list: can?(current_user, :admin_issue_board_list, @project) } }
#js-toggle-focus-btn
- elsif is_not_boards_modal_or_productivity_analytics && show_sorting_dropdown
= render 'shared/issuable/sort_dropdown'
diff --git a/changelogs/unreleased/15332-notify-when-merge-request-draft-status-changes.yml b/changelogs/unreleased/15332-notify-when-merge-request-draft-status-changes.yml
new file mode 100644
index 00000000000..eace8a9a2f8
--- /dev/null
+++ b/changelogs/unreleased/15332-notify-when-merge-request-draft-status-changes.yml
@@ -0,0 +1,5 @@
+---
+title: Send notifications to subscribers when merge request draft status removed
+merge_request: 55444
+author:
+type: changed
diff --git a/changelogs/unreleased/fp-reduce-queries-when-ticking-runner-queue.yml b/changelogs/unreleased/fp-reduce-queries-when-ticking-runner-queue.yml
new file mode 100644
index 00000000000..ac43d37ebeb
--- /dev/null
+++ b/changelogs/unreleased/fp-reduce-queries-when-ticking-runner-queue.yml
@@ -0,0 +1,5 @@
+---
+title: Reduce queries when ticking runner queue
+merge_request: 55496
+author:
+type: performance
diff --git a/changelogs/unreleased/preload-runner-tags.yml b/changelogs/unreleased/preload-runner-tags.yml
new file mode 100644
index 00000000000..1b733ce4113
--- /dev/null
+++ b/changelogs/unreleased/preload-runner-tags.yml
@@ -0,0 +1,5 @@
+---
+title: Preload runner tags for `UpdateBuildQueueService`
+merge_request: 55543
+author:
+type: performance
diff --git a/config/feature_flags/development/ci_preload_runner_tags.yml b/config/feature_flags/development/ci_preload_runner_tags.yml
new file mode 100644
index 00000000000..d91bd788d41
--- /dev/null
+++ b/config/feature_flags/development/ci_preload_runner_tags.yml
@@ -0,0 +1,8 @@
+---
+name: ci_preload_runner_tags
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/55543
+rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/323243
+milestone: '13.10'
+type: development
+group: group::memory
+default_enabled: false
diff --git a/config/feature_flags/development/ci_reduce_queries_when_ticking_runner_queue.yml b/config/feature_flags/development/ci_reduce_queries_when_ticking_runner_queue.yml
new file mode 100644
index 00000000000..906eb83aa01
--- /dev/null
+++ b/config/feature_flags/development/ci_reduce_queries_when_ticking_runner_queue.yml
@@ -0,0 +1,8 @@
+---
+name: ci_reduce_queries_when_ticking_runner_queue
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/55496
+rollout_issue_url:
+milestone: '13.10'
+type: development
+group: group::continuous integration
+default_enabled: false
diff --git a/doc/administration/geo/replication/datatypes.md b/doc/administration/geo/replication/datatypes.md
index aae31e5cd9d..74937b2c8c6 100644
--- a/doc/administration/geo/replication/datatypes.md
+++ b/doc/administration/geo/replication/datatypes.md
@@ -118,7 +118,7 @@ We use PostgreSQL's own replication functionality to replicate data from the **p
We use Redis both as a cache store and to hold persistent data for our background jobs system. Because both
use-cases has data that are exclusive to the same Geo node, we don't replicate it between nodes.
-Elasticsearch is an optional database, that can enable advanced searching capabilities, like improved Global Search
+Elasticsearch is an optional database, that can enable advanced searching capabilities, like improved Advanced Search
in both source-code level and user generated content in Issues / Merge-Requests and discussions. Currently it's not
supported in Geo.
diff --git a/doc/administration/instance_limits.md b/doc/administration/instance_limits.md
index 27e8b13812f..206ad7e742b 100644
--- a/doc/administration/instance_limits.md
+++ b/doc/administration/instance_limits.md
@@ -526,7 +526,7 @@ amount of memory during indexing.
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/201826) in GitLab 12.8.
-You can set a limit on the content of text fields indexed for Global Search.
+You can set a limit on the content of text fields indexed for Advanced Search.
Setting a maximum helps to reduce the load of the indexing processes. If any
text field exceeds this limit then the text will be truncated to this number of
characters and the rest will not be indexed and hence will not be searchable.
diff --git a/doc/administration/logs.md b/doc/administration/logs.md
index 17ecb324417..8b6617210a4 100644
--- a/doc/administration/logs.md
+++ b/doc/administration/logs.md
@@ -87,7 +87,7 @@ In addition, the log contains the originating IP address,
(`remote_ip`), the user's ID (`user_id`), and username (`username`).
Some endpoints such as `/search` may make requests to Elasticsearch if using
-[Advanced Search](../user/search/advanced_global_search.md). These
+[Advanced Search](../user/search/advanced_search.md). These
additionally log `elasticsearch_calls` and `elasticsearch_call_duration_s`,
which correspond to:
diff --git a/doc/api/graphql/reference/index.md b/doc/api/graphql/reference/index.md
index 62472b4590b..d995b57f275 100644
--- a/doc/api/graphql/reference/index.md
+++ b/doc/api/graphql/reference/index.md
@@ -4964,12 +4964,13 @@ Access level to a resource.
| Value | Description |
| ----- | ----------- |
-| `DEVELOPER` | |
-| `GUEST` | |
-| `MAINTAINER` | |
-| `NO_ACCESS` | |
-| `OWNER` | |
-| `REPORTER` | |
+| `DEVELOPER` | Developer access |
+| `GUEST` | Guest access |
+| `MAINTAINER` | Maintainer access |
+| `MINIMAL_ACCESS` | Minimal access |
+| `NO_ACCESS` | No access |
+| `OWNER` | Owner access |
+| `REPORTER` | Reporter access |
### AlertManagementAlertSort
diff --git a/doc/api/search.md b/doc/api/search.md
index 9e1407fdffd..6e9714fba2b 100644
--- a/doc/api/search.md
+++ b/doc/api/search.md
@@ -12,7 +12,7 @@ type: reference, api
Every API call to search must be authenticated.
-## Global Search API
+## Advanced Search API
Search globally across the GitLab instance.
diff --git a/doc/development/elasticsearch.md b/doc/development/elasticsearch.md
index e5d69acc2e5..e076d305251 100644
--- a/doc/development/elasticsearch.md
+++ b/doc/development/elasticsearch.md
@@ -184,7 +184,7 @@ If the current version is `v12p1`, and we need to create a new version for `v12p
1. Change the namespace for files under `v12p1` folder from `Latest` to `V12p1`
1. Make changes to files under the `latest` folder as needed
-## Creating a new Global Search migration
+## Creating a new Advanced Search migration
> This functionality was introduced by [#234046](https://gitlab.com/gitlab-org/gitlab/-/issues/234046).
diff --git a/doc/integration/README.md b/doc/integration/README.md
index 9ae75019efb..9c3d39327f8 100644
--- a/doc/integration/README.md
+++ b/doc/integration/README.md
@@ -59,8 +59,7 @@ GitLab can be integrated with the following enhancements:
or [Kroki](../administration/integration/kroki.md) to use diagrams in AsciiDoc and Markdown documents.
- Attach merge requests to [Trello](trello_power_up.md) cards.
- Enable integrated code intelligence powered by [Sourcegraph](sourcegraph.md).
-- Add [Elasticsearch](elasticsearch.md) for [Advanced Search](../user/search/advanced_global_search.md),
- [Advanced System Search](../user/search/advanced_search_syntax.md), and faster searching.
+- Add [Elasticsearch](elasticsearch.md) for [Advanced Search](../user/search/advanced_search.md).
## Integrations
diff --git a/doc/integration/elasticsearch.md b/doc/integration/elasticsearch.md
index 6a37514316d..164ec2d32bc 100644
--- a/doc/integration/elasticsearch.md
+++ b/doc/integration/elasticsearch.md
@@ -11,10 +11,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w
This document describes how to enable Advanced Search. After
Advanced Search is enabled, you'll have the benefit of fast search response times
-and the advantage of the following special searches:
-
-- [Advanced Search](../user/search/advanced_global_search.md)
-- [Advanced Search Syntax](../user/search/advanced_search_syntax.md)
+and the advantage of the [special searches](../user/search/advanced_search.md).
## Version requirements
diff --git a/doc/subscriptions/bronze_starter.md b/doc/subscriptions/bronze_starter.md
index 7c80c7c336b..d66acb4b3f2 100644
--- a/doc/subscriptions/bronze_starter.md
+++ b/doc/subscriptions/bronze_starter.md
@@ -107,8 +107,7 @@ the tiers are no longer mentioned in GitLab documentation:
- Search:
- [Filtering merge requests by approvers](../user/search/index.md#filtering-merge-requests-by-approvers)
- [Filtering merge requests by "approved by"](../user/search/index.md#filtering-merge-requests-by-approved-by)
- - [Advanced Global Search (Elasticsearch)](../user/search/advanced_global_search.md)
- - [Advanced Search Syntax](../user/search/advanced_search_syntax.md)
+ - [Advanced Search (Elasticsearch)](../user/search/advanced_search.md)
- [Service Desk](../user/project/service_desk.md)
- [Storage usage statistics](../user/usage_quotas.md#storage-usage-statistics)
@@ -130,7 +129,7 @@ Bronze-level subscribers:
- [Group iterations API](../api/group_iterations.md)
- Project milestones API: [Get all burndown chart events for a single milestone](../api/milestones.md#get-all-burndown-chart-events-for-a-single-milestone)
- [Project iterations API](../api/iterations.md)
- - Fields in the [Search API](../api/search.md) available only to [Advanced Global Search (Elasticsearch)](../integration/elasticsearch.md) users
+ - Fields in the [Search API](../api/search.md) available only to [Advanced Search (Elasticsearch)](../integration/elasticsearch.md) users
- Fields in the [Merge requests API](../api/merge_requests.md) for [merge request approvals](../user/project/merge_requests/merge_request_approvals.md)
- Fields in the [Protected branches API](../api/protected_branches.md) that specify users or groups allowed to merge
- [Merge request approvals API](../api/merge_request_approvals.md)
diff --git a/doc/topics/git/cherry_picking.md b/doc/topics/git/cherry_picking.md
new file mode 100644
index 00000000000..5a0867371bb
--- /dev/null
+++ b/doc/topics/git/cherry_picking.md
@@ -0,0 +1,53 @@
+---
+stage: Create
+group: Source Code
+info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
+comments: false
+---
+
+# Cherry Pick
+
+Given an existing commit on one branch, apply the change to another branch.
+
+This can be useful for backporting bug fixes to previous release branches. Make
+the commit on the default branch, and then cherry pick it into the release branch.
+
+## Sample workflow
+
+1. Check out a new `stable` branch from the default branch:
+
+ ```shell
+ git checkout master
+ git checkout -b stable
+ ```
+
+1. Change back to the default branch:
+
+ ```shell
+ git checkout master
+ ```
+
+1. Make any required changes, then commit the changes:
+
+ ```shell
+ git add changed_file.rb
+ git commit -m 'Fix bugs in changed_file.rb'
+ ```
+
+1. Review the commit log and copy the SHA of the latest commit:
+
+ ```shell
+ git log
+ ```
+
+1. Check out the `stable` branch:
+
+ ```shell
+ git checkout stable
+ ```
+
+1. Cherry pick the commit by using the SHA copied previously:
+
+ ```shell
+ git cherry-pick <commit SHA>
+ ```
diff --git a/doc/university/training/topics/cherry_picking.md b/doc/university/training/topics/cherry_picking.md
index 2f806ad2590..f0f815baa94 100644
--- a/doc/university/training/topics/cherry_picking.md
+++ b/doc/university/training/topics/cherry_picking.md
@@ -1,36 +1,8 @@
---
-stage: none
-group: unassigned
-info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
-comments: false
+redirect_to: '../../../topics/git/cherry_picking.md'
---
-# Cherry Pick
+This document was moved to [another location](../../../topics/git/cherry_picking.md).
-- Given an existing commit on one branch, apply the change to another branch
-- Useful for backporting bug fixes to previous release branches
-- Make the commit on the master branch and pick in to stable
-
-## Cherry Pick sample workflow
-
-1. Check out a new 'stable' branch from 'master'
-1. Change back to 'master'
-1. Edit '`cherry_pick.rb`' and commit the changes.
-1. Check commit log to get the commit SHA
-1. Check out the 'stable' branch
-1. Cherry pick the commit using the SHA obtained earlier
-
-```shell
-git checkout master
-git checkout -b stable
-git checkout master
-
-# Edit `cherry_pick.rb`
-git add cherry_pick.rb
-git commit -m 'Fix bugs in cherry_pick.rb'
-git log
-# Copy commit SHA
-git checkout stable
-
-git cherry-pick <commit SHA>
-```
+<!-- This redirect file can be deleted after <2021-06-01>. -->
+<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/#move-or-rename-a-page -->
diff --git a/doc/university/training/topics/tags.md b/doc/university/training/topics/tags.md
index bb2e3e9b208..28fd8400d99 100644
--- a/doc/university/training/topics/tags.md
+++ b/doc/university/training/topics/tags.md
@@ -4,5 +4,5 @@ redirect_to: '../../../topics/git/tags.md'
This document was moved to [another location](../../../topics/git/tags.md).
-<!-- This redirect file can be deleted after <YYYY-MM-DD>. -->
+<!-- This redirect file can be deleted after <2021-06-01>. -->
<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/#move-or-rename-a-page -->
diff --git a/doc/user/clusters/applications.md b/doc/user/clusters/applications.md
index 1d72426a1d4..ed75f318448 100644
--- a/doc/user/clusters/applications.md
+++ b/doc/user/clusters/applications.md
@@ -1469,7 +1469,7 @@ Kubernetes API, giving you access to more advanced querying capabilities. Log
data is deleted after 30 days, using [Curator](https://www.elastic.co/guide/en/elasticsearch/client/curator/5.5/about.html).
The Elastic Stack cluster application is intended as a log aggregation solution
-and is not related to our [Advanced Search](../search/advanced_global_search.md)
+and is not related to our [Advanced Search](../search/advanced_search.md)
functionality, which uses a separate Elasticsearch cluster.
To enable log shipping:
diff --git a/doc/user/index.md b/doc/user/index.md
index 47a9699543a..dfbba7e9c19 100644
--- a/doc/user/index.md
+++ b/doc/user/index.md
@@ -61,7 +61,7 @@ With GitLab Enterprise Edition, you can also:
- [Multiple Issue Boards](project/issue_board.md#multiple-issue-boards).
- Create formal relationships between issues with [Related Issues](project/issues/related_issues.md).
- Use [Burndown Charts](project/milestones/burndown_and_burnup_charts.md) to track progress during a sprint or while working on a new version of their software.
-- Leverage [Elasticsearch](../integration/elasticsearch.md) with [Advanced Search](search/advanced_global_search.md) and [Advanced Search Syntax](search/advanced_search_syntax.md) for faster, more advanced code search across your entire GitLab instance.
+- Leverage [Elasticsearch](../integration/elasticsearch.md) with [Advanced Search](search/advanced_search.md) for faster, more advanced code search across your entire GitLab instance.
- [Authenticate users with Kerberos](../integration/kerberos.md).
- [Mirror a repository](project/repository/repository_mirroring.md) from elsewhere on your local server.
- View your entire CI/CD pipeline involving more than one project with [Multiple-Project Pipelines](../ci/multi_project_pipelines.md).
diff --git a/doc/user/project/merge_requests/merge_request_approvals.md b/doc/user/project/merge_requests/merge_request_approvals.md
index a72ad8784e7..eab84aed077 100644
--- a/doc/user/project/merge_requests/merge_request_approvals.md
+++ b/doc/user/project/merge_requests/merge_request_approvals.md
@@ -79,7 +79,8 @@ An individual user can be added as an approver for a project if they are a membe
- The project's immediate parent group.
- A group that has access to the project via a [share](../members/share_project_with_groups.md).
-A group of users can also be added as approvers. In the future, group approvers may be
+A group of users can also be added as approvers, though they will only count as approvers if
+they have direct membership to the group. In the future, group approvers may be
[restricted to only groups with share access to the project](https://gitlab.com/gitlab-org/gitlab/-/issues/2048).
If a user is added as an individual approver and is also part of a group approver,
diff --git a/doc/user/search/advanced_global_search.md b/doc/user/search/advanced_global_search.md
index 2d1a05cd966..44af6f90cd9 100644
--- a/doc/user/search/advanced_global_search.md
+++ b/doc/user/search/advanced_global_search.md
@@ -1,70 +1,8 @@
---
-stage: Enablement
-group: Global Search
-info: "To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments"
-type: reference
+redirect_to: advanced_search.md
---
-# Advanced Search **(PREMIUM)**
+This document was moved to [another location](advanced_search.md).
-> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/109) in GitLab 8.4.
-> - [Moved](../../subscriptions/bronze_starter.md) to GitLab Premium in 13.9.
-
-NOTE:
-Advanced Search (powered by Elasticsearch) is enabled for Bronze and above on GitLab.com since 2020-07-10.
-
-Leverage Elasticsearch for faster, more advanced code search across your entire
-GitLab instance.
-
-This is the user documentation. To install and configure Elasticsearch,
-visit the [administrator documentation](../../integration/elasticsearch.md).
-
-## Overview
-
-The Advanced Search in GitLab is a powerful search service that saves
-you time. Instead of creating duplicate code and wasting time, you can
-now search for code within other projects that can help your own project.
-
-GitLab leverages the search capabilities of [Elasticsearch](https://www.elastic.co/elasticsearch/) and enables it when
-searching in:
-
-- Projects
-- Issues
-- Merge requests
-- Milestones
-- Comments
-- Code
-- Commits
-- Wiki
-- Users
-
-## Use cases
-
-The Advanced Search can be useful in various scenarios.
-
-### Faster searches
-
-Advanced Search is based on Elasticsearch, which is a purpose built full text search engine that can be horizontally scaled so that it can provide search results in 1-2 seconds in most cases.
-
-### Promote innersourcing
-
-Your company may consist of many different developer teams each of which has
-their own group where the various projects are hosted. Some of your applications
-may be connected to each other, so your developers need to instantly search
-throughout the GitLab instance and find the code they search for.
-
-## Searching globally
-
-Just use the search as before and GitLab will show you matching code from each
-project you have access to.
-
-![Advanced Search](img/advanced_global_search.png)
-
-You can also use the [Advanced Search Syntax](advanced_search_syntax.md) which
-provides some useful queries.
-
-NOTE:
-Elasticsearch has only data for the default branch. That means that if you go
-to the repository tree and switch the branch from the default to something else,
-then the "Code" tab in the search result page will be served by the basic
-search even if Elasticsearch is enabled.
+<!-- This redirect file can be deleted after <2021-02-12>. -->
+<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/#move-or-rename-a-page -->
diff --git a/doc/user/search/advanced_search.md b/doc/user/search/advanced_search.md
new file mode 100644
index 00000000000..d11f02addea
--- /dev/null
+++ b/doc/user/search/advanced_search.md
@@ -0,0 +1,115 @@
+---
+stage: Enablement
+group: Global Search
+info: "To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments"
+type: reference
+---
+
+# GitLab Advanced Search **(PREMIUM)**
+
+> - Moved to GitLab Premium in 13.9.
+
+NOTE:
+This is the user documentation. To configure the Advanced Search,
+visit the [administrator documentation](../../integration/elasticsearch.md).
+
+GitLab Advanced Search expands on the Basic Search with an additional set of
+features for faster, more advanced searches across the entire GitLab instance
+when searching in:
+
+- Projects
+- Issues
+- Merge requests
+- Milestones
+- Epics
+- Comments
+- Code
+- Commits
+- Wiki
+- Users
+
+The Advanced Search can be useful in various scenarios:
+
+- **Faster searches:**
+ Advanced Search is based on Elasticsearch, which is a purpose-built full
+ text search engine that can be horizontally scaled so that it can provide
+ search results in 1-2 seconds in most cases.
+- **Promote innersourcing:**
+ Your company may consist of many different developer teams each of which has
+ their own group where the various projects are hosted. Some of your applications
+ may be connected to each other, so your developers need to instantly search
+ throughout the GitLab instance and find the code they search for.
+
+## Use the Advanced Search syntax
+
+Elasticsearch has only data for the default branch. That means that if you go
+to the repository tree and switch the branch from the default to something else,
+then the "Code" tab in the search result page will be served by the basic
+search even if Elasticsearch is enabled.
+
+The Advanced Search syntax supports fuzzy or exact search queries with prefixes,
+boolean operators, and much more. Use the search as before and GitLab will show
+you matching code from each project you have access to.
+
+![Advanced Search](img/advanced_search_v13.10.png)
+
+Full details can be found in the [Elasticsearch documentation](https://www.elastic.co/guide/en/elasticsearch/reference/5.3/query-dsl-simple-query-string-query.html#_simple_query_string_syntax), but
+here's a quick guide:
+
+- Searches look for all the words in a query, in any order - e.g.: searching
+ issues for [`display bug`](https://gitlab.com/search?utf8=%E2%9C%93&snippets=&scope=issues&repository_ref=&search=display+bug&group_id=9970&project_id=278964) and [`bug display`](https://gitlab.com/search?utf8=%E2%9C%93&snippets=&scope=issues&repository_ref=&search=bug+Display&group_id=9970&project_id=278964) will return the same results.
+- To find the exact phrase (stemming still applies), use double quotes: [`"display bug"`](https://gitlab.com/search?utf8=%E2%9C%93&snippets=&scope=issues&repository_ref=&search=%22display+bug%22&group_id=9970&project_id=278964)
+- To find bugs not mentioning display, use `-`: [`bug -display`](https://gitlab.com/search?utf8=%E2%9C%93&snippets=&scope=issues&repository_ref=&search=bug+-display&group_id=9970&project_id=278964)
+- To find a bug in display or banner, use `|`: [`bug display | banner`](https://gitlab.com/search?utf8=%E2%9C%93&snippets=&scope=issues&repository_ref=&search=bug+display+%7C+banner&group_id=9970&project_id=278964)
+- To group terms together, use parentheses: [`bug | (display +banner)`](https://gitlab.com/search?utf8=%E2%9C%93&snippets=&scope=issues&repository_ref=&search=bug+%7C+%28display+%2Bbanner%29&group_id=9970&project_id=278964)
+- To match a partial word, use `*`. In this example, I want to find bugs with any 500 errors. : [`bug error 50*`](https://gitlab.com/search?utf8=%E2%9C%93&snippets=&scope=issues&repository_ref=&search=bug+error+50*&group_id=9970&project_id=278964)
+- To use one of symbols above literally, escape the symbol with a preceding `\`: [`argument \-last`](https://gitlab.com/search?utf8=%E2%9C%93&snippets=&scope=blobs&repository_ref=&search=argument+%5C-last&group_id=9970&project_id=278964)
+
+## Syntax search filters
+
+Advanced Search also supports the use of filters. The available filters are:
+
+- `filename`: Filters by filename. You can use the glob (`*`) operator for fuzzy matching.
+- `path`: Filters by path. You can use the glob (`*`) operator for fuzzy matching.
+- `extension`: Filters by extension in the filename. Please write the extension without a leading dot. Exact match only.
+- `blob`: Filters by Git `object ID`. Exact match only.
+
+To use them, add them to your keyword in the format `<filter_name>:<value>` without
+any spaces between the colon (`:`) and the value. When no keyword is provided, an asterisk (`*`) will be used as the keyword.
+
+Examples:
+
+- Finding a file with any content named `search_results.rb`: [`* filename:search_results.rb`](https://gitlab.com/search?utf8=%E2%9C%93&snippets=&scope=blobs&repository_ref=&search=*+filename%3Asearch_results.rb&group_id=9970&project_id=278964)
+- The leading asterisk (`*`) can be ignored in the case above: [`filename:search_results.rb`](https://gitlab.com/search?group_id=9970&project_id=278964&scope=blobs&search=filename%3Asearch_results.rb)
+- Finding a file named `found_blob_spec.rb` with the text `CHANGELOG` inside of it: [`CHANGELOG filename:found_blob_spec.rb`](https://gitlab.com/search?utf8=%E2%9C%93&snippets=&scope=blobs&repository_ref=&search=CHANGELOG+filename%3Afound_blob_spec.rb&group_id=9970&project_id=278964)
+- Finding the text `EpicLinks` inside files with the `.rb` extension: [`EpicLinks extension:rb`](https://gitlab.com/search?utf8=%E2%9C%93&snippets=&scope=blobs&repository_ref=&search=EpicLinks+extension%3Arb&group_id=9970&project_id=278964)
+- Finding any file with the `.yaml` extension: [`extension:yaml`](https://gitlab.com/search?utf8=%E2%9C%93&snippets=&scope=blobs&repository_ref=&search=extension%3Ayaml&group_id=9970&project_id=278964)
+- Finding the text `Sidekiq` in a file, when that file is in a path that includes `elastic`: [`Sidekiq path:elastic`](https://gitlab.com/search?utf8=%E2%9C%93&snippets=&scope=blobs&repository_ref=&search=Sidekiq+path%3Aelastic&group_id=9970&project_id=278964)
+- Finding any file in a path that includes `elasticsearch`: [`path:elasticsearch`](https://gitlab.com/search?utf8=%E2%9C%93&snippets=&scope=blobs&repository_ref=&search=path%3Aelasticsearch&group_id=9970&project_id=278964)
+- Finding the files represented by the Git object ID `998707b421c89bd9a3063333f9f728ef3e43d101`: [`* blob:998707b421c89bd9a3063333f9f728ef3e43d101`](https://gitlab.com/search?utf8=%E2%9C%93&snippets=false&scope=blobs&repository_ref=&search=*+blob%3A998707b421c89bd9a3063333f9f728ef3e43d101&group_id=9970)
+- Syntax filters can be combined for complex filtering. Finding any file starting with `search` containing `eventHub` and with the `.js` extension: [`eventHub filename:search* extension:js`](https://gitlab.com/search?utf8=%E2%9C%93&snippets=&scope=blobs&repository_ref=&search=eventHub+filename%3Asearch*+extension%3Ajs&group_id=9970&project_id=278964)
+
+### Excluding filters
+
+[Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/31684) in GitLab Starter 13.3.
+
+Filters can be inverted to **filter out** results from the result set, by prefixing the filter name with a `-` (hyphen) character, such as:
+
+- `-filename`
+- `-path`
+- `-extension`
+- `-blob`
+
+Examples:
+
+- Finding `rails` in all files but `Gemfile.lock`: [`rails -filename:Gemfile.lock`](https://gitlab.com/search?utf8=%E2%9C%93&snippets=&scope=blobs&repository_ref=&search=rails+-filename%3AGemfile.lock&group_id=9970&project_id=278964)
+- Finding `success` in all files excluding `.po|pot` files: [`success -filename:*.po*`](https://gitlab.com/search?utf8=%E2%9C%93&snippets=&scope=blobs&repository_ref=&search=success+-filename%3A*.po*&group_id=9970&project_id=278964)
+- Finding `import` excluding minified JavaScript (`.min.js`) files: [`import -extension:min.js`](https://gitlab.com/search?utf8=%E2%9C%93&snippets=&scope=blobs&repository_ref=&search=import+-extension%3Amin.js&group_id=9970&project_id=278964)
+- Finding `docs` for all files outside the `docs/` folder: [`docs -path:docs/`](https://gitlab.com/search?utf8=%E2%9C%93&snippets=&scope=blobs&repository_ref=&search=docs+-path%3Adocs%2F&group_id=9970&project_id=278964)
+
+## Search by issue or merge request ID
+
+You can search a specific issue or merge request by its ID with a special prefix.
+
+- To search by issue ID, use prefix `#` followed by issue ID. For example, [#23456](https://gitlab.com/search?utf8=%E2%9C%93&snippets=&scope=issues&repository_ref=&search=%2323456&group_id=9970&project_id=278964)
+- To search by merge request ID, use prefix `!` followed by merge request ID. For example [!23456](https://gitlab.com/search?utf8=%E2%9C%93&snippets=&scope=merge_requests&repository_ref=&search=%2123456&group_id=9970&project_id=278964)
diff --git a/doc/user/search/advanced_search_syntax.md b/doc/user/search/advanced_search_syntax.md
index 19f7305124e..44af6f90cd9 100644
--- a/doc/user/search/advanced_search_syntax.md
+++ b/doc/user/search/advanced_search_syntax.md
@@ -1,90 +1,8 @@
---
-stage: Enablement
-group: Global Search
-info: "To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments"
-type: reference
+redirect_to: advanced_search.md
---
-# Advanced Search Syntax **(PREMIUM)**
+This document was moved to [another location](advanced_search.md).
-> - Introduced in [GitLab](https://about.gitlab.com/pricing/) 9.2.
-> - [Moved](../../subscriptions/bronze_starter.md) to GitLab Premium in 13.9.
-
-Use advanced queries for more targeted search results.
-
-This is the user documentation. To install and configure Elasticsearch,
-visit the [administrator documentation](../../integration/elasticsearch.md).
-
-## Overview
-
-The Advanced Search Syntax is a subset of the
-[Advanced Search](advanced_global_search.md), which you can use if you
-want to have more specific search results.
-
-Advanced Search only supports searching the [default branch](../project/repository/branches/index.md#default-branch).
-
-## Using the Advanced Search Syntax
-
-The Advanced Search Syntax supports fuzzy or exact search queries with prefixes,
-boolean operators, and much more.
-
-Full details can be found in the [Elasticsearch documentation](https://www.elastic.co/guide/en/elasticsearch/reference/5.3/query-dsl-simple-query-string-query.html#_simple_query_string_syntax), but
-here's a quick guide:
-
-- Searches look for all the words in a query, in any order - e.g.: searching
- issues for [`display bug`](https://gitlab.com/search?utf8=%E2%9C%93&snippets=&scope=issues&repository_ref=&search=display+bug&group_id=9970&project_id=278964) and [`bug display`](https://gitlab.com/search?utf8=%E2%9C%93&snippets=&scope=issues&repository_ref=&search=bug+Display&group_id=9970&project_id=278964) will return the same results.
-- To find the exact phrase (stemming still applies), use double quotes: [`"display bug"`](https://gitlab.com/search?utf8=%E2%9C%93&snippets=&scope=issues&repository_ref=&search=%22display+bug%22&group_id=9970&project_id=278964)
-- To find bugs not mentioning display, use `-`: [`bug -display`](https://gitlab.com/search?utf8=%E2%9C%93&snippets=&scope=issues&repository_ref=&search=bug+-display&group_id=9970&project_id=278964)
-- To find a bug in display or banner, use `|`: [`bug display | banner`](https://gitlab.com/search?utf8=%E2%9C%93&snippets=&scope=issues&repository_ref=&search=bug+display+%7C+banner&group_id=9970&project_id=278964)
-- To group terms together, use parentheses: [`bug | (display +banner)`](https://gitlab.com/search?utf8=%E2%9C%93&snippets=&scope=issues&repository_ref=&search=bug+%7C+%28display+%2Bbanner%29&group_id=9970&project_id=278964)
-- To match a partial word, use `*`. In this example, I want to find bugs with any 500 errors. : [`bug error 50*`](https://gitlab.com/search?utf8=%E2%9C%93&snippets=&scope=issues&repository_ref=&search=bug+error+50*&group_id=9970&project_id=278964)
-- To use one of symbols above literally, escape the symbol with a preceding `\`: [`argument \-last`](https://gitlab.com/search?utf8=%E2%9C%93&snippets=&scope=blobs&repository_ref=&search=argument+%5C-last&group_id=9970&project_id=278964)
-
-### Syntax search filters
-
-The Advanced Search Syntax also supports the use of filters. The available filters are:
-
-- filename: Filters by filename. You can use the glob (`*`) operator for fuzzy matching.
-- path: Filters by path. You can use the glob (`*`) operator for fuzzy matching.
-- extension: Filters by extension in the filename. Please write the extension without a leading dot. Exact match only.
-- blob: Filters by Git `object ID`. Exact match only.
-
-To use them, add them to your keyword in the format `<filter_name>:<value>` without
-any spaces between the colon (`:`) and the value. When no keyword is provided, an asterisk (`*`) will be used as the keyword.
-
-Examples:
-
-- Finding a file with any content named `search_results.rb`: [`* filename:search_results.rb`](https://gitlab.com/search?utf8=%E2%9C%93&snippets=&scope=blobs&repository_ref=&search=*+filename%3Asearch_results.rb&group_id=9970&project_id=278964)
-- The leading asterisk (`*`) can be ignored in the case above: [`filename:search_results.rb`](https://gitlab.com/search?group_id=9970&project_id=278964&scope=blobs&search=filename%3Asearch_results.rb)
-- Finding a file named `found_blob_spec.rb` with the text `CHANGELOG` inside of it: [`CHANGELOG filename:found_blob_spec.rb`](https://gitlab.com/search?utf8=%E2%9C%93&snippets=&scope=blobs&repository_ref=&search=CHANGELOG+filename%3Afound_blob_spec.rb&group_id=9970&project_id=278964)
-- Finding the text `EpicLinks` inside files with the `.rb` extension: [`EpicLinks extension:rb`](https://gitlab.com/search?utf8=%E2%9C%93&snippets=&scope=blobs&repository_ref=&search=EpicLinks+extension%3Arb&group_id=9970&project_id=278964)
-- Finding any file with the `.yaml` extension: [`extension:yaml`](https://gitlab.com/search?utf8=%E2%9C%93&snippets=&scope=blobs&repository_ref=&search=extension%3Ayaml&group_id=9970&project_id=278964)
-- Finding the text `Sidekiq` in a file, when that file is in a path that includes `elastic`: [`Sidekiq path:elastic`](https://gitlab.com/search?utf8=%E2%9C%93&snippets=&scope=blobs&repository_ref=&search=Sidekiq+path%3Aelastic&group_id=9970&project_id=278964)
-- Finding any file in a path that includes `elasticsearch`: [`path:elasticsearch`](https://gitlab.com/search?utf8=%E2%9C%93&snippets=&scope=blobs&repository_ref=&search=path%3Aelasticsearch&group_id=9970&project_id=278964)
-- Finding the files represented by the Git object ID `998707b421c89bd9a3063333f9f728ef3e43d101`: [`* blob:998707b421c89bd9a3063333f9f728ef3e43d101`](https://gitlab.com/search?utf8=%E2%9C%93&snippets=false&scope=blobs&repository_ref=&search=*+blob%3A998707b421c89bd9a3063333f9f728ef3e43d101&group_id=9970)
-- Syntax filters can be combined for complex filtering. Finding any file starting with `search` containing `eventHub` and with the `.js` extension: [`eventHub filename:search* extension:js`](https://gitlab.com/search?utf8=%E2%9C%93&snippets=&scope=blobs&repository_ref=&search=eventHub+filename%3Asearch*+extension%3Ajs&group_id=9970&project_id=278964)
-
-#### Excluding filters
-
-[Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/31684) in GitLab Starter 13.3.
-
-Filters can be inverted to **filter out** results from the result set, by prefixing the filter name with a `-` (hyphen) character, such as:
-
-- `-filename`
-- `-path`
-- `-extension`
-- `-blob`
-
-Examples:
-
-- Finding `rails` in all files but `Gemfile.lock`: [`rails -filename:Gemfile.lock`](https://gitlab.com/search?utf8=%E2%9C%93&snippets=&scope=blobs&repository_ref=&search=rails+-filename%3AGemfile.lock&group_id=9970&project_id=278964)
-- Finding `success` in all files excluding `.po|pot` files: [`success -filename:*.po*`](https://gitlab.com/search?utf8=%E2%9C%93&snippets=&scope=blobs&repository_ref=&search=success+-filename%3A*.po*&group_id=9970&project_id=278964)
-- Finding `import` excluding minified JavaScript (`.min.js`) files: [`import -extension:min.js`](https://gitlab.com/search?utf8=%E2%9C%93&snippets=&scope=blobs&repository_ref=&search=import+-extension%3Amin.js&group_id=9970&project_id=278964)
-- Finding `docs` for all files outside the `docs/` folder: [`docs -path:docs/`](https://gitlab.com/search?utf8=%E2%9C%93&snippets=&scope=blobs&repository_ref=&search=docs+-path%3Adocs%2F&group_id=9970&project_id=278964)
-
-### Search by issue or merge request ID
-
-You can search a specific issue or merge request by its ID with a special prefix.
-
-- To search by issue ID, use prefix `#` followed by issue ID. For example, [#23456](https://gitlab.com/search?utf8=%E2%9C%93&snippets=&scope=issues&repository_ref=&search=%2323456&group_id=9970&project_id=278964)
-- To search by merge request ID, use prefix `!` followed by merge request ID. For example [!23456](https://gitlab.com/search?utf8=%E2%9C%93&snippets=&scope=merge_requests&repository_ref=&search=%2123456&group_id=9970&project_id=278964)
+<!-- This redirect file can be deleted after <2021-02-12>. -->
+<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/#move-or-rename-a-page -->
diff --git a/doc/user/search/img/advanced_global_search.png b/doc/user/search/img/advanced_global_search.png
deleted file mode 100644
index 4903bbb07e1..00000000000
--- a/doc/user/search/img/advanced_global_search.png
+++ /dev/null
Binary files differ
diff --git a/doc/user/search/img/advanced_search_v13.10.png b/doc/user/search/img/advanced_search_v13.10.png
new file mode 100644
index 00000000000..39cd54fea75
--- /dev/null
+++ b/doc/user/search/img/advanced_search_v13.10.png
Binary files differ
diff --git a/doc/user/search/index.md b/doc/user/search/index.md
index 79a7827c03b..f327288ea0a 100644
--- a/doc/user/search/index.md
+++ b/doc/user/search/index.md
@@ -298,13 +298,7 @@ redirected to the commit result and given the option to return to the search res
Leverage Elasticsearch for faster, more advanced code search across your entire
GitLab instance.
-[Learn how to use the Advanced Search.](advanced_global_search.md)
-
-## Advanced Search Syntax **(PREMIUM)**
-
-Use advanced queries for more targeted search results.
-
-[Learn how to use the Advanced Search Syntax.](advanced_search_syntax.md)
+[Learn how to use the Advanced Search.](advanced_search.md)
## Search settings
diff --git a/lib/api/boards.rb b/lib/api/boards.rb
index 5fd4ca3546c..79f4b02f26a 100644
--- a/lib/api/boards.rb
+++ b/lib/api/boards.rb
@@ -30,7 +30,7 @@ module API
use :pagination
end
get '/' do
- authorize!(:read_board, user_project)
+ authorize!(:read_issue_board, user_project)
present paginate(board_parent.boards.with_associations), with: Entities::Board
end
@@ -39,7 +39,7 @@ module API
success Entities::Board
end
get '/:board_id' do
- authorize!(:read_board, user_project)
+ authorize!(:read_issue_board, user_project)
present board, with: Entities::Board
end
@@ -51,7 +51,7 @@ module API
requires :name, type: String, desc: 'The board name'
end
post '/' do
- authorize!(:admin_board, board_parent)
+ authorize!(:admin_issue_board, board_parent)
create_board
end
@@ -64,7 +64,7 @@ module API
use :update_params
end
put '/:board_id' do
- authorize!(:admin_board, board_parent)
+ authorize!(:admin_issue_board, board_parent)
update_board
end
@@ -75,7 +75,7 @@ module API
end
delete '/:board_id' do
- authorize!(:admin_board, board_parent)
+ authorize!(:admin_issue_board, board_parent)
delete_board
end
@@ -93,7 +93,7 @@ module API
use :pagination
end
get '/lists' do
- authorize!(:read_board, user_project)
+ authorize!(:read_issue_board, user_project)
present paginate(board_lists), with: Entities::List
end
@@ -105,7 +105,7 @@ module API
requires :list_id, type: Integer, desc: 'The ID of a list'
end
get '/lists/:list_id' do
- authorize!(:read_board, user_project)
+ authorize!(:read_issue_board, user_project)
present board_lists.find(params[:list_id]), with: Entities::List
end
@@ -117,7 +117,7 @@ module API
use :list_creation_params
end
post '/lists' do
- authorize!(:admin_list, user_project)
+ authorize!(:admin_issue_board_list, user_project)
create_list
end
@@ -133,7 +133,7 @@ module API
put '/lists/:list_id' do
list = board_lists.find(params[:list_id])
- authorize!(:admin_list, user_project)
+ authorize!(:admin_issue_board_list, user_project)
move_list(list)
end
@@ -146,7 +146,7 @@ module API
requires :list_id, type: Integer, desc: 'The ID of a board list'
end
delete "/lists/:list_id" do
- authorize!(:admin_list, user_project)
+ authorize!(:admin_issue_board_list, user_project)
list = board_lists.find(params[:list_id])
destroy_list(list)
diff --git a/lib/api/group_boards.rb b/lib/api/group_boards.rb
index 7425e1bd145..90632048354 100644
--- a/lib/api/group_boards.rb
+++ b/lib/api/group_boards.rb
@@ -30,7 +30,7 @@ module API
use :pagination
end
get '/' do
- authorize!(:read_board, user_group)
+ authorize!(:read_issue_board, user_group)
present paginate(board_parent.boards.with_associations), with: Entities::Board
end
@@ -39,7 +39,7 @@ module API
success Entities::Board
end
get '/:board_id' do
- authorize!(:read_board, user_group)
+ authorize!(:read_issue_board, user_group)
present board, with: Entities::Board
end
@@ -51,7 +51,7 @@ module API
use :update_params
end
put '/:board_id' do
- authorize!(:admin_board, board_parent)
+ authorize!(:admin_issue_board, board_parent)
update_board
end
@@ -69,7 +69,7 @@ module API
use :pagination
end
get '/lists' do
- authorize!(:read_board, user_group)
+ authorize!(:read_issue_board, user_group)
present paginate(board_lists), with: Entities::List
end
@@ -81,7 +81,7 @@ module API
requires :list_id, type: Integer, desc: 'The ID of a list'
end
get '/lists/:list_id' do
- authorize!(:read_board, user_group)
+ authorize!(:read_issue_board, user_group)
present board_lists.find(params[:list_id]), with: Entities::List
end
@@ -93,7 +93,7 @@ module API
use :list_creation_params
end
post '/lists' do
- authorize!(:admin_list, user_group)
+ authorize!(:admin_issue_board_list, user_group)
create_list
end
@@ -109,7 +109,7 @@ module API
put '/lists/:list_id' do
list = board_lists.find(params[:list_id])
- authorize!(:admin_list, user_group)
+ authorize!(:admin_issue_board_list, user_group)
move_list(list)
end
@@ -122,7 +122,7 @@ module API
requires :list_id, type: Integer, desc: 'The ID of a board list'
end
delete "/lists/:list_id" do
- authorize!(:admin_list, user_group)
+ authorize!(:admin_issue_board_list, user_group)
list = board_lists.find(params[:list_id])
destroy_list(list)
diff --git a/spec/controllers/groups/boards_controller_spec.rb b/spec/controllers/groups/boards_controller_spec.rb
index a7480130e0a..6201cddecb0 100644
--- a/spec/controllers/groups/boards_controller_spec.rb
+++ b/spec/controllers/groups/boards_controller_spec.rb
@@ -29,7 +29,7 @@ RSpec.describe Groups::BoardsController do
expect(Ability).to receive(:allowed?).with(user, :log_in, :global).and_call_original
allow(Ability).to receive(:allowed?).with(user, :read_cross_project, :global).and_return(true)
allow(Ability).to receive(:allowed?).with(user, :read_group, group).and_return(true)
- allow(Ability).to receive(:allowed?).with(user, :read_board, group).and_return(false)
+ allow(Ability).to receive(:allowed?).with(user, :read_issue_board, group).and_return(false)
end
it 'returns a not found 404 response' do
@@ -74,7 +74,7 @@ RSpec.describe Groups::BoardsController do
expect(Ability).to receive(:allowed?).with(user, :log_in, :global).and_call_original
allow(Ability).to receive(:allowed?).with(user, :read_cross_project, :global).and_return(true)
allow(Ability).to receive(:allowed?).with(user, :read_group, group).and_return(true)
- allow(Ability).to receive(:allowed?).with(user, :read_board, group).and_return(false)
+ allow(Ability).to receive(:allowed?).with(user, :read_issue_board, group).and_return(false)
end
it 'returns a not found 404 response' do
@@ -111,7 +111,7 @@ RSpec.describe Groups::BoardsController do
expect(Ability).to receive(:allowed?).with(user, :log_in, :global).and_call_original
allow(Ability).to receive(:allowed?).with(user, :read_cross_project, :global).and_return(true)
allow(Ability).to receive(:allowed?).with(user, :read_group, group).and_return(true)
- allow(Ability).to receive(:allowed?).with(user, :read_board, group).and_return(false)
+ allow(Ability).to receive(:allowed?).with(user, :read_issue_board, group).and_return(false)
end
it 'returns a not found 404 response' do
diff --git a/spec/controllers/projects/boards_controller_spec.rb b/spec/controllers/projects/boards_controller_spec.rb
index 1ed61e0990f..cde3a8d4761 100644
--- a/spec/controllers/projects/boards_controller_spec.rb
+++ b/spec/controllers/projects/boards_controller_spec.rb
@@ -34,7 +34,7 @@ RSpec.describe Projects::BoardsController do
before do
expect(Ability).to receive(:allowed?).with(user, :log_in, :global).and_call_original
allow(Ability).to receive(:allowed?).with(user, :read_project, project).and_return(true)
- allow(Ability).to receive(:allowed?).with(user, :read_board, project).and_return(false)
+ allow(Ability).to receive(:allowed?).with(user, :read_issue_board, project).and_return(false)
end
it 'returns a not found 404 response' do
@@ -78,7 +78,7 @@ RSpec.describe Projects::BoardsController do
before do
expect(Ability).to receive(:allowed?).with(user, :log_in, :global).and_call_original
allow(Ability).to receive(:allowed?).with(user, :read_project, project).and_return(true)
- allow(Ability).to receive(:allowed?).with(user, :read_board, project).and_return(false)
+ allow(Ability).to receive(:allowed?).with(user, :read_issue_board, project).and_return(false)
end
it 'returns a not found 404 response' do
@@ -134,7 +134,7 @@ RSpec.describe Projects::BoardsController do
before do
expect(Ability).to receive(:allowed?).with(user, :log_in, :global).and_call_original
allow(Ability).to receive(:allowed?).with(user, :read_project, project).and_return(true)
- allow(Ability).to receive(:allowed?).with(user, :read_board, project).and_return(false)
+ allow(Ability).to receive(:allowed?).with(user, :read_issue_board, project).and_return(false)
end
it 'returns a not found 404 response' do
@@ -172,7 +172,7 @@ RSpec.describe Projects::BoardsController do
before do
expect(Ability).to receive(:allowed?).with(user, :log_in, :global).and_call_original
allow(Ability).to receive(:allowed?).with(user, :read_project, project).and_return(true)
- allow(Ability).to receive(:allowed?).with(user, :read_board, project).and_return(false)
+ allow(Ability).to receive(:allowed?).with(user, :read_issue_board, project).and_return(false)
end
it 'returns a not found 404 response' do
diff --git a/spec/graphql/mutations/boards/update_spec.rb b/spec/graphql/mutations/boards/update_spec.rb
index 6f05b21b0b4..da3dfeecd4d 100644
--- a/spec/graphql/mutations/boards/update_spec.rb
+++ b/spec/graphql/mutations/boards/update_spec.rb
@@ -20,7 +20,7 @@ RSpec.describe Mutations::Boards::Update do
subject { mutation.resolve(**mutation_params) }
- specify { expect(described_class).to require_graphql_authorizations(:admin_board) }
+ specify { expect(described_class).to require_graphql_authorizations(:admin_issue_board) }
describe '#resolve' do
context 'when the user cannot admin the board' do
diff --git a/spec/graphql/types/access_level_enum_spec.rb b/spec/graphql/types/access_level_enum_spec.rb
index eeb10a50b7e..1b379c56ff9 100644
--- a/spec/graphql/types/access_level_enum_spec.rb
+++ b/spec/graphql/types/access_level_enum_spec.rb
@@ -6,6 +6,6 @@ RSpec.describe GitlabSchema.types['AccessLevelEnum'] do
specify { expect(described_class.graphql_name).to eq('AccessLevelEnum') }
it 'exposes all the existing access levels' do
- expect(described_class.values.keys).to match_array(%w[NO_ACCESS GUEST REPORTER DEVELOPER MAINTAINER OWNER])
+ expect(described_class.values.keys).to match_array(%w[NO_ACCESS MINIMAL_ACCESS GUEST REPORTER DEVELOPER MAINTAINER OWNER])
end
end
diff --git a/spec/graphql/types/board_type_spec.rb b/spec/graphql/types/board_type_spec.rb
index 5ea87d5f473..dca3cfd8aaf 100644
--- a/spec/graphql/types/board_type_spec.rb
+++ b/spec/graphql/types/board_type_spec.rb
@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe GitlabSchema.types['Board'] do
specify { expect(described_class.graphql_name).to eq('Board') }
- specify { expect(described_class).to require_graphql_authorizations(:read_board) }
+ specify { expect(described_class).to require_graphql_authorizations(:read_issue_board) }
it 'has specific fields' do
expected_fields = %w[id name web_url web_path]
diff --git a/spec/models/ci/runner_spec.rb b/spec/models/ci/runner_spec.rb
index f9bf6d2967a..4c8212bf774 100644
--- a/spec/models/ci/runner_spec.rb
+++ b/spec/models/ci/runner_spec.rb
@@ -842,27 +842,50 @@ RSpec.describe Ci::Runner do
end
describe '#pick_build!' do
+ let(:build) { create(:ci_build) }
+ let(:runner) { create(:ci_runner) }
+
context 'runner can pick the build' do
it 'calls #tick_runner_queue' do
- ci_build = build(:ci_build)
- runner = build(:ci_runner)
- allow(runner).to receive(:can_pick?).with(ci_build).and_return(true)
-
expect(runner).to receive(:tick_runner_queue)
- runner.pick_build!(ci_build)
+ runner.pick_build!(build)
end
end
context 'runner cannot pick the build' do
- it 'does not call #tick_runner_queue' do
- ci_build = build(:ci_build)
- runner = build(:ci_runner)
- allow(runner).to receive(:can_pick?).with(ci_build).and_return(false)
+ before do
+ build.tag_list = [:docker]
+ end
+ it 'does not call #tick_runner_queue' do
expect(runner).not_to receive(:tick_runner_queue)
- runner.pick_build!(ci_build)
+ runner.pick_build!(build)
+ end
+ end
+
+ context 'build picking improvement enabled' do
+ before do
+ stub_feature_flags(ci_reduce_queries_when_ticking_runner_queue: true)
+ end
+
+ it 'does not check if the build is assignable to a runner' do
+ expect(runner).not_to receive(:can_pick?)
+
+ runner.pick_build!(build)
+ end
+ end
+
+ context 'build picking improvement disabled' do
+ before do
+ stub_feature_flags(ci_reduce_queries_when_ticking_runner_queue: false)
+ end
+
+ it 'checks if the build is assignable to a runner' do
+ expect(runner).to receive(:can_pick?).and_call_original
+
+ runner.pick_build!(build)
end
end
end
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index f0981469123..d2693a32bdf 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -1834,7 +1834,7 @@ RSpec.describe User do
end
describe '.instance_access_request_approvers_to_be_notified' do
- let_it_be(:admin_list) { create_list(:user, 12, :admin, :with_sign_ins) }
+ let_it_be(:admin_issue_board_list) { create_list(:user, 12, :admin, :with_sign_ins) }
it 'returns up to the ten most recently active instance admins' do
active_admins_in_recent_sign_in_desc_order = User.admins.active.order_recent_sign_in.limit(10)
diff --git a/spec/policies/project_policy_spec.rb b/spec/policies/project_policy_spec.rb
index b07940760dd..60c54f97312 100644
--- a/spec/policies/project_policy_spec.rb
+++ b/spec/policies/project_policy_spec.rb
@@ -64,8 +64,8 @@ RSpec.describe ProjectPolicy do
end
it 'disables boards and lists permissions' do
- expect_disallowed :read_board, :create_board, :update_board
- expect_disallowed :read_list, :create_list, :update_list, :admin_list
+ expect_disallowed :read_issue_board, :create_board, :update_board
+ expect_disallowed :read_issue_board_list, :create_list, :update_list, :admin_issue_board_list
end
context 'when external tracker configured' do
diff --git a/spec/services/ci/update_build_queue_service_spec.rb b/spec/services/ci/update_build_queue_service_spec.rb
index ebccfdc5140..6cac49febda 100644
--- a/spec/services/ci/update_build_queue_service_spec.rb
+++ b/spec/services/ci/update_build_queue_service_spec.rb
@@ -26,6 +26,24 @@ RSpec.describe Ci::UpdateBuildQueueService do
end
it_behaves_like 'refreshes runner'
+
+ it 'avoids running redundant queries' do
+ expect(Ci::Runner).not_to receive(:owned_or_instance_wide)
+
+ subject.execute(build)
+ end
+
+ context 'when feature flag ci_reduce_queries_when_ticking_runner_queue is disabled' do
+ before do
+ stub_feature_flags(ci_reduce_queries_when_ticking_runner_queue: false)
+ end
+
+ it 'runs redundant queries using `owned_or_instance_wide` scope' do
+ expect(Ci::Runner).to receive(:owned_or_instance_wide).and_call_original
+
+ subject.execute(build)
+ end
+ end
end
end
@@ -97,4 +115,43 @@ RSpec.describe Ci::UpdateBuildQueueService do
it_behaves_like 'does not refresh runner'
end
end
+
+ context 'avoids N+1 queries', :request_store do
+ let!(:build) { create(:ci_build, pipeline: pipeline, tag_list: %w[a b]) }
+ let!(:project_runner) { create(:ci_runner, :project, :online, projects: [project], tag_list: %w[a b c]) }
+
+ context 'when ci_preload_runner_tags and ci_reduce_queries_when_ticking_runner_queue are enabled' do
+ before do
+ stub_feature_flags(
+ ci_reduce_queries_when_ticking_runner_queue: true,
+ ci_preload_runner_tags: true
+ )
+ end
+
+ it 'does execute the same amount of queries regardless of number of runners' do
+ control_count = ActiveRecord::QueryRecorder.new { subject.execute(build) }.count
+
+ create_list(:ci_runner, 10, :project, :online, projects: [project], tag_list: %w[b c d])
+
+ expect { subject.execute(build) }.not_to exceed_all_query_limit(control_count)
+ end
+ end
+
+ context 'when ci_preload_runner_tags and ci_reduce_queries_when_ticking_runner_queue are disabled' do
+ before do
+ stub_feature_flags(
+ ci_reduce_queries_when_ticking_runner_queue: false,
+ ci_preload_runner_tags: false
+ )
+ end
+
+ it 'does execute more queries for more runners' do
+ control_count = ActiveRecord::QueryRecorder.new { subject.execute(build) }.count
+
+ create_list(:ci_runner, 10, :project, :online, projects: [project], tag_list: %w[b c d])
+
+ expect { subject.execute(build) }.to exceed_all_query_limit(control_count)
+ end
+ end
+ end
end
diff --git a/spec/services/merge_requests/update_service_spec.rb b/spec/services/merge_requests/update_service_spec.rb
index edb95840604..a6bd8416e58 100644
--- a/spec/services/merge_requests/update_service_spec.rb
+++ b/spec/services/merge_requests/update_service_spec.rb
@@ -656,6 +656,48 @@ RSpec.describe MergeRequests::UpdateService, :mailer do
end
end
+ context 'when the draft status is changed' do
+ let!(:non_subscriber) { create(:user) }
+ let!(:subscriber) do
+ create(:user) { |u| merge_request.toggle_subscription(u, project) }
+ end
+
+ before do
+ project.add_developer(non_subscriber)
+ project.add_developer(subscriber)
+ end
+
+ context 'removing draft status' do
+ before do
+ merge_request.update_attribute(:title, 'Draft: New Title')
+ end
+
+ it 'sends notifications for subscribers', :sidekiq_might_not_need_inline do
+ opts = { title: 'New title' }
+
+ perform_enqueued_jobs do
+ @merge_request = described_class.new(project, user, opts).execute(merge_request)
+ end
+
+ should_email(subscriber)
+ should_not_email(non_subscriber)
+ end
+ end
+
+ context 'adding draft status' do
+ it 'does not send notifications', :sidekiq_might_not_need_inline do
+ opts = { title: 'Draft: New title' }
+
+ perform_enqueued_jobs do
+ @merge_request = described_class.new(project, user, opts).execute(merge_request)
+ end
+
+ should_not_email(subscriber)
+ should_not_email(non_subscriber)
+ end
+ end
+ end
+
context 'when the merge request is relabeled' do
let!(:non_subscriber) { create(:user) }
let!(:subscriber) { create(:user) { |u| label.toggle_subscription(u, project) } }
diff --git a/spec/services/notification_service_spec.rb b/spec/services/notification_service_spec.rb
index 76b06581ff7..36946b59eae 100644
--- a/spec/services/notification_service_spec.rb
+++ b/spec/services/notification_service_spec.rb
@@ -1868,6 +1868,42 @@ RSpec.describe NotificationService, :mailer do
end
end
+ describe '#change_in_merge_request_draft_status' do
+ let(:merge_request) { create(:merge_request, author: author, source_project: project) }
+
+ let_it_be(:current_user) { create(:user) }
+
+ it 'sends emails to relevant users only', :aggregate_failures do
+ notification.change_in_merge_request_draft_status(merge_request, current_user)
+
+ merge_request.reviewers.each { |reviewer| should_email(reviewer) }
+ merge_request.assignees.each { |assignee| should_email(assignee) }
+ should_email(merge_request.author)
+ should_email(@u_watcher)
+ should_email(@subscriber)
+ should_email(@watcher_and_subscriber)
+ should_email(@u_guest_watcher)
+ should_not_email(@u_participant_mentioned)
+ should_not_email(@u_guest_custom)
+ should_not_email(@u_custom_global)
+ should_not_email(@unsubscriber)
+ should_not_email(@u_participating)
+ should_not_email(@u_disabled)
+ should_not_email(@u_lazy_participant)
+ end
+
+ it_behaves_like 'participating notifications' do
+ let(:participant) { create(:user, username: 'user-participant') }
+ let(:issuable) { merge_request }
+ let(:notification_trigger) { notification.change_in_merge_request_draft_status(merge_request, @u_disabled) }
+ end
+
+ it_behaves_like 'project emails are disabled' do
+ let(:notification_target) { merge_request }
+ let(:notification_trigger) { notification.change_in_merge_request_draft_status(merge_request, @u_disabled) }
+ end
+ end
+
describe '#push_to_merge_request' do
before do
update_custom_notification(:push_to_merge_request, @u_guest_custom, resource: project)
diff --git a/spec/support/shared_contexts/policies/group_policy_shared_context.rb b/spec/support/shared_contexts/policies/group_policy_shared_context.rb
index e7bc1450601..b0d7274269b 100644
--- a/spec/support/shared_contexts/policies/group_policy_shared_context.rb
+++ b/spec/support/shared_contexts/policies/group_policy_shared_context.rb
@@ -18,12 +18,12 @@ RSpec.shared_context 'GroupPolicy context' do
]
end
- let(:read_group_permissions) { %i[read_label read_list read_milestone read_board] }
+ let(:read_group_permissions) { %i[read_label read_issue_board_list read_milestone read_issue_board] }
let(:reporter_permissions) do
%i[
admin_label
- admin_board
+ admin_issue_board
read_container_image
read_metrics_dashboard_annotation
read_prometheus
diff --git a/spec/support/shared_contexts/policies/project_policy_shared_context.rb b/spec/support/shared_contexts/policies/project_policy_shared_context.rb
index 3016494ac8d..266c8d5ee84 100644
--- a/spec/support/shared_contexts/policies/project_policy_shared_context.rb
+++ b/spec/support/shared_contexts/policies/project_policy_shared_context.rb
@@ -16,8 +16,8 @@ RSpec.shared_context 'ProjectPolicy context' do
let(:base_guest_permissions) do
%i[
award_emoji create_issue create_merge_request_in create_note
- create_project read_board read_issue read_issue_iid read_issue_link
- read_label read_list read_milestone read_note read_project
+ create_project read_issue_board read_issue read_issue_iid read_issue_link
+ read_label read_issue_board_list read_milestone read_note read_project
read_project_for_iids read_project_member read_release read_snippet
read_wiki upload_file
]
@@ -25,7 +25,7 @@ RSpec.shared_context 'ProjectPolicy context' do
let(:base_reporter_permissions) do
%i[
- admin_issue admin_issue_link admin_label admin_list create_snippet
+ admin_issue admin_issue_link admin_label admin_issue_board_list create_snippet
download_code download_wiki_code fork_project metrics_dashboard
read_build read_commit_status read_confidential_issues
read_container_image read_deployment read_environment read_merge_request
diff --git a/spec/support/shared_examples/requests/api/graphql/group_and_project_boards_query_shared_examples.rb b/spec/support/shared_examples/requests/api/graphql/group_and_project_boards_query_shared_examples.rb
index 54f4ba7ff73..274516cd87b 100644
--- a/spec/support/shared_examples/requests/api/graphql/group_and_project_boards_query_shared_examples.rb
+++ b/spec/support/shared_examples/requests/api/graphql/group_and_project_boards_query_shared_examples.rb
@@ -25,7 +25,7 @@ RSpec.shared_examples 'group and project boards query' do
board = create(:board, resource_parent: board_parent, name: 'A')
allow(Ability).to receive(:allowed?).and_call_original
- allow(Ability).to receive(:allowed?).with(user, :read_board, board).and_return(false)
+ allow(Ability).to receive(:allowed?).with(user, :read_issue_board, board).and_return(false)
post_graphql(query, current_user: current_user)