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
Add helper to look for an error key in the ServiceResult errors
Oliver Günther2ef33d2a3a17
diff --git a/app/controllers/concerns/accounts/omniauth_login.rb b/app/controllers/concerns/accounts/omniauth_login.rbindex af420a04ea7..20e8a6dbefe 100644--- a/app/controllers/concerns/accounts/omniauth_login.rb+++ b/app/controllers/concerns/accounts/omniauth_login.rb@@ -90,7 +90,7 @@ module Accounts::OmniauthLoginif call.success?login_user_if_active(call.result)- elsif call.errors[:user].any?+ elsif call.includes_error?(:base, :failed_to_activate)redirect_omniauth_register_modal(call.result, auth_hash)elseerror = call.messagediff --git a/app/services/service_result.rb b/app/services/service_result.rbindex 0ff2b1ae690..528b3abb491 100644--- a/app/services/service_result.rb+++ b/app/services/service_result.rb@@ -94,6 +94,15 @@ class ServiceResult[errors] + dependent_results.map(&:errors)end+ ##+ # Test whether the returned errors respond+ # to the search key+ def includes_error?(attribute, error_key)+ all_errors.any? do |error|+ error.symbols_for(attribute).include?(error_key)+ end+ end+### Collect all present errors for the given result# and dependent results.