diff --git a/pagure/api/issue.py b/pagure/api/issue.py index 7462ea0..1ef6edf 100644 --- a/pagure/api/issue.py +++ b/pagure/api/issue.py @@ -837,6 +837,9 @@ def api_assign_issue(repo, issueid, username=None, namespace=None): ) SESSION.commit() output['message'] = message + except pagure.exceptions.PagureException as err: # pragma: no cover + raise pagure.exceptions.APIError( + 400, error_code=APIERROR.ENOCODE, error=str(err)) except SQLAlchemyError as err: # pragma: no cover SESSION.rollback() APP.logger.exception(err) diff --git a/pagure/forms.py b/pagure/forms.py index 71e6542..85b1768 100644 --- a/pagure/forms.py +++ b/pagure/forms.py @@ -416,7 +416,7 @@ class AssignIssueForm(PagureForm): ''' Form to assign an user to an issue. ''' assignee = wtforms.TextField( 'Assignee *', - [wtforms.validators.Required()] + [wtforms.validators.Optional()] ) diff --git a/pagure/lib/__init__.py b/pagure/lib/__init__.py index d100911..9cedfd6 100644 --- a/pagure/lib/__init__.py +++ b/pagure/lib/__init__.py @@ -386,7 +386,7 @@ def add_issue_assignee(session, issue, assignee, user, ticketfolder, ''' Add an assignee to an issue, in other words, assigned an issue. ''' user_obj = get_user(session, user) - if assignee is None and issue.assignee is not None: + if not assignee and issue.assignee is not None: issue.assignee_id = None issue.last_updated = datetime.datetime.utcnow() session.add(issue) @@ -415,8 +415,8 @@ def add_issue_assignee(session, issue, assignee, user, ticketfolder, {'unassigned': '-'})) return 'Assignee reset' - elif assignee is None and issue.assignee is None: - return + elif not assignee and issue.assignee is None: + return 'Nothing to change' # Validate the assignee assignee_obj = get_user(session, assignee) diff --git a/pagure/templates/issue.html b/pagure/templates/issue.html index 223c1de..51fa6d5 100644 --- a/pagure/templates/issue.html +++ b/pagure/templates/issue.html @@ -192,6 +192,12 @@ assignee=issue.assignee.username) }}"> {{ issue.assignee.username }} + {% if authenticated and (issue.assignee.username == g.fas_user.username) %} + + {% endif %} {% else %} unassigned {% endif %} @@ -698,6 +704,60 @@ function try_async_comment(form) { {% endif %}