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-05-07 03:10:27 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-05-07 03:10:27 +0300
commitfd6093f6f04702cecf75306a83beba837cfde8fb (patch)
treed650796ad469f0ceef7de2b4a0da5a4fb6a8b618
parent454973238cb3eed58f7d901b87ceb29acf6febbd (diff)
Add latest changes from gitlab-org/gitlab@master
-rw-r--r--Gemfile4
-rw-r--r--Gemfile.lock13
-rw-r--r--app/assets/javascripts/boards/stores/getters.js2
-rw-r--r--app/assets/javascripts/diffs/components/diff_file.vue8
-rw-r--r--app/assets/javascripts/diffs/components/diff_file_header.vue13
-rw-r--r--app/assets/javascripts/reports/codequality_report/components/codequality_issue_body.vue5
-rw-r--r--app/models/issue/metrics.rb6
-rw-r--r--app/services/spam/spam_action_service.rb3
-rw-r--r--app/services/spam/spam_constants.rb4
-rw-r--r--app/services/system_notes/issuables_service.rb7
-rw-r--r--app/workers/build_hooks_worker.rb10
-rw-r--r--changelogs/unreleased/4794-add-eager-loading-to-issue-metrics.yml5
-rw-r--r--changelogs/unreleased/remove_feature_flag_upgrade_link_in_user_menu_a.yml5
-rw-r--r--config/feature_flags/development/delayed_perform_for_build_hooks_worker.yml (renamed from config/feature_flags/development/upgrade_link_in_user_menu_a.yml)12
-rw-r--r--doc/development/usage_ping/dictionary.md24
-rw-r--r--doc/user/application_security/configuration/index.md2
-rw-r--r--doc/user/project/merge_requests/approvals/settings.md4
-rw-r--r--doc/user/project/merge_requests/cherry_pick_changes.md4
-rw-r--r--doc/user/project/merge_requests/code_quality.md4
-rw-r--r--doc/user/project/merge_requests/creating_merge_requests.md44
-rw-r--r--doc/user/project/merge_requests/csv_export.md6
-rw-r--r--doc/user/project/merge_requests/drafts.md2
-rw-r--r--doc/user/project/merge_requests/fail_fast_testing.md2
-rw-r--r--doc/user/project/merge_requests/getting_started.md12
-rw-r--r--doc/user/project/merge_requests/merge_request_dependencies.md4
-rw-r--r--doc/user/project/merge_requests/reviews/index.md22
-rw-r--r--doc/user/project/merge_requests/test_coverage_visualization.md4
-rw-r--r--doc/user/project/merge_requests/versions.md4
-rw-r--r--lib/gitlab/spamcheck/client.rb11
-rw-r--r--lib/gitlab/usage_data_counters/known_events/epic_events.yml6
-rw-r--r--locale/gitlab.pot12
-rw-r--r--spec/frontend/boards/stores/getters_spec.js9
-rw-r--r--spec/lib/gitlab/spamcheck/client_spec.rb12
-rw-r--r--spec/models/issue/metrics_spec.rb15
-rw-r--r--spec/services/spam/spam_action_service_spec.rb16
-rw-r--r--spec/support/shared_contexts/spam_constants.rb1
-rw-r--r--spec/workers/build_hooks_worker_spec.rb18
37 files changed, 245 insertions, 90 deletions
diff --git a/Gemfile b/Gemfile
index 3504041ec6c..1e7a6bf8306 100644
--- a/Gemfile
+++ b/Gemfile
@@ -478,7 +478,7 @@ group :ed25519 do
end
# Spamcheck GRPC protocol definitions
-gem 'spamcheck', '~> 0.0.5'
+gem 'spamcheck', '~> 0.1.0'
# Gitaly GRPC protocol definitions
gem 'gitaly', '~> 13.12.0.pre.rc1'
@@ -494,7 +494,7 @@ gem 'flipper', '~> 0.17.1'
gem 'flipper-active_record', '~> 0.17.1'
gem 'flipper-active_support_cache_store', '~> 0.17.1'
gem 'unleash', '~> 0.1.5'
-gem 'gitlab-experiment', '~> 0.5.3'
+gem 'gitlab-experiment', '~> 0.5.4'
# Structured logging
gem 'lograge', '~> 0.5'
diff --git a/Gemfile.lock b/Gemfile.lock
index 643cb7046c9..70d4e89976a 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -449,8 +449,9 @@ GEM
numerizer (~> 0.2)
gitlab-dangerfiles (2.0.0)
danger-gitlab
- gitlab-experiment (0.5.3)
+ gitlab-experiment (0.5.4)
activesupport (>= 3.0)
+ request_store (>= 1.0)
scientist (~> 1.6, >= 1.6.0)
gitlab-fog-azure-rm (1.0.1)
azure-storage-blob (~> 2.0)
@@ -519,8 +520,8 @@ GEM
google-cloud-env (1.4.0)
faraday (>= 0.17.3, < 2.0)
google-protobuf (3.14.0)
- googleapis-common-protos-types (1.0.5)
- google-protobuf (~> 3.11)
+ googleapis-common-protos-types (1.0.6)
+ google-protobuf (~> 3.14)
googleauth (0.14.0)
faraday (>= 0.17.3, < 2.0)
jwt (>= 1.4, < 3.0)
@@ -1211,7 +1212,7 @@ GEM
thor (~> 1.0)
tilt (~> 2.0)
yard (~> 0.9, >= 0.9.24)
- spamcheck (0.0.5)
+ spamcheck (0.1.0)
grpc (~> 1.0)
spring (2.1.1)
spring-commands-rspec (1.0.4)
@@ -1450,7 +1451,7 @@ DEPENDENCIES
github-markup (~> 1.7.0)
gitlab-chronic (~> 0.10.5)
gitlab-dangerfiles (~> 2.0.0)
- gitlab-experiment (~> 0.5.3)
+ gitlab-experiment (~> 0.5.4)
gitlab-fog-azure-rm (~> 1.0.1)
gitlab-fog-google (~> 1.13)
gitlab-labkit (~> 0.16.2)
@@ -1608,7 +1609,7 @@ DEPENDENCIES
slack-messenger (~> 2.3.4)
snowplow-tracker (~> 0.6.1)
solargraph (~> 0.40.4)
- spamcheck (~> 0.0.5)
+ spamcheck (~> 0.1.0)
spring (~> 2.1.0)
spring-commands-rspec (~> 1.0.4)
sprockets (~> 3.7.0)
diff --git a/app/assets/javascripts/boards/stores/getters.js b/app/assets/javascripts/boards/stores/getters.js
index 0589851c658..b61ecc5ccb6 100644
--- a/app/assets/javascripts/boards/stores/getters.js
+++ b/app/assets/javascripts/boards/stores/getters.js
@@ -21,7 +21,7 @@ export default {
groupPathForActiveIssue: (_, getters) => {
const { referencePath = '' } = getters.activeBoardItem;
- return referencePath.slice(0, referencePath.indexOf('/'));
+ return referencePath.slice(0, referencePath.lastIndexOf('/'));
},
projectPathForActiveIssue: (_, getters) => {
diff --git a/app/assets/javascripts/diffs/components/diff_file.vue b/app/assets/javascripts/diffs/components/diff_file.vue
index bdbc13a38c4..afd7467acf3 100644
--- a/app/assets/javascripts/diffs/components/diff_file.vue
+++ b/app/assets/javascripts/diffs/components/diff_file.vue
@@ -148,10 +148,8 @@ export default {
return loggedIn && featureOn;
},
- hasCodequalityChanges() {
- return (
- this.codequalityDiff?.files && this.codequalityDiff?.files[this.file.file_path]?.length > 0
- );
+ codequalityDiffForFile() {
+ return this.codequalityDiff?.files?.[this.file.file_path] || [];
},
},
watch: {
@@ -299,7 +297,7 @@ export default {
:add-merge-request-buttons="true"
:view-diffs-file-by-file="viewDiffsFileByFile"
:show-local-file-reviews="showLocalFileReviews"
- :has-codequality-changes="hasCodequalityChanges"
+ :codequality-diff="codequalityDiffForFile"
class="js-file-title file-title gl-border-1 gl-border-solid gl-border-gray-100"
:class="hasBodyClasses.header"
@toggleFile="handleToggle"
diff --git a/app/assets/javascripts/diffs/components/diff_file_header.vue b/app/assets/javascripts/diffs/components/diff_file_header.vue
index 3b4e21ab61b..676c9a3c7bc 100644
--- a/app/assets/javascripts/diffs/components/diff_file_header.vue
+++ b/app/assets/javascripts/diffs/components/diff_file_header.vue
@@ -96,10 +96,10 @@ export default {
required: false,
default: false,
},
- hasCodequalityChanges: {
- type: Boolean,
+ codequalityDiff: {
+ type: Array,
required: false,
- default: false,
+ default: () => [],
},
},
data() {
@@ -333,7 +333,12 @@ export default {
data-track-property="diff_copy_file"
/>
- <code-quality-badge v-if="hasCodequalityChanges" class="gl-mr-2" />
+ <code-quality-badge
+ v-if="codequalityDiff.length"
+ :file-name="filePath"
+ :codequality-diff="codequalityDiff"
+ class="gl-mr-2"
+ />
<small v-if="isModeChanged" ref="fileMode" class="mr-1">
{{ diffFile.a_mode }} → {{ diffFile.b_mode }}
diff --git a/app/assets/javascripts/reports/codequality_report/components/codequality_issue_body.vue b/app/assets/javascripts/reports/codequality_report/components/codequality_issue_body.vue
index e5980f1e539..dabfb623f43 100644
--- a/app/assets/javascripts/reports/codequality_report/components/codequality_issue_body.vue
+++ b/app/assets/javascripts/reports/codequality_report/components/codequality_issue_body.vue
@@ -6,7 +6,7 @@
import { GlIcon, GlTooltipDirective } from '@gitlab/ui';
import { s__ } from '~/locale';
import ReportLink from '~/reports/components/report_link.vue';
-import { STATUS_SUCCESS } from '~/reports/constants';
+import { STATUS_SUCCESS, STATUS_NEUTRAL } from '~/reports/constants';
import { SEVERITY_CLASSES, SEVERITY_ICONS } from '../constants';
export default {
@@ -21,7 +21,8 @@ export default {
props: {
status: {
type: String,
- required: true,
+ required: false,
+ default: STATUS_NEUTRAL,
},
issue: {
type: Object,
diff --git a/app/models/issue/metrics.rb b/app/models/issue/metrics.rb
index a5e1957c096..86523bbd023 100644
--- a/app/models/issue/metrics.rb
+++ b/app/models/issue/metrics.rb
@@ -24,6 +24,10 @@ class Issue::Metrics < ApplicationRecord
private
def issue_assigned_to_list_label?
- issue.labels.any? { |label| label.lists.present? }
+ # Avoid another DB lookup when issue.labels are empty by adding a guard clause here
+ # We can't use issue.labels.empty? because that will cause a `Label Exists?` DB lookup
+ return false if issue.labels.length == 0 # rubocop:disable Style/ZeroLengthPredicate
+
+ issue.labels.includes(:lists).any? { |label| label.lists.present? }
end
end
diff --git a/app/services/spam/spam_action_service.rb b/app/services/spam/spam_action_service.rb
index 1cd432e1f66..3ae5111b994 100644
--- a/app/services/spam/spam_action_service.rb
+++ b/app/services/spam/spam_action_service.rb
@@ -130,6 +130,9 @@ module Spam
create_spam_log(api)
when ALLOW
target.clear_spam_flags!
+ when NOOP
+ # spamcheck is not explicitly rendering a verdict & therefore can't make a decision
+ target.clear_spam_flags!
end
end
end
diff --git a/app/services/spam/spam_constants.rb b/app/services/spam/spam_constants.rb
index 2a16cfae78b..b654fbbbcc8 100644
--- a/app/services/spam/spam_constants.rb
+++ b/app/services/spam/spam_constants.rb
@@ -6,6 +6,7 @@ module Spam
DISALLOW = "disallow"
ALLOW = "allow"
BLOCK_USER = "block"
+ NOOP = "noop"
SUPPORTED_VERDICTS = {
BLOCK_USER => {
@@ -19,6 +20,9 @@ module Spam
},
ALLOW => {
priority: 4
+ },
+ NOOP => {
+ priority: 5
}
}.freeze
end
diff --git a/app/services/system_notes/issuables_service.rb b/app/services/system_notes/issuables_service.rb
index 60dd56e772a..a44a3d3f1b9 100644
--- a/app/services/system_notes/issuables_service.rb
+++ b/app/services/system_notes/issuables_service.rb
@@ -178,8 +178,7 @@ module SystemNotes
if noteable.is_a?(ExternalIssue)
noteable.project.external_issue_tracker.create_cross_reference_note(noteable, mentioner, author)
else
- issue_activity_counter.track_issue_cross_referenced_action(author: author) if noteable.is_a?(Issue)
-
+ track_cross_reference_action
create_note(NoteSummary.new(noteable, noteable.project, author, body, action: 'cross_reference'))
end
end
@@ -414,6 +413,10 @@ module SystemNotes
def issue_activity_counter
Gitlab::UsageDataCounters::IssueActivityUniqueCounter
end
+
+ def track_cross_reference_action
+ issue_activity_counter.track_issue_cross_referenced_action(author: author) if noteable.is_a?(Issue)
+ end
end
end
diff --git a/app/workers/build_hooks_worker.rb b/app/workers/build_hooks_worker.rb
index c30771c03f1..be79d6b2afb 100644
--- a/app/workers/build_hooks_worker.rb
+++ b/app/workers/build_hooks_worker.rb
@@ -11,6 +11,16 @@ class BuildHooksWorker # rubocop:disable Scalability/IdempotentWorker
urgency :high
data_consistency :delayed, feature_flag: :load_balancing_for_build_hooks_worker
+ DATA_CONSISTENCY_DELAY = 3
+
+ def self.perform_async(*args)
+ if Feature.enabled?(:delayed_perform_for_build_hooks_worker, default_enabled: :yaml)
+ perform_in(DATA_CONSISTENCY_DELAY.seconds, *args)
+ else
+ super
+ end
+ end
+
# rubocop: disable CodeReuse/ActiveRecord
def perform(build_id)
Ci::Build.includes({ runner: :tags })
diff --git a/changelogs/unreleased/4794-add-eager-loading-to-issue-metrics.yml b/changelogs/unreleased/4794-add-eager-loading-to-issue-metrics.yml
new file mode 100644
index 00000000000..8487400dff3
--- /dev/null
+++ b/changelogs/unreleased/4794-add-eager-loading-to-issue-metrics.yml
@@ -0,0 +1,5 @@
+---
+title: Remove N+1 query from Issue::Metrics#record
+merge_request: 60589
+author:
+type: performance
diff --git a/changelogs/unreleased/remove_feature_flag_upgrade_link_in_user_menu_a.yml b/changelogs/unreleased/remove_feature_flag_upgrade_link_in_user_menu_a.yml
new file mode 100644
index 00000000000..e8b94dd78c1
--- /dev/null
+++ b/changelogs/unreleased/remove_feature_flag_upgrade_link_in_user_menu_a.yml
@@ -0,0 +1,5 @@
+---
+title: Remove feature flag from upgrade link in user menu
+merge_request: 61057
+author:
+type: added
diff --git a/config/feature_flags/development/upgrade_link_in_user_menu_a.yml b/config/feature_flags/development/delayed_perform_for_build_hooks_worker.yml
index 8ee4cf0ecbf..45fcf7d21bd 100644
--- a/config/feature_flags/development/upgrade_link_in_user_menu_a.yml
+++ b/config/feature_flags/development/delayed_perform_for_build_hooks_worker.yml
@@ -1,8 +1,8 @@
---
-name: upgrade_link_in_user_menu_a
-introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/56591
-rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/300824
-milestone: '13.11'
+name: delayed_perform_for_build_hooks_worker
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/61149
+rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/330132
+milestone: '13.12'
type: development
-group: group::expansion
-default_enabled: true
+group: group::memory
+default_enabled: false
diff --git a/doc/development/usage_ping/dictionary.md b/doc/development/usage_ping/dictionary.md
index 0f49f559c15..8c60a768b46 100644
--- a/doc/development/usage_ping/dictionary.md
+++ b/doc/development/usage_ping/dictionary.md
@@ -10294,6 +10294,30 @@ Status: `data_available`
Tiers: `premium`, `ultimate`
+### `redis_hll_counters.epics_usage.g_project_management_epic_cross_referenced_monthly`
+
+Count of MAU cross referencing epics
+
+[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_28d/20210430174100_g_project_management_epic_cross_referenced_monthly.yml)
+
+Group: `group::product planning`
+
+Status: `implemented`
+
+Tiers: `premium`, `ultimate`
+
+### `redis_hll_counters.epics_usage.g_project_management_epic_cross_referenced_weekly`
+
+Counts of WAU cross referencing epics
+
+[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_7d/20210430173650_g_project_management_epic_cross_referenced_weekly.yml)
+
+Group: `group::product planning`
+
+Status: `implemented`
+
+Tiers: `premium`, `ultimate`
+
### `redis_hll_counters.epics_usage.g_project_management_epic_destroyed_monthly`
Count of MAU destroying epics
diff --git a/doc/user/application_security/configuration/index.md b/doc/user/application_security/configuration/index.md
index 36868cefc78..8c34303ca00 100644
--- a/doc/user/application_security/configuration/index.md
+++ b/doc/user/application_security/configuration/index.md
@@ -10,7 +10,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/20711) in [GitLab Ultimate](https://about.gitlab.com/pricing/) 12.6. **(ULTIMATE)**
> - SAST configuration was [enabled](https://gitlab.com/groups/gitlab-org/-/epics/3659) in 13.3 and [improved](https://gitlab.com/gitlab-org/gitlab/-/issues/232862) in 13.4. **(ULTIMATE)**
> - DAST Profiles feature was [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/40474) in 13.4. **(ULTIMATE)**
-> - A simplified version was made [available in all tiers](https://gitlab.com/gitlab-org/gitlab/-/issues/294076) in GitLab 13.9.
+> - A simplified version was made [available in all tiers](https://gitlab.com/gitlab-org/gitlab/-/issues/294076) in GitLab 13.10.
WARNING:
This feature might not be available to you. Check the **version history** note above for details.
diff --git a/doc/user/project/merge_requests/approvals/settings.md b/doc/user/project/merge_requests/approvals/settings.md
index 0ca1d462fef..a21d74162ab 100644
--- a/doc/user/project/merge_requests/approvals/settings.md
+++ b/doc/user/project/merge_requests/approvals/settings.md
@@ -7,7 +7,7 @@ type: reference, concepts
# Merge request approval settings
-The settings for Merge Request Approvals are found by going to
+The settings for merge request approvals are found by going to
**Settings > General** and expanding **Merge request (MR) approvals**.
## Prevent overriding default approvals
@@ -90,7 +90,7 @@ To enable this feature:
## Security approvals in merge requests **(ULTIMATE)**
-Merge Request Approvals can be configured to require approval from a member
+Merge request approvals can be configured to require approval from a member
of your security team when a vulnerability would be introduced by a merge request.
For more information, see
diff --git a/doc/user/project/merge_requests/cherry_pick_changes.md b/doc/user/project/merge_requests/cherry_pick_changes.md
index f531cd52af1..eaeef12444e 100644
--- a/doc/user/project/merge_requests/cherry_pick_changes.md
+++ b/doc/user/project/merge_requests/cherry_pick_changes.md
@@ -16,7 +16,7 @@ with a **Cherry-pick** button in merge requests and commit details.
After the merge request has been merged, a **Cherry-pick** button displays
to cherry-pick the changes introduced by that merge request.
-![Cherry-pick Merge Request](img/cherry_pick_changes_mr.png)
+![Cherry-pick merge request](img/cherry_pick_changes_mr.png)
After you click that button, a modal displays a
[branch filter search box](../repository/branches/index.md#branch-filter-search-box)
@@ -32,7 +32,7 @@ where you can choose to either:
When you cherry-pick a merge commit, GitLab displays a system note to the related merge
request thread. It crosslinks the new commit and the existing merge request.
-![Cherry-pick tracking in Merge Request timeline](img/cherry_pick_mr_timeline_v12_9.png)
+![Cherry-pick tracking in merge request timeline](img/cherry_pick_mr_timeline_v12_9.png)
Each deployment's [list of associated merge requests](../../../api/deployments.md#list-of-merge-requests-associated-with-a-deployment) includes cherry-picked merge commits.
diff --git a/doc/user/project/merge_requests/code_quality.md b/doc/user/project/merge_requests/code_quality.md
index 0fe1b9801cc..3f5823916a4 100644
--- a/doc/user/project/merge_requests/code_quality.md
+++ b/doc/user/project/merge_requests/code_quality.md
@@ -519,7 +519,7 @@ to change the default configuration, **not** a `.codequality.yml` file. If you u
the wrong filename, the [default `.codeclimate.yml`](https://gitlab.com/gitlab-org/ci-cd/codequality/-/blob/master/codeclimate_defaults/.codeclimate.yml.template)
is still used.
-### No Code Quality report is displayed in a Merge Request
+### No Code Quality report is displayed in a merge request
This can be due to multiple reasons:
@@ -531,7 +531,7 @@ This can be due to multiple reasons:
nothing is displayed.
- The [`artifacts:expire_in`](../../../ci/yaml/README.md#artifactsexpire_in) CI/CD
setting can cause the Code Quality artifact(s) to expire faster than desired.
-- The widgets use the pipeline of the latest commit to the target branch. If commits are made to the default branch that do not run the code quality job, this may cause the Merge Request widget to have no base report for comparison.
+- The widgets use the pipeline of the latest commit to the target branch. If commits are made to the default branch that do not run the code quality job, this may cause the merge request widget to have no base report for comparison.
- If you use the [`REPORT_STDOUT` environment variable](https://gitlab.com/gitlab-org/ci-cd/codequality#environment-variables), no report file is generated and nothing displays in the merge request.
- Large `gl-code-quality-report.json` files (esp. >10 MB) are [known to prevent the report from being displayed](https://gitlab.com/gitlab-org/gitlab/-/issues/2737).
As a work-around, try removing [properties](https://github.com/codeclimate/platform/blob/master/spec/analyzers/SPEC.md#data-types)
diff --git a/doc/user/project/merge_requests/creating_merge_requests.md b/doc/user/project/merge_requests/creating_merge_requests.md
index aa669b4eaba..ce1dac0a96b 100644
--- a/doc/user/project/merge_requests/creating_merge_requests.md
+++ b/doc/user/project/merge_requests/creating_merge_requests.md
@@ -3,14 +3,14 @@ stage: Create
group: Code Review
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: howto
-description: "How to create Merge Requests in GitLab."
+description: "How to create merge requests in GitLab."
disqus_identifier: 'https://docs.gitlab.com/ee/gitlab-basics/add-merge-request.html'
---
# How to create a merge request **(FREE)**
Before creating a merge request, read through an
-[introduction to Merge Requests](getting_started.md)
+[introduction to merge requests](getting_started.md)
to familiarize yourself with the concept, the terminology,
and to learn what you can do with them.
@@ -21,16 +21,16 @@ or through the [GitLab UI](#new-merge-request-from-a-new-branch-created-through-
This document describes the several ways to create a merge request.
When you start a new merge request, regardless of the method,
-you are taken to the [**New Merge Request** page](#new-merge-request-page)
+you are taken to the [**New merge request** page](#new-merge-request-page)
to fill it with information about the merge request.
If you push a new branch to GitLab, also regardless of the method,
-you can click the [**Create Merge Request**](#create-merge-request-button)
+you can click the [**Create merge request**](#create-merge-request-button)
button and start a merge request from there.
-## New Merge Request page
+## New merge request page
-On the **New Merge Request** page, start by filling in the title and description
+On the **New merge request** page, start by filling in the title and description
for the merge request. If commits already exist on the branch, GitLab suggests a
merge request title for you:
@@ -43,31 +43,31 @@ merge request title for you:
The title is the only field that is mandatory in all cases.
From there, you can fill it with information (title, description,
-assignee(s), milestone, labels, approvers) and click **Create Merge Request**.
+assignee(s), milestone, labels, approvers) and click **Create merge request**.
From that initial screen, you can also see all the commits,
pipelines, and file changes pushed to your branch before submitting
the merge request.
-![New Merge Request page](img/new_merge_request_page_v12_6.png)
+![New merge request page](img/new_merge_request_page_v12_6.png)
NOTE:
You can push one or more times to your branch in GitLab before
creating the merge request.
-## Create Merge Request button
+## Create merge request button
Once you have pushed a new branch to GitLab, visit your repository
in GitLab and to see a call-to-action at the top of your screen
-from which you can click the button **Create Merge Request**.
+from which you can click the button **Create merge request**.
-![Create Merge Request button](img/create_merge_request_button_v12_6.png)
+![Create merge request button](img/create_merge_request_button_v12_6.png)
You can also see the **Create merge request** button in the top-right of the:
- **Project** page.
- **Repository > Files** page.
-- **Merge Requests** page.
+- **Merge requests** page.
In this case, GitLab uses the most recent branch you pushed
changes to as the source branch, and the default branch in the current
@@ -90,7 +90,7 @@ Once you have added, edited, or uploaded the file:
1. Click **Commit changes**.
If you chose to start a merge request, you are taken to the
-[**New Merge Request** page](#new-merge-request-page), from
+[**New merge request** page](#new-merge-request-page), from
which you can fill it in with information and submit the merge request.
The merge request targets the default branch of the repository.
@@ -103,8 +103,8 @@ navigate to your project's **Repository > Branches** and click
**New branch**. A new branch is created and you can start
editing files.
-Once committed and pushed, you can click on the [**Create Merge Request**](#create-merge-request-button)
-button to open the [**New Merge Request** page](#new-merge-request-page).
+Once committed and pushed, you can click on the [**Create merge request**](#create-merge-request-button)
+button to open the [**New merge request** page](#new-merge-request-page).
A new merge request is started using the current branch as the source,
and the default branch in the current project as the target.
@@ -140,7 +140,7 @@ remote: To create a merge request for docs-new-merge-request, visit:
remote: https://gitlab-instance.com/my-group/my-project/merge_requests/new?merge_request%5Bsource_branch%5D=my-new-branch
```
-Copy that link and paste it in your browser, and the [**New Merge Request page**](#new-merge-request-page)
+Copy that link and paste it in your browser, and the [**New merge request page**](#new-merge-request-page)
is displayed.
There is also a number of [flags you can add to commands when pushing through the command line](../push_options.md) to reduce the need for editing merge requests manually through the UI.
@@ -148,20 +148,20 @@ There is also a number of [flags you can add to commands when pushing through th
If you didn't push your branch to GitLab through the command line
(for example, you used a Git CLI application to push your changes),
you can create a merge request through the GitLab UI by clicking
-the [**Create Merge Request**](#create-merge-request-button) button.
+the [**Create merge request**](#create-merge-request-button) button.
## New merge request from an issue
You can also [create a new merge request directly from an issue](../repository/web_editor.md#create-a-new-branch-from-an-issue).
-## New merge request from the Merge Requests page
+## New merge request from the merge requests page
You can start creating a new merge request by clicking the
-**New merge request** button on the **Merge Requests** page in a project.
+**New merge request** button on the **merge requests** page in a project.
Then choose the source project and branch that contain your changes,
and the target project and branch where you want to merge the changes into.
Click on **Compare branches and continue** to go to the
-[**New Merge Request** page](#new-merge-request-page) and fill in the details.
+[**New merge request** page](#new-merge-request-page) and fill in the details.
## New merge request from a fork
@@ -169,7 +169,7 @@ After forking a project and applying your local changes, complete the following
create a merge request from your fork to contribute back to the main project:
1. Go to **Projects > Your Projects** and select your fork of the repository.
-1. In the left menu, go to **Merge Requests**, and click **New Merge Request**.
+1. In the left menu, go to **Merge requests**, and click **New merge request**.
1. In the **Source branch** drop-down list box, select your branch in your forked repository as the source branch.
1. In the **Target branch** drop-down list box, select the branch from the upstream repository as the target branch.
You can set a [default target project](#set-the-default-target-project) to
@@ -247,6 +247,6 @@ apply the patches. The target branch can be specified using the
[`/target_branch` quick action](../quick_actions.md). If the source
branch already exists, the patches are applied on top of it.
-## Reviewing and managing Merge Requests
+## Reviewing and managing merge requests
Once you have submitted a merge request, it can be [reviewed and managed](reviews/index.md) through GitLab.
diff --git a/doc/user/project/merge_requests/csv_export.md b/doc/user/project/merge_requests/csv_export.md
index f973d9220f2..5556e54f875 100644
--- a/doc/user/project/merge_requests/csv_export.md
+++ b/doc/user/project/merge_requests/csv_export.md
@@ -4,13 +4,13 @@ group: Compliance
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
---
-# Export Merge Requests to CSV **(FREE)**
+# Export merge requests to CSV **(FREE)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/3619) in GitLab 13.6.
-Exporting Merge Requests CSV enables you and your team to export all the data collected from merge requests into a comma-separated values (CSV) file, which stores tabular data in plain text.
+Exporting merge requests CSV enables you and your team to export all the data collected from merge requests into a comma-separated values (CSV) file, which stores tabular data in plain text.
-To export Merge Requests to CSV, navigate to your **Merge Requests** from the sidebar of a project and click **Export to CSV**.
+To export merge requests to CSV, navigate to your **Merge requests** from the sidebar of a project and click **Export to CSV**.
## CSV Output
diff --git a/doc/user/project/merge_requests/drafts.md b/doc/user/project/merge_requests/drafts.md
index a030961e219..57850ad7304 100644
--- a/doc/user/project/merge_requests/drafts.md
+++ b/doc/user/project/merge_requests/drafts.md
@@ -66,7 +66,7 @@ when you mark a merge request as ready, notifications are triggered to
When viewing or searching in your project's merge requests list, you can include or exclude
draft merge requests:
-1. In your project, select **Merge Requests** from the left sidebar.
+1. Go to your project and select **Merge requests**.
1. In the navigation bar, click **Open**, **Merged**, **Closed**, or **All** to
filter by merge request status.
1. Click the search box to display a list of filters and select **Draft**, or
diff --git a/doc/user/project/merge_requests/fail_fast_testing.md b/doc/user/project/merge_requests/fail_fast_testing.md
index 99803e23b53..68a63aebb90 100644
--- a/doc/user/project/merge_requests/fail_fast_testing.md
+++ b/doc/user/project/merge_requests/fail_fast_testing.md
@@ -42,7 +42,7 @@ This template requires:
- A project built in Rails that uses RSpec for testing.
- CI/CD configured to:
- Use a Docker image with Ruby available.
- - Use [Pipelines for Merge Requests](../../../ci/merge_request_pipelines/index.md#configuring-pipelines-for-merge-requests)
+ - Use [Pipelines for merge requests](../../../ci/merge_request_pipelines/index.md#configuring-pipelines-for-merge-requests)
- [Pipelines for Merged Results](../../../ci/merge_request_pipelines/pipelines_for_merged_results/index.md#enable-pipelines-for-merged-results)
enabled in the project settings.
- A Docker image with Ruby available. The template uses `image: ruby:2.6` by default, but you [can override](../../../ci/yaml/includes.md#overriding-external-template-values) this.
diff --git a/doc/user/project/merge_requests/getting_started.md b/doc/user/project/merge_requests/getting_started.md
index 220d8daf69e..459b8fa56ff 100644
--- a/doc/user/project/merge_requests/getting_started.md
+++ b/doc/user/project/merge_requests/getting_started.md
@@ -3,12 +3,12 @@ stage: Create
group: Code Review
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: index, reference
-description: "Getting started with Merge Requests."
+description: "Getting started with merge requests."
---
-# Getting started with Merge Requests **(FREE)**
+# Getting started with merge requests **(FREE)**
-A Merge Request (**MR**) is the basis of GitLab as a code
+A merge request (**MR**) is the basis of GitLab as a code
collaboration and version control.
When working in a Git-based platform, you can use branching
@@ -25,7 +25,7 @@ avoiding changes to be pushed directly to the default branch
without prior reviews, tests, and approvals.
When you create a new feature branch, change the files, and push
-it to GitLab, you have the option to create a **Merge Request**,
+it to GitLab, you have the option to create a **merge request**,
which is essentially a _request_ to merge one branch into another.
The branch you added your changes into is called _source branch_
@@ -122,7 +122,7 @@ Requesting a code review is an important part of contributing code. However, dec
your code and asking for a review are no easy tasks. Using the "assignee" field for both authors and
reviewers makes it hard for others to determine who's doing what on a merge request.
-The Merge Request Reviewers feature enables you to request a review of your work, and
+The merge request Reviewers feature enables you to request a review of your work, and
see the status of the review. Reviewers help distinguish the roles of the users
involved in the merge request. In comparison to an **Assignee**, who is directly
responsible for creating or merging a merge request, a **Reviewer** is a team member
@@ -234,7 +234,7 @@ The feature today works only on merge. Clicking the **Remove source branch** but
after the merge request was merged will not automatically retarget a merge request.
This improvement is [tracked as a follow-up](https://gitlab.com/gitlab-org/gitlab/-/issues/321559).
-## Recommendations and best practices for Merge Requests
+## Recommendations and best practices for merge requests
- When working locally in your branch, add multiple commits and only push when
you're done, so GitLab runs only one pipeline for all the commits pushed
diff --git a/doc/user/project/merge_requests/merge_request_dependencies.md b/doc/user/project/merge_requests/merge_request_dependencies.md
index fc5cc4d958b..4534ce194bf 100644
--- a/doc/user/project/merge_requests/merge_request_dependencies.md
+++ b/doc/user/project/merge_requests/merge_request_dependencies.md
@@ -5,10 +5,10 @@ info: To determine the technical writer assigned to the Stage/Group associated w
type: reference, concepts
---
-# Merge Request dependencies **(PREMIUM)**
+# Merge request dependencies **(PREMIUM)**
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/9688) in [GitLab Premium](https://about.gitlab.com/pricing/) 12.2.
-> - [Renamed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/17291) from "Cross-project dependencies" to "Merge Requests dependencies" in [GitLab Premium](https://about.gitlab.com/pricing/) 12.4.
+> - [Renamed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/17291) from "Cross-project dependencies" to "Merge request dependencies" in [GitLab Premium](https://about.gitlab.com/pricing/) 12.4.
> - Intra-project MR dependencies were [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/16799) in [GitLab Premium](https://about.gitlab.com/pricing/) 12.4.
Merge request dependencies allows a required order of merging
diff --git a/doc/user/project/merge_requests/reviews/index.md b/doc/user/project/merge_requests/reviews/index.md
index 5aca6e1e5a6..c1a81fed20c 100644
--- a/doc/user/project/merge_requests/reviews/index.md
+++ b/doc/user/project/merge_requests/reviews/index.md
@@ -17,8 +17,8 @@ members can choose to accept or reject it.
You can view merge requests for a specific project, or for all projects in a group:
-- **Specific project**: Go to your project and select **Merge Requests**.
-- **All projects in a group**: Go to your group and select **Merge Requests**.
+- **Specific project**: Go to your project and select **Merge requests**.
+- **All projects in a group**: Go to your group and select **Merge requests**.
If your group contains subgroups, this view also displays merge requests from the subgroup projects.
GitLab displays a count of open merge requests in the left sidebar, but
[caches the value](#cached-merge-request-count) for groups with a large number of
@@ -101,15 +101,17 @@ A merge commit is created for every merge, but the branch is only merged if
a fast-forward merge is possible. This ensures that if the merge request build
succeeded, the target branch build also succeeds after the merge.
-Navigate to a project's settings, select the **Merge commit with semi-linear history**
-option under **Merge Requests: Merge method** and save your changes.
+1. Go to your project and select **Settings > General**.
+1. Expand **Merge requests**.
+1. In the **Merge method** section, select **Merge commit with semi-linear history**.
+1. Select **Save changes**.
## Perform inline code reviews
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/13950) in GitLab 11.5.
In a merge request, you can leave comments in any part of the file being changed.
-In the Merge Request Diff UI, you can:
+In the merge request Diff UI, you can:
- **Comment on a single line**: Select the **{comment}** **comment** icon in the
gutter to expand the diff lines and display a comment box.
@@ -222,15 +224,15 @@ seconds and the status should update automatically.
#### Bug
-Merge Request pipeline statuses can't be retrieved when the following occurs:
+Merge request pipeline statuses can't be retrieved when the following occurs:
-1. A Merge Request is created
-1. The Merge Request is closed
+1. A merge request is created
+1. The merge request is closed
1. Changes are made in the project
-1. The Merge Request is reopened
+1. The merge request is reopened
To enable the pipeline status to be properly retrieved, close and reopen the
-Merge Request again.
+merge request again.
## Tips
diff --git a/doc/user/project/merge_requests/test_coverage_visualization.md b/doc/user/project/merge_requests/test_coverage_visualization.md
index 8761a293b95..41b6044d1a5 100644
--- a/doc/user/project/merge_requests/test_coverage_visualization.md
+++ b/doc/user/project/merge_requests/test_coverage_visualization.md
@@ -53,12 +53,12 @@ of times the line was checked by tests.
NOTE:
A limit of 100 `<source>` nodes for Cobertura format XML files applies. If your Cobertura report exceeds
-100 nodes, there can be mismatches or no matches in the Merge Request diff view.
+100 nodes, there can be mismatches or no matches in the merge request diff view.
### Artifact expiration
By default, the [pipeline artifact](../../../ci/pipelines/pipeline_artifacts.md#storage) used
-to draw the visualization on the Merge Request expires **one week** after creation.
+to draw the visualization on the merge request expires **one week** after creation.
### Automatic class path correction
diff --git a/doc/user/project/merge_requests/versions.md b/doc/user/project/merge_requests/versions.md
index 2c77957c98d..676af4b2881 100644
--- a/doc/user/project/merge_requests/versions.md
+++ b/doc/user/project/merge_requests/versions.md
@@ -49,11 +49,11 @@ This only applies to commits that are in the most recent version of a merge
request - if commits were in a merge request, then rebased out of that merge
request, they aren't linked.
-## `HEAD` comparison mode for Merge Requests
+## `HEAD` comparison mode for merge requests
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/27008) in GitLab 12.10.
-Merge Requests, particularly the **Changes** tab, is where source code
+Merge requests, particularly the **Changes** tab, is where source code
is reviewed and discussed. In circumstances where the target branch was
merged into the source branch of the merge request, the changes in the
source and target branch can be shown mixed together making it hard to
diff --git a/lib/gitlab/spamcheck/client.rb b/lib/gitlab/spamcheck/client.rb
index 74a3a298bce..e4dfb3da0f3 100644
--- a/lib/gitlab/spamcheck/client.rb
+++ b/lib/gitlab/spamcheck/client.rb
@@ -11,7 +11,8 @@ module Gitlab
::Spamcheck::SpamVerdict::Verdict::ALLOW => ALLOW,
::Spamcheck::SpamVerdict::Verdict::CONDITIONAL_ALLOW => CONDITIONAL_ALLOW,
::Spamcheck::SpamVerdict::Verdict::DISALLOW => DISALLOW,
- ::Spamcheck::SpamVerdict::Verdict::BLOCK => BLOCK_USER
+ ::Spamcheck::SpamVerdict::Verdict::BLOCK => BLOCK_USER,
+ ::Spamcheck::SpamVerdict::Verdict::NOOP => NOOP
}.freeze
ACTION_MAPPING = {
@@ -60,6 +61,7 @@ module Gitlab
issue_pb.created_at = convert_to_pb_timestamp(issue.created_at) if issue.created_at
issue_pb.updated_at = convert_to_pb_timestamp(issue.updated_at) if issue.updated_at
issue_pb.user_in_project = user.authorized_project?(issue.project)
+ issue_pb.project = build_project_protobuf(issue)
issue_pb.action = ACTION_MAPPING.fetch(context.fetch(:action)) if context.has_key?(:action)
issue_pb.user = build_user_protobuf(user)
issue_pb
@@ -87,6 +89,13 @@ module Gitlab
email_pb
end
+ def build_project_protobuf(issue)
+ project_pb = ::Spamcheck::Project.new
+ project_pb.project_id = issue.project_id
+ project_pb.project_path = issue.project.full_path
+ project_pb
+ end
+
def convert_to_pb_timestamp(ar_timestamp)
Google::Protobuf::Timestamp.new(seconds: ar_timestamp.to_time.to_i,
nanos: ar_timestamp.to_time.nsec)
diff --git a/lib/gitlab/usage_data_counters/known_events/epic_events.yml b/lib/gitlab/usage_data_counters/known_events/epic_events.yml
index ccf385bbdfd..d1864cd569b 100644
--- a/lib/gitlab/usage_data_counters/known_events/epic_events.yml
+++ b/lib/gitlab/usage_data_counters/known_events/epic_events.yml
@@ -176,3 +176,9 @@
redis_slot: project_management
aggregation: daily
feature_flag: track_epics_activity
+
+- name: g_project_management_epic_cross_referenced
+ category: epics_usage
+ redis_slot: project_management
+ aggregation: daily
+ feature_flag: track_epics_activity
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index ced2e339114..24f71c8c45d 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -7913,6 +7913,15 @@ msgstr ""
msgid "CodeOwner|Pattern"
msgstr ""
+msgid "CodeQuality|Code quality"
+msgstr ""
+
+msgid "CodeQuality|New code quality degradations in this file"
+msgstr ""
+
+msgid "CodeQuality|Some changes in this file degrade the code quality."
+msgstr ""
+
msgid "Cohorts|Inactive users"
msgstr ""
@@ -31991,9 +32000,6 @@ msgstr ""
msgid "The merge request can now be merged."
msgstr ""
-msgid "The merge request has made changes to this file that affect the number of code quality violations in it."
-msgstr ""
-
msgid "The metric must be one of %{metrics}."
msgstr ""
diff --git a/spec/frontend/boards/stores/getters_spec.js b/spec/frontend/boards/stores/getters_spec.js
index 6114ba0af5f..e7efb21bee5 100644
--- a/spec/frontend/boards/stores/getters_spec.js
+++ b/spec/frontend/boards/stores/getters_spec.js
@@ -110,6 +110,15 @@ describe('Boards - Getters', () => {
);
});
+ it('returns group path of last subgroup for the active issue', () => {
+ const mockActiveIssue = {
+ referencePath: 'gitlab-org/subgroup/subsubgroup/gitlab-test#1',
+ };
+ expect(getters.groupPathForActiveIssue({}, { activeBoardItem: mockActiveIssue })).toEqual(
+ 'gitlab-org/subgroup/subsubgroup',
+ );
+ });
+
it('returns empty string as group path when active issue is an empty object', () => {
const mockActiveIssue = {};
expect(getters.groupPathForActiveIssue({}, { activeBoardItem: mockActiveIssue })).toEqual('');
diff --git a/spec/lib/gitlab/spamcheck/client_spec.rb b/spec/lib/gitlab/spamcheck/client_spec.rb
index 3978ff9fc2e..3384c079ffc 100644
--- a/spec/lib/gitlab/spamcheck/client_spec.rb
+++ b/spec/lib/gitlab/spamcheck/client_spec.rb
@@ -38,6 +38,7 @@ RSpec.describe Gitlab::Spamcheck::Client do
::Spamcheck::SpamVerdict::Verdict::CONDITIONAL_ALLOW | Spam::SpamConstants::CONDITIONAL_ALLOW
::Spamcheck::SpamVerdict::Verdict::DISALLOW | Spam::SpamConstants::DISALLOW
::Spamcheck::SpamVerdict::Verdict::BLOCK | Spam::SpamConstants::BLOCK_USER
+ ::Spamcheck::SpamVerdict::Verdict::NOOP | Spam::SpamConstants::NOOP
end
with_them do
@@ -58,6 +59,7 @@ RSpec.describe Gitlab::Spamcheck::Client do
expect(issue_pb.title).to eq issue.title
expect(issue_pb.description).to eq issue.description
expect(issue_pb.user_in_project). to be false
+ expect(issue_pb.project.project_id).to eq issue.project_id
expect(issue_pb.created_at).to eq timestamp_to_protobuf_timestamp(issue.created_at)
expect(issue_pb.updated_at).to eq timestamp_to_protobuf_timestamp(issue.updated_at)
expect(issue_pb.action).to be ::Spamcheck::Action.lookup(::Spamcheck::Action::CREATE)
@@ -83,7 +85,7 @@ RSpec.describe Gitlab::Spamcheck::Client do
user.emails << secondary_email
end
- it 'adds emsils to the user pb object' do
+ it 'adds emails to the user pb object' do
user_pb = described_class.new.send(:build_user_protobuf, user)
expect(user_pb.emails.count).to eq 2
expect(user_pb.emails.first.email).to eq user.email
@@ -94,6 +96,14 @@ RSpec.describe Gitlab::Spamcheck::Client do
end
end
+ describe "#build_project_protobuf", :aggregate_failures do
+ it 'builds the expected protobuf object' do
+ project_pb = described_class.new.send(:build_project_protobuf, issue)
+ expect(project_pb.project_id).to eq issue.project_id
+ expect(project_pb.project_path).to eq issue.project.full_path
+ end
+ end
+
private
def timestamp_to_protobuf_timestamp(timestamp)
diff --git a/spec/models/issue/metrics_spec.rb b/spec/models/issue/metrics_spec.rb
index 18b0a46c928..49c891c20da 100644
--- a/spec/models/issue/metrics_spec.rb
+++ b/spec/models/issue/metrics_spec.rb
@@ -80,5 +80,20 @@ RSpec.describe Issue::Metrics do
expect(metrics.first_added_to_board_at).to be_like_time(time)
end
end
+
+ describe "#record!" do
+ it "does not cause an N+1 query" do
+ label = create(:label)
+ subject.update!(label_ids: [label.id])
+
+ control_count = ActiveRecord::QueryRecorder.new { Issue::Metrics.find_by(issue: subject).record! }.count
+
+ additional_labels = create_list(:label, 4)
+
+ subject.update!(label_ids: additional_labels.map(&:id))
+
+ expect { Issue::Metrics.find_by(issue: subject).record! }.not_to exceed_query_limit(control_count)
+ end
+ end
end
end
diff --git a/spec/services/spam/spam_action_service_spec.rb b/spec/services/spam/spam_action_service_spec.rb
index 318643e04db..9ca52b92267 100644
--- a/spec/services/spam/spam_action_service_spec.rb
+++ b/spec/services/spam/spam_action_service_spec.rb
@@ -313,6 +313,22 @@ RSpec.describe Spam::SpamActionService do
end
end
+ context 'when spam verdict service returns noop' do
+ before do
+ allow(fake_verdict_service).to receive(:execute).and_return(NOOP)
+ end
+
+ it 'does not create a spam log' do
+ expect { subject }.not_to change(SpamLog, :count)
+ end
+
+ it 'clears spam flags' do
+ expect(issue).to receive(:clear_spam_flags!)
+
+ subject
+ end
+ end
+
context 'with spam verdict service options' do
before do
allow(fake_verdict_service).to receive(:execute).and_return(ALLOW)
diff --git a/spec/support/shared_contexts/spam_constants.rb b/spec/support/shared_contexts/spam_constants.rb
index 813f9d00123..e88a7c1b0df 100644
--- a/spec/support/shared_contexts/spam_constants.rb
+++ b/spec/support/shared_contexts/spam_constants.rb
@@ -6,5 +6,6 @@ RSpec.shared_context 'includes Spam constants' do
stub_const('DISALLOW', Spam::SpamConstants::DISALLOW)
stub_const('ALLOW', Spam::SpamConstants::ALLOW)
stub_const('BLOCK_USER', Spam::SpamConstants::BLOCK_USER)
+ stub_const('NOOP', Spam::SpamConstants::NOOP)
end
end
diff --git a/spec/workers/build_hooks_worker_spec.rb b/spec/workers/build_hooks_worker_spec.rb
index 7e469958a84..8395d8fb0e7 100644
--- a/spec/workers/build_hooks_worker_spec.rb
+++ b/spec/workers/build_hooks_worker_spec.rb
@@ -23,6 +23,24 @@ RSpec.describe BuildHooksWorker do
end
end
+ describe '.perform_async' do
+ context 'when delayed_perform_for_build_hooks_worker feature flag is disabled' do
+ before do
+ stub_feature_flags(delayed_perform_for_build_hooks_worker: false)
+ end
+
+ it 'does not call perform_in' do
+ expect(described_class).not_to receive(:perform_in)
+ end
+ end
+
+ it 'delays scheduling a job by calling perform_in' do
+ expect(described_class).to receive(:perform_in).with(described_class::DATA_CONSISTENCY_DELAY.second, 123)
+
+ described_class.perform_async(123)
+ end
+ end
+
it_behaves_like 'worker with data consistency',
described_class,
feature_flag: :load_balancing_for_build_hooks_worker,