From d7b29b21b413f88650b1ba1c2003d709aaebb968 Mon Sep 17 00:00:00 2001 From: sidpremkumar Date: Sep 18 2019 22:01:53 +0000 Subject: Fix issue when GitHub full name is unknown --- diff --git a/sync2jira/upstream.py b/sync2jira/upstream.py index 081ef32..948ba06 100644 --- a/sync2jira/upstream.py +++ b/sync2jira/upstream.py @@ -92,7 +92,7 @@ def handle_github_message(msg, config): for comment in github_issue.get_comments(): # First make API call to get the users name comments.append({ - 'author': comment.user.name, + 'author': comment.user.name or comment.user.login, 'name': comment.user.login, 'body': comment.body, 'id': comment.id, @@ -105,7 +105,11 @@ def handle_github_message(msg, config): # Search for the user reporter = github_client.get_user(msg['msg']['issue']['user']['login']) # Update the reporter field in the message (to match Pagure format) - msg['msg']['issue']['user']['fullname'] = reporter.name + if reporter.name: + msg['msg']['issue']['user']['fullname'] = reporter.name + else: + msg['msg']['issue']['user']['fullname'] = \ + msg['msg']['issue']['user']['login'] # Now do the same thing for the assignees assignees = [] @@ -293,7 +297,7 @@ def github_issues(upstream, config): for comment in github_issue.get_comments(): # First make API call to get the users name comments.append({ - 'author': comment.user.name, + 'author': comment.user.name or comment.user.login, 'name': comment.user.login, 'body': comment.body, 'id': comment.id, @@ -307,7 +311,10 @@ def github_issues(upstream, config): # Search for the user reporter = github_client.get_user(issue['user']['login']) # Update the reporter field in the message (to match Pagure format) - issue['user']['fullname'] = reporter.name + if reporter.name: + issue['user']['fullname'] = reporter.name + else: + issue['user']['fullname'] = issue['user']['login'] # Update assignee(s): assignees = []