From 6b98f21300f63cbf53fe9fff1dd2f3b9353d3c07 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 5 Apr 2023 09:59:22 +0200 Subject: [PATCH] (bug) list supporting documents types for a deleted group --- CHANGELOG.md | 1 + app/services/supporting_document_type_service.rb | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aabf2067a..56a8a2db7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ - Italian language support (credits to https://crowdin.com/profile/olazzari) - Improved error message on payzen misconfigured currency - Improved reporting error messages in UI, from ruby exceptions +- Fix a bug: unable to list supporting documents types for a deleted group - Fix a bug: notification is broken when updating payzen currency - Fix a bug: broken admin notifications if an order has been paid - Fix a bug: unable to bulk update settings diff --git a/app/services/supporting_document_type_service.rb b/app/services/supporting_document_type_service.rb index aedff7fd8..e393a464d 100644 --- a/app/services/supporting_document_type_service.rb +++ b/app/services/supporting_document_type_service.rb @@ -4,7 +4,9 @@ class SupportingDocumentTypeService def self.list(filters = {}) if filters[:group_id].present? - group = Group.find(filters[:group_id]) + group = Group.find_by(id: filters[:group_id]) + return nil if group.nil? + group.supporting_document_types.includes(:groups) else SupportingDocumentType.all