diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-04 09:09:50 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-04 09:09:50 +0300 |
commit | b6a194f6625042a09e083443c3326cc61aefc4c0 (patch) | |
tree | a7d03dda82b309254ab0333ead7b449fd7d1efa9 | |
parent | 44ca34ad66b8b7f54c0c8a8f549aafb7293c8a38 (diff) |
Add latest changes from gitlab-org/gitlab@master
29 files changed, 227 insertions, 42 deletions
diff --git a/app/assets/javascripts/vue_shared/components/project_avatar.vue b/app/assets/javascripts/vue_shared/components/project_avatar.vue index f65cc8bf2f3..3a279b93774 100644 --- a/app/assets/javascripts/vue_shared/components/project_avatar.vue +++ b/app/assets/javascripts/vue_shared/components/project_avatar.vue @@ -56,5 +56,6 @@ export default { :src="projectAvatarUrl" :alt="avatarAlt" :size="size" + :fallback-on-error="true" /> </template> diff --git a/app/assets/stylesheets/utilities.scss b/app/assets/stylesheets/utilities.scss index 267bd3f9506..08c4efce542 100644 --- a/app/assets/stylesheets/utilities.scss +++ b/app/assets/stylesheets/utilities.scss @@ -149,3 +149,7 @@ .gl-fill-orange-500 { fill: $orange-500; } + +.gl-fill-red-500 { + fill: $red-500; +} diff --git a/app/models/abuse_report.rb b/app/models/abuse_report.rb index 1384b7470ac..d35778046da 100644 --- a/app/models/abuse_report.rb +++ b/app/models/abuse_report.rb @@ -15,6 +15,8 @@ class AbuseReport < ApplicationRecord belongs_to :reporter, class_name: 'User' belongs_to :user + has_many :events, class_name: 'ResourceEvents::AbuseReportEvent', inverse_of: :abuse_report + validates :reporter, presence: true validates :user, presence: true validates :message, presence: true diff --git a/app/models/resource_events/abuse_report_event.rb b/app/models/resource_events/abuse_report_event.rb new file mode 100644 index 00000000000..0e0af8217fd --- /dev/null +++ b/app/models/resource_events/abuse_report_event.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +module ResourceEvents + class AbuseReportEvent < ApplicationRecord + belongs_to :abuse_report, optional: false + belongs_to :user + + validates :action, presence: true + + enum action: { + ban_user: 1, + block_user: 2, + delete_user: 3, + close_report: 4 + } + + enum reason: { + spam: 1, + offensive: 2, + phishing: 3, + crypto: 4, + credentials: 5, + copyright: 6, + malware: 7, + other: 8 + } + end +end diff --git a/config/feature_flags/development/do_not_run_safety_net_auth_refresh_jobs.yml b/config/feature_flags/development/do_not_run_safety_net_auth_refresh_jobs.yml index a7e34682278..94784f3facb 100644 --- a/config/feature_flags/development/do_not_run_safety_net_auth_refresh_jobs.yml +++ b/config/feature_flags/development/do_not_run_safety_net_auth_refresh_jobs.yml @@ -4,5 +4,5 @@ introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/110986 rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/390336 milestone: '15.9' type: development -group: group::tenant scale +group: group::authentication and authorization default_enabled: false diff --git a/db/docs/abuse_report_events.yml b/db/docs/abuse_report_events.yml new file mode 100644 index 00000000000..ea19a44c39d --- /dev/null +++ b/db/docs/abuse_report_events.yml @@ -0,0 +1,10 @@ +--- +table_name: abuse_report_events +classes: + - ResourceEvents::AbuseReportEvent +feature_categories: + - instance_resiliency +description: Stores actions taken on abuse reports. +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/119199 +milestone: "16.0" +gitlab_schema: gitlab_main diff --git a/db/docs/clusters_applications_jupyter.yml b/db/docs/deleted_tables/clusters_applications_jupyter.yml index 4955e8fe217..539cba27bd9 100644 --- a/db/docs/clusters_applications_jupyter.yml +++ b/db/docs/deleted_tables/clusters_applications_jupyter.yml @@ -6,3 +6,5 @@ description: "(Deprecated) A GitLab managed Jupyter installation in a Kubernetes introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/db9f765852d9fef464e69c0bf47a382f2ab7219d milestone: '11.0' gitlab_schema: gitlab_main +removed_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/119469 +removed_in_milestone: '16.0' diff --git a/db/migrate/20230428101217_create_abuse_report_events.rb b/db/migrate/20230428101217_create_abuse_report_events.rb new file mode 100644 index 00000000000..78395955eaf --- /dev/null +++ b/db/migrate/20230428101217_create_abuse_report_events.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +class CreateAbuseReportEvents < Gitlab::Database::Migration[2.1] + def change + create_table :abuse_report_events do |t| + t.bigint :abuse_report_id, null: false, index: true + t.bigint :user_id, index: true + t.datetime_with_timezone :created_at, null: false + t.integer :action, limit: 2, null: false, default: 1 + t.integer :reason, limit: 2 + t.text :comment, limit: 1024 + end + end +end diff --git a/db/migrate/20230501111636_add_users_fk_to_abuse_report_events.rb b/db/migrate/20230501111636_add_users_fk_to_abuse_report_events.rb new file mode 100644 index 00000000000..d721bc6bc7c --- /dev/null +++ b/db/migrate/20230501111636_add_users_fk_to_abuse_report_events.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddUsersFkToAbuseReportEvents < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :abuse_report_events, + :users, + column: :user_id, + on_delete: :nullify + end + + def down + with_lock_retries do + remove_foreign_key_if_exists :abuse_report_events, column: :user_id + end + end +end diff --git a/db/migrate/20230502083003_add_abuse_reports_fk_to_abuse_report_events.rb b/db/migrate/20230502083003_add_abuse_reports_fk_to_abuse_report_events.rb new file mode 100644 index 00000000000..3b71867f337 --- /dev/null +++ b/db/migrate/20230502083003_add_abuse_reports_fk_to_abuse_report_events.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddAbuseReportsFkToAbuseReportEvents < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :abuse_report_events, + :abuse_reports, + column: :abuse_report_id, + on_delete: :cascade + end + + def down + with_lock_retries do + remove_foreign_key_if_exists :abuse_report_events, column: :abuse_report_id + end + end +end diff --git a/db/post_migrate/20230503115918_drop_clusters_applications_jupyter.rb b/db/post_migrate/20230503115918_drop_clusters_applications_jupyter.rb new file mode 100644 index 00000000000..3c2a0cc3ee8 --- /dev/null +++ b/db/post_migrate/20230503115918_drop_clusters_applications_jupyter.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +# See https://docs.gitlab.com/ee/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class DropClustersApplicationsJupyter < Gitlab::Database::Migration[2.1] + def up + drop_table :clusters_applications_jupyter + end + + # Based on init schema: + # https://gitlab.com/gitlab-org/gitlab/-/blob/b237f836df215a4ada92b9406733e6cd2483ca2d/db/migrate/20181228175414_init_schema.rb#L717-L728 + # rubocop:disable Migration/SchemaAdditionMethodsNoPost + def down + create_table "clusters_applications_jupyter", id: :serial, force: :cascade do |t| + t.integer "cluster_id", null: false + t.integer "oauth_application_id" + t.integer "status", null: false + t.string "version", null: false + t.string "hostname" + t.datetime_with_timezone "created_at", null: false + t.datetime_with_timezone "updated_at", null: false + t.text "status_reason" + t.index ["cluster_id"], name: "index_clusters_applications_jupyter_on_cluster_id", unique: true + t.index ["oauth_application_id"], name: "index_clusters_applications_jupyter_on_oauth_application_id" + end + end + # rubocop:enable Migration/SchemaAdditionMethodsNoPost +end diff --git a/db/schema_migrations/20230428101217 b/db/schema_migrations/20230428101217 new file mode 100644 index 00000000000..9e22a997a41 --- /dev/null +++ b/db/schema_migrations/20230428101217 @@ -0,0 +1 @@ +600258b230518791e57a8a9934d573dcc4734275c346b1dbcff6931d1d549574
\ No newline at end of file diff --git a/db/schema_migrations/20230501111636 b/db/schema_migrations/20230501111636 new file mode 100644 index 00000000000..77570c78964 --- /dev/null +++ b/db/schema_migrations/20230501111636 @@ -0,0 +1 @@ +1ba16001c05873a7fbda732d0d34b1d42d8c05d883f2f48b37305c31b955b103
\ No newline at end of file diff --git a/db/schema_migrations/20230502083003 b/db/schema_migrations/20230502083003 new file mode 100644 index 00000000000..6bc23ce73ca --- /dev/null +++ b/db/schema_migrations/20230502083003 @@ -0,0 +1 @@ +fabae67014e7d212e2537185c2cd21a0660398d8e423a3b4744773eb67047b57
\ No newline at end of file diff --git a/db/schema_migrations/20230503115918 b/db/schema_migrations/20230503115918 new file mode 100644 index 00000000000..328d5e5b255 --- /dev/null +++ b/db/schema_migrations/20230503115918 @@ -0,0 +1 @@ +e5368a0d203bdf66e8808b2c1555ba4321a41755af09ec899e28f1ea8d6e02a7
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index bbf8d5dc287..a5bf3bd3829 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -10749,6 +10749,26 @@ CREATE TABLE gitlab_partitions_static.product_analytics_events_experimental_63 ( ); ALTER TABLE ONLY product_analytics_events_experimental ATTACH PARTITION gitlab_partitions_static.product_analytics_events_experimental_63 FOR VALUES WITH (modulus 64, remainder 63); +CREATE TABLE abuse_report_events ( + id bigint NOT NULL, + abuse_report_id bigint NOT NULL, + user_id bigint, + created_at timestamp with time zone NOT NULL, + action smallint DEFAULT 1 NOT NULL, + reason smallint, + comment text, + CONSTRAINT check_bb4cd85618 CHECK ((char_length(comment) <= 1024)) +); + +CREATE SEQUENCE abuse_report_events_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE abuse_report_events_id_seq OWNED BY abuse_report_events.id; + CREATE TABLE abuse_reports ( id integer NOT NULL, reporter_id integer, @@ -14433,27 +14453,6 @@ CREATE SEQUENCE clusters_applications_ingress_id_seq ALTER SEQUENCE clusters_applications_ingress_id_seq OWNED BY clusters_applications_ingress.id; -CREATE TABLE clusters_applications_jupyter ( - id integer NOT NULL, - cluster_id integer NOT NULL, - oauth_application_id integer, - status integer NOT NULL, - version character varying NOT NULL, - hostname character varying, - created_at timestamp with time zone NOT NULL, - updated_at timestamp with time zone NOT NULL, - status_reason text -); - -CREATE SEQUENCE clusters_applications_jupyter_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - -ALTER SEQUENCE clusters_applications_jupyter_id_seq OWNED BY clusters_applications_jupyter.id; - CREATE TABLE clusters_applications_knative ( id integer NOT NULL, cluster_id integer NOT NULL, @@ -24787,6 +24786,8 @@ CREATE SEQUENCE zoom_meetings_id_seq ALTER SEQUENCE zoom_meetings_id_seq OWNED BY zoom_meetings.id; +ALTER TABLE ONLY abuse_report_events ALTER COLUMN id SET DEFAULT nextval('abuse_report_events_id_seq'::regclass); + ALTER TABLE ONLY abuse_reports ALTER COLUMN id SET DEFAULT nextval('abuse_reports_id_seq'::regclass); ALTER TABLE ONLY abuse_trust_scores ALTER COLUMN id SET DEFAULT nextval('abuse_trust_scores_id_seq'::regclass); @@ -25061,8 +25062,6 @@ ALTER TABLE ONLY clusters_applications_helm ALTER COLUMN id SET DEFAULT nextval( ALTER TABLE ONLY clusters_applications_ingress ALTER COLUMN id SET DEFAULT nextval('clusters_applications_ingress_id_seq'::regclass); -ALTER TABLE ONLY clusters_applications_jupyter ALTER COLUMN id SET DEFAULT nextval('clusters_applications_jupyter_id_seq'::regclass); - ALTER TABLE ONLY clusters_applications_knative ALTER COLUMN id SET DEFAULT nextval('clusters_applications_knative_id_seq'::regclass); ALTER TABLE ONLY clusters_applications_prometheus ALTER COLUMN id SET DEFAULT nextval('clusters_applications_prometheus_id_seq'::regclass); @@ -26501,6 +26500,9 @@ ALTER TABLE ONLY gitlab_partitions_static.product_analytics_events_experimental_ ALTER TABLE ONLY gitlab_partitions_static.product_analytics_events_experimental_63 ADD CONSTRAINT product_analytics_events_experimental_63_pkey PRIMARY KEY (id, project_id); +ALTER TABLE ONLY abuse_report_events + ADD CONSTRAINT abuse_report_events_pkey PRIMARY KEY (id); + ALTER TABLE ONLY abuse_reports ADD CONSTRAINT abuse_reports_pkey PRIMARY KEY (id); @@ -26975,9 +26977,6 @@ ALTER TABLE ONLY clusters_applications_helm ALTER TABLE ONLY clusters_applications_ingress ADD CONSTRAINT clusters_applications_ingress_pkey PRIMARY KEY (id); -ALTER TABLE ONLY clusters_applications_jupyter - ADD CONSTRAINT clusters_applications_jupyter_pkey PRIMARY KEY (id); - ALTER TABLE ONLY clusters_applications_knative ADD CONSTRAINT clusters_applications_knative_pkey PRIMARY KEY (id); @@ -29693,6 +29692,10 @@ CREATE INDEX idx_vulnerability_reads_project_id_scanner_id_vulnerability_id ON v CREATE UNIQUE INDEX idx_work_item_types_on_namespace_id_and_name_null_namespace ON work_item_types USING btree (btrim(lower(name)), ((namespace_id IS NULL))) WHERE (namespace_id IS NULL); +CREATE INDEX index_abuse_report_events_on_abuse_report_id ON abuse_report_events USING btree (abuse_report_id); + +CREATE INDEX index_abuse_report_events_on_user_id ON abuse_report_events USING btree (user_id); + CREATE INDEX index_abuse_reports_on_status_and_created_at ON abuse_reports USING btree (status, created_at); CREATE INDEX index_abuse_reports_on_status_and_id ON abuse_reports USING btree (status, id); @@ -30415,10 +30418,6 @@ CREATE UNIQUE INDEX index_clusters_applications_helm_on_cluster_id ON clusters_a CREATE UNIQUE INDEX index_clusters_applications_ingress_on_cluster_id ON clusters_applications_ingress USING btree (cluster_id); -CREATE UNIQUE INDEX index_clusters_applications_jupyter_on_cluster_id ON clusters_applications_jupyter USING btree (cluster_id); - -CREATE INDEX index_clusters_applications_jupyter_on_oauth_application_id ON clusters_applications_jupyter USING btree (oauth_application_id); - CREATE UNIQUE INDEX index_clusters_applications_knative_on_cluster_id ON clusters_applications_knative USING btree (cluster_id); CREATE UNIQUE INDEX index_clusters_applications_prometheus_on_cluster_id ON clusters_applications_prometheus USING btree (cluster_id); @@ -34771,6 +34770,9 @@ ALTER TABLE ONLY incident_management_timeline_events ALTER TABLE ONLY project_features ADD CONSTRAINT fk_18513d9b92 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; +ALTER TABLE ONLY abuse_report_events + ADD CONSTRAINT fk_18c774c06b FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL; + ALTER TABLE ONLY ci_pipelines ADD CONSTRAINT fk_190998ef09 FOREIGN KEY (external_pull_request_id) REFERENCES external_pull_requests(id) ON DELETE SET NULL; @@ -35671,6 +35673,9 @@ ALTER TABLE ONLY system_note_metadata ALTER TABLE ONLY vulnerability_remediations ADD CONSTRAINT fk_fc61a535a0 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; +ALTER TABLE ONLY abuse_report_events + ADD CONSTRAINT fk_fdd4d610e0 FOREIGN KEY (abuse_report_id) REFERENCES abuse_reports(id) ON DELETE CASCADE; + ALTER TABLE ONLY project_import_data ADD CONSTRAINT fk_ffb9ee3a10 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; diff --git a/lib/gitlab/ci/templates/Jobs/DAST-Default-Branch-Deploy.gitlab-ci.yml b/lib/gitlab/ci/templates/Jobs/DAST-Default-Branch-Deploy.gitlab-ci.yml index 48ec7577b6a..4ee5fa74df9 100644 --- a/lib/gitlab/ci/templates/Jobs/DAST-Default-Branch-Deploy.gitlab-ci.yml +++ b/lib/gitlab/ci/templates/Jobs/DAST-Default-Branch-Deploy.gitlab-ci.yml @@ -1,5 +1,5 @@ variables: - DAST_AUTO_DEPLOY_IMAGE_VERSION: 'v2.48.1' + DAST_AUTO_DEPLOY_IMAGE_VERSION: 'v2.48.2' .dast-auto-deploy: image: "${CI_TEMPLATE_REGISTRY_HOST}/gitlab-org/cluster-integration/auto-deploy-image:${DAST_AUTO_DEPLOY_IMAGE_VERSION}" diff --git a/lib/gitlab/ci/templates/Jobs/Deploy.gitlab-ci.yml b/lib/gitlab/ci/templates/Jobs/Deploy.gitlab-ci.yml index e535b9e9ffc..622b44d78ad 100644 --- a/lib/gitlab/ci/templates/Jobs/Deploy.gitlab-ci.yml +++ b/lib/gitlab/ci/templates/Jobs/Deploy.gitlab-ci.yml @@ -1,5 +1,5 @@ variables: - AUTO_DEPLOY_IMAGE_VERSION: 'v2.48.1' + AUTO_DEPLOY_IMAGE_VERSION: 'v2.48.2' .auto-deploy: image: "${CI_TEMPLATE_REGISTRY_HOST}/gitlab-org/cluster-integration/auto-deploy-image:${AUTO_DEPLOY_IMAGE_VERSION}" diff --git a/lib/gitlab/ci/templates/Jobs/Deploy.latest.gitlab-ci.yml b/lib/gitlab/ci/templates/Jobs/Deploy.latest.gitlab-ci.yml index ed16b4861b3..2954ddf8a35 100644 --- a/lib/gitlab/ci/templates/Jobs/Deploy.latest.gitlab-ci.yml +++ b/lib/gitlab/ci/templates/Jobs/Deploy.latest.gitlab-ci.yml @@ -1,5 +1,5 @@ variables: - AUTO_DEPLOY_IMAGE_VERSION: 'v2.48.1' + AUTO_DEPLOY_IMAGE_VERSION: 'v2.48.2' .auto-deploy: image: "${CI_TEMPLATE_REGISTRY_HOST}/gitlab-org/cluster-integration/auto-deploy-image:${AUTO_DEPLOY_IMAGE_VERSION}" diff --git a/locale/gitlab.pot b/locale/gitlab.pot index bfdefb4c8dc..77ad8d29440 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -45283,9 +45283,6 @@ msgstr "" msgid "There was a problem updating the keep latest artifacts setting." msgstr "" -msgid "There was an error adding a To Do." -msgstr "" - msgid "There was an error creating the dashboard, branch name is invalid." msgstr "" @@ -45295,9 +45292,6 @@ msgstr "" msgid "There was an error creating the issue" msgstr "" -msgid "There was an error deleting the To Do." -msgstr "" - msgid "There was an error fetching configuration for charts" msgstr "" @@ -50853,6 +50847,9 @@ msgstr "" msgid "Workspaces|Terminate" msgstr "" +msgid "Workspaces|Terminated" +msgstr "" + msgid "Workspaces|Terminating" msgstr "" diff --git a/spec/db/schema_spec.rb b/spec/db/schema_spec.rb index 54f894c0436..d9f5248aa2e 100644 --- a/spec/db/schema_spec.rb +++ b/spec/db/schema_spec.rb @@ -26,7 +26,6 @@ RSpec.describe 'Database schema', feature_category: :database do clusters_applications_crossplane: %w[cluster_id], clusters_applications_helm: %w[cluster_id], clusters_applications_ingress: %w[cluster_id], - clusters_applications_jupyter: %w[cluster_id oauth_application_id], clusters_applications_knative: %w[cluster_id], clusters_applications_prometheus: %w[cluster_id], clusters_applications_runners: %w[cluster_id], diff --git a/spec/factories/resource_events/abuse_report_events.rb b/spec/factories/resource_events/abuse_report_events.rb new file mode 100644 index 00000000000..0771a37f01b --- /dev/null +++ b/spec/factories/resource_events/abuse_report_events.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +FactoryBot.define do + factory :abuse_report_event, class: 'ResourceEvents::AbuseReportEvent' do + action { :ban_user } + abuse_report + user + end +end diff --git a/spec/features/projects/work_items/work_item_spec.rb b/spec/features/projects/work_items/work_item_spec.rb index 5f7163ed9af..d202f6ad500 100644 --- a/spec/features/projects/work_items/work_item_spec.rb +++ b/spec/features/projects/work_items/work_item_spec.rb @@ -3,8 +3,9 @@ require 'spec_helper' RSpec.describe 'Work item', :js, feature_category: :team_planning do + let_it_be_with_reload(:user) { create(:user) } + let_it_be(:project) { create(:project, :public) } - let_it_be(:user) { create(:user) } let_it_be(:work_item) { create(:work_item, project: project) } let_it_be(:milestone) { create(:milestone, project: project) } let_it_be(:milestones) { create_list(:milestone, 25, project: project) } diff --git a/spec/frontend/vue_shared/components/project_avatar_spec.js b/spec/frontend/vue_shared/components/project_avatar_spec.js index 9378f6e3f1b..330ff001db9 100644 --- a/spec/frontend/vue_shared/components/project_avatar_spec.js +++ b/spec/frontend/vue_shared/components/project_avatar_spec.js @@ -25,6 +25,7 @@ describe('ProjectAvatar', () => { entityName: defaultProps.projectName, size: 32, src: '', + fallbackOnError: true, }); }); diff --git a/spec/models/abuse_report_spec.rb b/spec/models/abuse_report_spec.rb index 6e678127aff..edfac39728f 100644 --- a/spec/models/abuse_report_spec.rb +++ b/spec/models/abuse_report_spec.rb @@ -15,6 +15,7 @@ RSpec.describe AbuseReport, feature_category: :insider_threat do describe 'associations' do it { is_expected.to belong_to(:reporter).class_name('User') } it { is_expected.to belong_to(:user) } + it { is_expected.to have_many(:events).class_name('ResourceEvents::AbuseReportEvent').inverse_of(:abuse_report) } it "aliases reporter to author" do expect(subject.author).to be(subject.reporter) diff --git a/spec/models/resource_events/abuse_report_event_spec.rb b/spec/models/resource_events/abuse_report_event_spec.rb new file mode 100644 index 00000000000..1c709ae4f21 --- /dev/null +++ b/spec/models/resource_events/abuse_report_event_spec.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe ResourceEvents::AbuseReportEvent, feature_category: :instance_resiliency, type: :model do + subject(:event) { build(:abuse_report_event) } + + describe 'associations' do + it { is_expected.to belong_to(:abuse_report).required } + it { is_expected.to belong_to(:user).optional } + end + + describe 'validations' do + it { is_expected.to be_valid } + it { is_expected.to validate_presence_of(:action) } + end +end diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb index 4ebc79b6390..ae843e234af 100644 --- a/spec/requests/api/projects_spec.rb +++ b/spec/requests/api/projects_spec.rb @@ -3513,6 +3513,18 @@ RSpec.describe API::Projects, :aggregate_failures, feature_category: :projects d expect(response).to have_gitlab_http_status(:conflict) end + + context 'when project is forked' do + let(:forked_project) { fork_project(project) } + let(:path) { "/projects/#{forked_project.id}/share" } + + it 'returns a 404 error when group does not exist' do + forked_project.add_maintainer(user) + post api(path, user), params: { group_id: non_existing_record_id, group_access: Gitlab::Access::DEVELOPER } + + expect(response).to have_gitlab_http_status(:not_found) + end + end end describe 'DELETE /projects/:id/share/:group_id' do diff --git a/workhorse/internal/upstream/routes.go b/workhorse/internal/upstream/routes.go index 8f9d056b8f3..c5af9dc3f00 100644 --- a/workhorse/internal/upstream/routes.go +++ b/workhorse/internal/upstream/routes.go @@ -406,6 +406,8 @@ func configureRoutes(u *upstream) { u.route("", "^/api/v4/geo_replication", defaultUpstream), u.route("", "^/api/v4/geo/proxy_git_ssh", defaultUpstream), u.route("", "^/api/v4/geo/graphql", defaultUpstream), + u.route("", "^/api/v4/geo_nodes/current/failures", defaultUpstream), + u.route("", "^/api/v4/geo_sites/current/failures", defaultUpstream), // Internal API routes u.route("", "^/api/v4/internal", defaultUpstream), diff --git a/workhorse/internal/upstream/routes_test.go b/workhorse/internal/upstream/routes_test.go index 8a032519bdf..13c000bf791 100644 --- a/workhorse/internal/upstream/routes_test.go +++ b/workhorse/internal/upstream/routes_test.go @@ -22,6 +22,17 @@ func TestAdminGeoPathsWithGeoProxy(t *testing.T) { runTestCasesWithGeoProxyEnabled(t, testCases) } +func TestApiGeoPathsWithGeoProxy(t *testing.T) { + testCases := []testCase{ + {"Geo replication endpoint", "/api/v4/geo_replication", "Local Rails server received request to path /api/v4/geo_replication"}, + {"Geo GraphQL endpoint", "/api/v4/geo/graphql", "Local Rails server received request to path /api/v4/geo/graphql"}, + {"Current geo node failures", "/api/v4/geo_nodes/current/failures", "Local Rails server received request to path /api/v4/geo_nodes/current/failures"}, + {"Current geo sites failures", "/api/v4/geo_sites/current/failures", "Local Rails server received request to path /api/v4/geo_sites/current/failures"}, + } + + runTestCasesWithGeoProxyEnabled(t, testCases) +} + func TestProjectNotExistingGitHttpPullWithGeoProxy(t *testing.T) { testCases := []testCase{ {"secondary info/refs", "/group/project.git/info/refs", "Local Rails server received request to path /group/project.git/info/refs"}, |