Skip to content

Route mails to relevant approvers

dahyehayley edited this page Apr 7, 2025 · 3 revisions

https://github.com/NYU-RTS/rts-coldfront/pull/29 https://github.com/NYU-RTS/rts-coldfront/pull/30

  • [tasks.py](http://tasks.py) (expiry allocation mails)
    • Refactored send_expiry_emails by separating the logic into two distinct functions:
      1. send_expiring_mails() – handles notifications for allocations that are about to expire.
      2. send_expired_mails() – handles notifications for allocations that have already expired.
    • expiring soon:
      • Changes to send_expiring_mails logic:
      • Previous behavior: Iterated over all AllocationUser entries and sent emails based on user-specific roles in the allocation (e.g., if the user was linked to the project or allocation).
      • Updated behavior: Now directly queries for allocations that are expiring (based on EMAIL_ALLOCATION_EXPIRING_NOTIFICATION_DAYS), and sends notifications to:
        • Approvers whose approver_profile.schools include the allocation’s project school.
        • The PI (Principal Investigator) of the project.
    • expired:
      • Previous behavior: Iterated over all users and their associated AllocationUser entries to find expired allocations, sending notifications based on user involvement in the project.
      • Updated behavior: Now directly queries for allocations that expired yesterday, and sends notifications to:
          1. Approvers whose approver_profile.schools include the allocation’s project school.
          1. The PI (Principal Investigator) of the project.
  • [coldfront/core/utils/mail.py](https://github.com/NYU-RTS/rts-coldfront#diff-de2ac99e3e7af523acef8db66f625d319738cdf3781b00cb84916cfbec176bf6) (allocation creation mails)
    • Updated send_allocation_admin_email to send allocation creation emails only to approvers whose associated schools include the allocation's project school.
    • Improved flexibility of send_admin_email_template to take reciepint_list as optional