Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Krist/be 443 configure notifications #107

Merged
merged 40 commits into from
Jan 31, 2025

Conversation

SilvyPuzzlewell
Copy link
Collaborator

No description provided.

@SilvyPuzzlewell SilvyPuzzlewell marked this pull request as draft January 14, 2025 13:11
@SilvyPuzzlewell SilvyPuzzlewell marked this pull request as ready for review January 28, 2025 13:04
app.config["NOTIFICATION_RECIPIENTS_RESOLVERS"] = always_merger.merge(
app_registered_event_types, config.NOTIFICATION_RECIPIENTS_RESOLVERS
)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably the alwaysmerge is not a correct solution - should replace a value only if it is not already there, not always



class SpecificEntityRecipient(RecipientGenerator):

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please a docstring here

class UserEmailRecipient(SpecificEntityRecipient):
"""User email recipient generator for a notification."""

def __call__(self, notification: Notification, recipients: dict):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd change the methods place:

  1. Put call into SpecificEntityRecipient - will call the _resolve_entity method and then call self._get_recipients(entity) -> Iterator[Recipient]
  2. Subclasses would implement the abstract _get_recipients

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so in this case, the impl would be:

def _get_recipients(self, entity: User):
  return Recipient(data={"email": entity.email})

@mesemus mesemus merged commit 3e6853e into main Jan 31, 2025
4 checks passed
@mesemus mesemus deleted the krist/be-443-configure-notifications branch January 31, 2025 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants