kotowicz/django-helpdesk — comment on commit 11283741a23d6a1f31c3d4f14af45f3907640642
File: helpdesk/views/staff.py line 265
By kratorius:

I'm not completely sold on this. Is it actually possible in practice that `update_ticket` is called even if the ticket hasn't been changed? Because if even only one of the conditions above fails, the code that comes afterwards will still have to check each of them again to see what should be updated and what not.

Besides, the amount of nested 'if' is quite frightening. If I'm wrong in the above statement, would it be possible to rewrite it in another way? Perhaps even something like this could be of some help:

```python
no_changes = all([
not request.FILES,
not comment,
new_status == ticket.status,
title == ticket.title,
priority == int(ticket.priority),
(not owner and not ticket.assigned_to) or (owner and User.objects.get(id=owner) == ticket.assigned_to),
HAS_TAG_SUPPORT and tags == ticket.tags,
])
if no_changes:
return return_to_ticket(request.user, helpdesk_settings, ticket)
```