Closed GMayank0310 closed 5 days ago
The changes introduce a new feature allowing users to leave a bot, including email notifications to bot owners. The implementation consists of updates to the email templates, a new asynchronous endpoint in the user router, and modifications to the account processor. Additionally, a notification template for bot owners is added, along with corresponding tests to ensure the functionality works as intended.
File | Change Summary |
---|---|
email.yaml | Added member_left_bot_subject and member_left_bot_mail_body entries for notifications on user departures. |
kairon/api/app/routers/user.py | Introduced a new leave_bot asynchronous endpoint for users to leave a bot and send email notifications. |
kairon/shared/account/data_objects.py | Added leave_bot_owner_notification field to the MailTemplates class for storing leave notifications. |
kairon/shared/account/processor.py | Added process_leave_bot method to handle user leave logic and email template loading for notifications. |
kairon/shared/utils.py | Introduced __handle_member_left_bot method for email generation and updated format_and_send_mail function. |
template/emails/leaveBotOwnerNotification.html | Created an HTML template for bot owner notifications when a member leaves. |
tests/integration_test/services_test.py | Added tests for various scenarios related to leaving a bot, including success and failure cases. |
sequenceDiagram
participant User
participant UserRouter
participant AccountProcessor
participant MailUtility
participant EmailService
User->>UserRouter: Leave Bot Request
UserRouter->>AccountProcessor: process_leave_bot(bot, user)
AccountProcessor->>AccountProcessor: Validate User and Bot
AccountProcessor->>MailUtility: Prepare Email Notification
MailUtility->>EmailService: Send Email Notification
UserRouter-->>User: Success Response
🐇 In the fields of code so bright,
A user leaves with pure delight.
Notifications sent with care,
To bot owners everywhere!
With templates new and tests to run,
The changes made, oh what fun! 🌟
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Tests