Commit d7c0763e authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab master

parents 06d34544 d8af8dd1
61dcdf969231954c06f16a6222a7540460f4b4f0
0ae7a0079068ca8ad3a074c87e1b39037bdaed80
......@@ -10700,7 +10700,6 @@ ALTER SEQUENCE cluster_projects_id_seq OWNED BY cluster_projects.id;
CREATE TABLE cluster_providers_aws (
id bigint NOT NULL,
cluster_id bigint NOT NULL,
created_by_user_id integer,
num_nodes integer NOT NULL,
status integer NOT NULL,
created_at timestamp with time zone NOT NULL,
......@@ -19881,8 +19880,6 @@ CREATE UNIQUE INDEX index_cluster_providers_aws_on_cluster_id ON cluster_provide
CREATE INDEX index_cluster_providers_aws_on_cluster_id_and_status ON cluster_providers_aws USING btree (cluster_id, status);
CREATE INDEX index_cluster_providers_aws_on_created_by_user_id ON cluster_providers_aws USING btree (created_by_user_id);
CREATE INDEX index_cluster_providers_gcp_on_cloud_run ON cluster_providers_gcp USING btree (cloud_run);
CREATE UNIQUE INDEX index_cluster_providers_gcp_on_cluster_id ON cluster_providers_gcp USING btree (cluster_id);
......@@ -23705,9 +23702,6 @@ ALTER TABLE ONLY alert_management_alert_user_mentions
ALTER TABLE ONLY snippet_statistics
ADD CONSTRAINT fk_rails_ebc283ccf1 FOREIGN KEY (snippet_id) REFERENCES snippets(id) ON DELETE CASCADE;
ALTER TABLE ONLY cluster_providers_aws
ADD CONSTRAINT fk_rails_ed1fdfaeb2 FOREIGN KEY (created_by_user_id) REFERENCES users(id) ON DELETE SET NULL;
ALTER TABLE ONLY project_security_settings
ADD CONSTRAINT fk_rails_ed4abe1338 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
......
......@@ -70,7 +70,7 @@ module EE
# override
def check_for_spam?
author.bot? || super
author.bot? && (title_changed? || description_changed? || confidential_changed?) || super
end
# override
......
---
title: Limit spam checks to title, description, or confidentiality changes on bot-created
issues
merge_request: 43463
author:
type: fixed
......@@ -346,6 +346,38 @@ RSpec.describe Issue do
end
end
describe '#check_for_spam?' do
using RSpec::Parameterized::TableSyntax
let_it_be(:reusable_project) { create(:project) }
let_it_be(:author) { ::User.support_bot }
where(:visibility_level, :confidential, :new_attributes, :check_for_spam?) do
Gitlab::VisibilityLevel::PUBLIC | false | { description: 'woo' } | true
Gitlab::VisibilityLevel::PUBLIC | false | { title: 'woo' } | true
Gitlab::VisibilityLevel::PUBLIC | true | { confidential: false } | true
Gitlab::VisibilityLevel::PUBLIC | true | { description: 'woo' } | true
Gitlab::VisibilityLevel::PUBLIC | false | { title: 'woo', confidential: true } | true
Gitlab::VisibilityLevel::INTERNAL | false | { description: 'woo' } | true
Gitlab::VisibilityLevel::PRIVATE | true | { description: 'woo' } | true
Gitlab::VisibilityLevel::PUBLIC | false | { description: 'original description' } | false
Gitlab::VisibilityLevel::PRIVATE | true | { weight: 3 } | false
end
with_them do
context 'when author is a bot' do
it 'only checks for spam when description, title, or confidential status is updated' do
project = reusable_project
project.update(visibility_level: visibility_level)
issue = create(:issue, project: project, confidential: confidential, description: 'original description', author: author)
issue.assign_attributes(new_attributes)
expect(issue.check_for_spam?).to eq(check_for_spam?)
end
end
end
end
describe '#weight' do
where(:license_value, :database_value, :expected) do
true | 5 | 5
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment