Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Re-introduce validation

Klaus Zanders70afa1658fce
diff --git a/app/models/member.rb b/app/models/member.rb
index c77b3a6d425..6e557b64918 100644
--- a/app/models/member.rb
+++ b/app/models/member.rb
@@ -46,6 +46,7 @@ class Member < ApplicationRecord
validates :entity_type, inclusion: { in: ALLOWED_ENTITIES, allow_blank: true }
validate :validate_presence_of_role
+ validate :validate_presence_of_principal
scopes :assignable,
:global,
@@ -109,6 +110,10 @@ class Member < ApplicationRecord
end
end
+ def validate_presence_of_principal
+ errors.add :base, :principal_blank if principal.blank?
+ end
+
private
def user?