Skip to content

handle Zendesk ticket deletions#7569

Open
escattone wants to merge 2 commits into
mozilla:mainfrom
escattone:handle-deleted-zendesk-tickets-3085
Open

handle Zendesk ticket deletions#7569
escattone wants to merge 2 commits into
mozilla:mainfrom
escattone:handle-deleted-zendesk-tickets-3085

Conversation

@escattone

@escattone escattone commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

@escattone escattone requested a review from akatsoulas June 4, 2026 23:51
@escattone escattone force-pushed the handle-deleted-zendesk-tickets-3085 branch 4 times, most recently from cffe85d to f5f71dd Compare June 8, 2026 15:22
@escattone escattone force-pushed the handle-deleted-zendesk-tickets-3085 branch from f5f71dd to 08926f3 Compare June 8, 2026 18:50
self.assertIn("Test Subject", str_repr)
self.assertIn("processing_failed", str_repr)

def test_is_zendesk_deleted_reflects_zd_deleted_at(self):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is not needed - it's testing the language and not the behavior

Comment thread kitsune/customercare/tasks.py Outdated

zd_ticket, zd_comments = fetch_zendesk_ticket_data(str(ticket_id))
try:
ticket = qs.filter(zd_deleted_at__isnull=True).get()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that we introduce more cases on when it's appropriate to sync the tickets, I wonder if we need a manager to handle that. We could very well override the default manager in the model. This will allow us to make changes on what's updated in a single place

Comment thread kitsune/customercare/models.py Outdated
return "direct_support"

@property
def is_zendesk_deleted(self):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although having a timestamp makes a lot of sense and adds metadata that we can potentially need, this property also introduces another way of querying about the status of the ticket. Status should only be reflected by the status choices.

With this new addition, the status of a ticket is only derived by looking at two places and it adds complexity to templates and queries. A potential solution could be here either to collapse this into the statuses or use managers in a single place to get the right tickets

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. Since Zendesk doesn't have a "deleted" status, I'd rather not fold that into zd_status, but I'll look into a clean solution.

self.assertIsNotNone(self.ticket.zd_deleted_at)

@patch("kitsune.customercare.tasks.sync_ticket_from_zendesk")
def test_permanently_deleted_marks_ticket_deleted(self, mock_sync):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also drop this

@escattone escattone requested a review from akatsoulas June 10, 2026 00:08
@escattone

Copy link
Copy Markdown
Contributor Author

@akatsoulas Ready for another review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants