Skip to content

Commit

Permalink
Make all default send_* funcs return result of `<message_class>.sen…
Browse files Browse the repository at this point in the history
…d()` (#277)

Right now 2 implicitly return this already, and 2 explicitly only return `True` if it gets that far.

Note that the `modeled.ModelInvitation`'s version already does exactly this explicitly.
  • Loading branch information
mgrdcm authored Jun 11, 2024
1 parent 61373ae commit 12063d1
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/organizations/backends/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def send_reminder(self, user, sender=None, **kwargs):
return False
token = PasswordResetTokenGenerator().make_token(user)
kwargs.update({"token": token})
self.email_message(
return self.email_message(
user, self.reminder_subject, self.reminder_body, sender, **kwargs
).send()

Expand Down Expand Up @@ -230,7 +230,7 @@ def send_activation(self, user, sender=None, **kwargs):
return False
token = self.get_token(user)
kwargs.update({"token": token})
self.email_message(
return self.email_message(
user, self.activation_subject, self.activation_body, sender, **kwargs
).send()

Expand Down Expand Up @@ -337,10 +337,9 @@ def send_invitation(self, user, sender=None, **kwargs):
return False
token = self.get_token(user)
kwargs.update({"token": token})
self.email_message(
return self.email_message(
user, self.invitation_subject, self.invitation_body, sender, **kwargs
).send()
return True

def send_notification(self, user, sender=None, **kwargs):
"""
Expand All @@ -350,7 +349,6 @@ def send_notification(self, user, sender=None, **kwargs):
"""
if not user.is_active:
return False
self.email_message(
return self.email_message(
user, self.notification_subject, self.notification_body, sender, **kwargs
).send()
return True

0 comments on commit 12063d1

Please sign in to comment.