def send(self) -> None: if not self.should_email(): return participants_by_provider = self.get_participants_with_group_subscription_reason() if not participants_by_provider: return # Only calculate shared context once. shared_context = self.get_context() for provider, participants_with_reasons in participants_by_provider.items(): participants, extra_context = split_participants_and_context(participants_with_reasons) notify(provider, self, participants, shared_context, extra_context)
def send_activity_notification( notification: ActivityNotification | UserReportNotification) -> None: if not notification.should_email(): return participants_by_provider = notification.get_participants_with_group_subscription_reason( ) if not participants_by_provider: return # Only calculate shared context once. shared_context = notification.get_context() for provider, participants_with_reasons in participants_by_provider.items( ): participants_, extra_context = split_participants_and_context( participants_with_reasons) notify(provider, notification, participants_, shared_context, extra_context)