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
Emit a signal when a ticket is updated #1169
Conversation
…eated and updated)
Also added the signal to email.py, this way |
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.
Looks good - can you add a basic unit test to f=verify the webhook feature?
I already included tests for webhooks 🙂https://github.com/django-helpdesk/django-helpdesk/blob/main/helpdesk/tests/test_webhooks.py There is a second webhook that is triggered on ticket creation. It would be nice to go all the way and wire that through the signals as well. |
Yes, I used the test_webhooks to verify compliance, thanks Timothy! I knew you were going to ask. ;) |
The new ticket webhook is activated with a specific role, where a signal should be emitted no matter what.
Anyway, what I would do is place the signal close to the new ticket creation, which I think is the And use Does that sound OK to you? -- Looks like I don't need the created parameter because TicketForm is only used for the CreateTicketView. |
Looks good to me. Note that the send_new_ticket_webhook is now disconnected from the new_ticket_cc role. |
I put it in the "new_ticket_cc" location because the tickets are not created with the form when they are processed in email.py if I recall correctly. |
Thank you. |
Co-authored-by: Benbb96 <Benbb96@users.noreply.github.com>
@uhurusurfa I think this can be merged now. |
I have a use case where I need to follow the modifications of the tickets.
I unfortunately cannot hook to the post_save signal of the FollowUp model because at this time, the TicketChange and Ticket models are not updated yet with new data.
Someone added the
notify_followup_webhooks
function toupdate_ticket
for a similar purpose.In this PR, I propose to have the update_ticket function emit a signal when its process is done.
This way, anyone can hook post processing workflows outside of helpdesk.
Not to have duplicate code logic, I move the notify_followup_webhooks outside of update_ticket and have it listen to the ticket_update_done signal the same way someone would do it outside of helpdesk.