From e7eebb1400d986394aa404b4c3385ea452f9e92d Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jan 09 2017 11:20:47 +0000 Subject: If no assignee is provided, do not try updating the assignee field The method pagure.lib.add_issue_assignee() always returns a message, so if we call this method while there are no assignee provided, it returns a 'Nothing to change' message that we display to our user, while in fact things did change, just not the assignee. With this change, we no longer have this un-justified message. --- diff --git a/pagure/ui/issues.py b/pagure/ui/issues.py index 2a12cb4..e91573d 100644 --- a/pagure/ui/issues.py +++ b/pagure/ui/issues.py @@ -241,16 +241,17 @@ def update_issue(repo, issueid, username=None, namespace=None): # other fields will be missing for non-admin and thus reset if we let them if repo_admin: # Assign or update assignee of the ticket - message = pagure.lib.add_issue_assignee( - SESSION, - issue=issue, - assignee=assignee or None, - user=flask.g.fas_user.username, - ticketfolder=APP.config['TICKETS_FOLDER'], - ) - SESSION.commit() - if message: - messages.add(message) + if assignee: + message = pagure.lib.add_issue_assignee( + SESSION, + issue=issue, + assignee=assignee or None, + user=flask.g.fas_user.username, + ticketfolder=APP.config['TICKETS_FOLDER'], + ) + SESSION.commit() + if message: + messages.add(message) # Update priority if str(new_priority) in repo.priorities: