#113 Fix issue when GitHub full name is unknown
Merged 4 years ago by sidpremkumar. Opened 4 years ago by sidpremkumar.
sidpremkumar/sync-to-jira github-unknown-username-fix  into  develop

file modified
+11 -4
@@ -92,7 +92,7 @@ 

          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 @@ 

      # 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 @@ 

              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 @@ 

          # 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 = []

rebased onto d7b29b2

4 years ago

Pull-Request has been merged by sidpremkumar

4 years ago
Metadata