From 89fefee0490a35ba94232c5dd984a18bc1b581a6 Mon Sep 17 00:00:00 2001
From: Daniel Stone <daniels@collabora.com>
Date: Sun, 3 Jun 2018 11:59:18 +0100
Subject: [PATCH] fixup! Preserve author for issues, comments, attachments

---
 bztogl/bztogl.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/bztogl/bztogl.py b/bztogl/bztogl.py
index 898befe..0f3bdcf 100644
--- a/bztogl/bztogl.py
+++ b/bztogl/bztogl.py
@@ -272,20 +272,24 @@ def processbug(bgo, bzurl, instance, resolution, target, user_cache,
         if 'author' in comment:
             if user_cache[comment['author']]:
                 author = user_cache[comment['author']].display_name()
+                sudo = user_cache[comment['author']].id
             else:
                 author = comment['author']
+                sudo = None
         else:
             if user_cache[comment['creator']]:
                 author = user_cache[comment['creator']].display_name()
+                sudo = user_cache[comment['creator']].id
             else:
                 author = comment['creator']
+                sudo = None
         gitlab_comment = template.render_comment(bzurl, emoji, author, action,
                                                  body, comment_attachment)
 
         issue.notes.create({
             'body': gitlab_comment,
             'created_at': str(comment['creation_time'])
-        }, sudo=author.id)
+        }, sudo=sudo)
 
     # Do last, so that previous actions don't all send an email
     for cc_email in itertools.chain(bzbug.cc, [bzbug.creator]):
-- 
GitLab