-
Notifications
You must be signed in to change notification settings - Fork 604
feat: split liaison_statement_posted mailtrigger into outgoing and incoming #9553
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
Conversation
aab922e to
a94cf67
Compare
|
Please put Then make sure migrations ran correctly in your dev instance and regenerate the names fixture with (You can find that using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again for helping. Comments inline.
Please let me know if the next set of changes aren't obvious.
| ) | ||
| liaison_posted_incoming.to.add(recipients_to) | ||
| liaison_posted_incoming.to.add(*recipients_cc) | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should remove liaison_statement_posted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have attempted to remove with
Mailtrigger.objects.filter(slug__in=("liaison_statement_posted")).delete()
| MailTrigger.objects.filter( | ||
| slug__in=("liaison_statement_posted_outgoing", "liaison_statement_posted_incoming") | ||
| ).delete() | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and this should add liaison_statement_posted back
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would you recommend adding this back inside reverse? NB fixture might still be marking liaison_statement_posted as active in this branch
ietf/mailtrigger/utils.py
Outdated
| return mailtrigger | ||
|
|
||
|
|
||
| def get_cc(group): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method name used to rely (too much) on the file it was in for context. With this move, it should be something like get_contacts_for_liaison_messages_for_group.
This and the function after it should be merged into one that pays attention to outgoing/incoming, or perhaps one should be named ...primary... and the other ...secondary...
Whether these contacts land in the to or the cc should be up to how the mailtriggers use them, so getting the notion of cc or to out of the name is important. (See the title of #9434).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've renamed the functions, would they still need outgoing/incoming separate from the mails logic if merged into one inside utils? CC comments need to be revised too.
ietf/mailtrigger/utils.py
Outdated
|
|
||
| return emails | ||
|
|
||
| def get_contacts_for_group(group): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly, this should be something like get_contacts_for_liaison_messages_for_group though that's getting a bit long.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(should have edited that before posting it to match the comments above. What's said at L77 is what's intended.)
| desc="Recipients for a message when a new outgoing liaison statement is posted", | ||
| ) | ||
| liaison_posted_outgoing.to.add(recipients_to) | ||
| liaison_posted_outgoing.cc.add(*recipients_cc) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #8271 - lets add the new Recipient liaison_from_contact to the cc for outgoing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also see the title of #9434 - lets see if we can make that move from cc to to with this migration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have added this to cc for outgoing and to for incoming, ty for noting parent issue
c8a241c to
f19a47e
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9553 +/- ##
=======================================
Coverage 88.86% 88.87%
=======================================
Files 319 319
Lines 41911 41925 +14
=======================================
+ Hits 37245 37260 +15
+ Misses 4666 4665 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you have time, please make this change, otherwise, we'll finish this out in the next few days.
| slug__in=("liaison_statement_posted_outgoing", "liaison_statement_posted_incoming") | ||
| ).delete() | ||
|
|
||
| Mailtrigger.objects.get( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be a create and the Recipient m2ms will have to be repopulated.
|
I've reworked the migration a bit. |
Fixes #9434