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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Don't try to use mail attribute if invalid
Oliver Günther934a8b500cd5
diff --git a/app/models/application_record.rb b/app/models/application_record.rbindex a08a72cab02..09cc72c52fd 100644--- a/app/models/application_record.rb+++ b/app/models/application_record.rb@@ -7,6 +7,14 @@ class ApplicationRecord < ::ActiveRecord::Basesaved_change_to_attribute?(:id)end+ ##+ # Returns whether the given attribute is free of errors+ def valid_attribute?(attribute)+ valid? # Ensure validations have run++ errors[attribute].empty?+ end+### Get the newest recently changed resource for the given record classes#diff --git a/app/services/users/set_attributes_service.rb b/app/services/users/set_attributes_service.rbindex 84d8f921ae2..ce27ce51020 100644--- a/app/services/users/set_attributes_service.rb+++ b/app/services/users/set_attributes_service.rb@@ -42,7 +42,7 @@ module Usersdef set_default_attributes(_params)# Assign values other than mail to new_user when invited- if model.invited? && model.mail.present?+ if model.invited? && model.valid_attribute?(:mail)::UserInvitation.assign_user_attributes modelend