From dcef6abae1a5e431b2affec9487009dbb986e011 Mon Sep 17 00:00:00 2001
From: Thomas Hackl <thomas.hackl@uni-passau.de>
Date: Sat, 14 Jul 2018 18:18:07 +0200
Subject: [PATCH] closed_by information for issue

---
 src/GitLab.php    | 11 +++++++++--
 src/Migration.php |  3 ++-
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/GitLab.php b/src/GitLab.php
index 56f79b2..77194bd 100644
--- a/src/GitLab.php
+++ b/src/GitLab.php
@@ -91,10 +91,17 @@ class GitLab
      * @param mixed $projectId project ID or path
      * @param int $issueId issue to close
      * @param string $time time in ISO8601 format
+	 * @param string $author wh closed the issue?
      */
-	public function closeIssue($projectId, $issueId, $time) {
+	public function closeIssue($projectId, $issueId, $time = '', $author = '') {
 		$this->client->api('issues')->update($projectId, $issueId,
-			['state_event' => 'close', 'updated_at' => $time]);
+			[
+				'state_event' => 'close',
+				'updated_at' => $time,
+				'closed_at' => $time,
+				'closed_by_id' => $author,
+				'closed_by' => $author
+			]);
 	}
 
 	/**
diff --git a/src/Migration.php b/src/Migration.php
index 82f27c9..49354d6 100644
--- a/src/Migration.php
+++ b/src/Migration.php
@@ -143,7 +143,8 @@ class Migration
 
 			// Close issue if Trac ticket was closed.
 			if ($ticket[3]['status'] === 'closed') {
-				$this->gitLab->closeIssue($gitLabProject, $issue['iid'], $dateUpdated);
+				$this->gitLab->closeIssue($gitLabProject, $issue['iid'],
+					$ticket[4][0]['time']['__jsonclass__'][1], $ticket[4][0]['author']);
 			}
 
 		}
-- 
GitLab