From da0a6a996ba336d42b09d7853f1260a3c710895d Mon Sep 17 00:00:00 2001 From: jubianchi Date: Wed, 28 May 2014 21:18:20 +0200 Subject: [PATCH 1/2] Add a method to retrieve an issue's comments --- lib/Gitlab/Model/Issue.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/Gitlab/Model/Issue.php b/lib/Gitlab/Model/Issue.php index 0d06dc0a9..e97d860d8 100644 --- a/lib/Gitlab/Model/Issue.php +++ b/lib/Gitlab/Model/Issue.php @@ -87,4 +87,15 @@ public function addComment($body) return Note::fromArray($this->getClient(), $this, $data); } + public function showComments() + { + $notes = array(); + $data = $this->api('issues')->showComments($this->project->id, $this->id); + + foreach ($data as $note) { + $notes[] = Note::fromArray($this->getClient(), $this, $note); + } + + return $notes; + } } From 00ac4c74f19f390ee2842a76b68037d58dedc966 Mon Sep 17 00:00:00 2001 From: jubianchi Date: Wed, 28 May 2014 21:27:18 +0200 Subject: [PATCH 2/2] Add a method to retrieve a mr's comments --- lib/Gitlab/Model/MergeRequest.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/Gitlab/Model/MergeRequest.php b/lib/Gitlab/Model/MergeRequest.php index 2b5e04c00..ba18d8f46 100644 --- a/lib/Gitlab/Model/MergeRequest.php +++ b/lib/Gitlab/Model/MergeRequest.php @@ -101,6 +101,18 @@ public function addComment($note) return Note::fromArray($this->getClient(), $this, $data); } + public function showComments() + { + $notes = array(); + $data = $this->api('mr')->showComments($this->project->id, $this->id); + + foreach ($data as $note) { + $notes[] = Note::fromArray($this->getClient(), $this, $note); + } + + return $notes; + } + public function isClosed() { if (in_array($this->state, array('closed', 'merged'))) {