From 2ed1cf1f2532253edf254386e6ecc2e98aaf1998 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jarka=20Ko=C5=A1anov=C3=A1?= Date: Wed, 17 Sep 2025 11:52:03 +0200 Subject: [PATCH] Validate presence of organization_id --- app/models/admin/abuse_report_assignee.rb | 1 + spec/models/admin/abuse_report_assignee_spec.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/app/models/admin/abuse_report_assignee.rb b/app/models/admin/abuse_report_assignee.rb index efca8fac4fb7ba..e9d251d0f71065 100644 --- a/app/models/admin/abuse_report_assignee.rb +++ b/app/models/admin/abuse_report_assignee.rb @@ -9,5 +9,6 @@ class AbuseReportAssignee < ApplicationRecord belongs_to :assignee, class_name: "User", foreign_key: :user_id, inverse_of: :admin_abuse_report_assignees validates :assignee, uniqueness: { scope: :abuse_report_id } + validates :organization_id, presence: true end end diff --git a/spec/models/admin/abuse_report_assignee_spec.rb b/spec/models/admin/abuse_report_assignee_spec.rb index 4c941d8b7cba76..371414c460d298 100644 --- a/spec/models/admin/abuse_report_assignee_spec.rb +++ b/spec/models/admin/abuse_report_assignee_spec.rb @@ -19,6 +19,7 @@ describe 'validations' do it { is_expected.to validate_uniqueness_of(:assignee).scoped_to(:abuse_report_id) } + it { is_expected.to validate_presence_of(:organization_id) } end context 'with loose foreign key on abuse_report_assignees.user_id' do -- GitLab