From 1ec4d428a040ba6d3881285657777488a3e4754f Mon Sep 17 00:00:00 2001 From: davelopez <46503462+davelopez@users.noreply.github.com> Date: Thu, 4 Apr 2024 18:36:17 +0200 Subject: [PATCH] Ignore some inaccurate types from model mappings --- lib/galaxy/managers/notification.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/galaxy/managers/notification.py b/lib/galaxy/managers/notification.py index 6374b4dadf3..129d974b870 100644 --- a/lib/galaxy/managers/notification.py +++ b/lib/galaxy/managers/notification.py @@ -648,7 +648,7 @@ class MessageEmailNotificationTemplateBuilder(EmailNotificationTemplateBuilder): } def get_content(self, template_format: TemplateFormats) -> AnyNotificationContent: - content = MessageNotificationContent.model_construct(**self.notification.content) + content = MessageNotificationContent.model_construct(**self.notification.content) # type:ignore[arg-type] content.message = self.markdown_to[template_format](content.message) return content @@ -659,7 +659,7 @@ class MessageEmailNotificationTemplateBuilder(EmailNotificationTemplateBuilder): class NewSharedItemEmailNotificationTemplateBuilder(EmailNotificationTemplateBuilder): def get_content(self, template_format: TemplateFormats) -> AnyNotificationContent: - content = NewSharedItemNotificationContent.model_construct(**self.notification.content) + content = NewSharedItemNotificationContent.model_construct(**self.notification.content) # type:ignore[arg-type] return content def get_subject(self) -> str: @@ -677,7 +677,8 @@ class EmailNotificationChannelPlugin(NotificationChannelPlugin): def send(self, notification: Notification, user: User): try: - email_template_builder = self.email_templates_by_category.get(notification.category) + category = cast(PersonalNotificationCategory, notification.category) + email_template_builder = self.email_templates_by_category.get(category) if email_template_builder is None: log.warning(f"No email template found for notification category '{notification.category}'.") return