diff --git a/progit/lib.py b/progit/lib.py index 0e1f3a0..097ac6d 100644 --- a/progit/lib.py +++ b/progit/lib.py @@ -250,6 +250,10 @@ def add_issue_assignee(session, issue, assignee, user, ticketfolder): session.flush() update_git_ticket( issue, repo=issue.project, ticketfolder=ticketfolder) + + globalid = get_issue_global_id(session, issue.project.id, issue.id) + progit.notify.notify_assigned_issue(issue, globalid) + return 'Issue assigned' diff --git a/progit/notify.py b/progit/notify.py index 5b26921..29c2ded 100644 --- a/progit/notify.py +++ b/progit/notify.py @@ -131,6 +131,37 @@ New issue: ) +def notify_assigned_issue(issue, globalib): + ''' Notify the people following an issue that the assignee changed. + ''' + text = """ +The issue: `%s` of project: `%s` has been assigned to `%s` by %s. + +%s +""" % ( + issue.title, + issue.project.name, + issue.assignee.user, + issue.user.user, + '%s/%s/issue/%s' % ( + progit.APP.config['APP_URL'], + issue.project.name, + globalib, + ), + ) + mail_to = set([cmt.user.emails[0].email for cmt in issue.comments]) + mail_to.add(issue.project.user.emails[0].email) + if issue.assignee and issue.assignee.emails: + mail_to.add(issue.assignee.emails[0].email) + + send_email( + text, + 'Issue `%s` assigned' % issue.title, + ','.join(mail_to), + mail_id=issue.mail_id, + ) + + def notify_new_pull_request(request, globalid): ''' Notify the people following a project that a new pull-request was added to it.