From 73b4aea084b22af165b9f69007b4c8d44473b7d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Mazi=C3=A8re?= Date: Sat, 10 Sep 2016 11:44:18 +0200 Subject: [PATCH 1/2] [GithubIssueBridge]: fix collecting issue comments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pierre Mazière --- bridges/GithubIssueBridge.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bridges/GithubIssueBridge.php b/bridges/GithubIssueBridge.php index 767d584..67bddc2 100644 --- a/bridges/GithubIssueBridge.php +++ b/bridges/GithubIssueBridge.php @@ -35,7 +35,7 @@ class GithubIssueBridge extends BridgeAbstract{ or $this->returnServerError('No results for Github Issue '.$this->getInput('i').' in project '.$this->getInput('u').'/'.$this->getInput('p')); switch($this->queriedContext){ - case 'Issue Comments': + case 'Issue comments': foreach($html->find('.js-comment-container') as $comment){ $item = array(); From bf8214e3dddca40c9a2af0f5a56865075477a385 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Mazi=C3=A8re?= Date: Sat, 10 Sep 2016 11:44:55 +0200 Subject: [PATCH 2/2] [GithubIssueBridge] add getURI() and getName() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pierre Mazière --- bridges/GithubIssueBridge.php | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/bridges/GithubIssueBridge.php b/bridges/GithubIssueBridge.php index 67bddc2..ba707b3 100644 --- a/bridges/GithubIssueBridge.php +++ b/bridges/GithubIssueBridge.php @@ -28,10 +28,29 @@ class GithubIssueBridge extends BridgeAbstract{ ) ); + public function getName(){ + $name=$this->getInput('u').'/'.$this->getInput('p'); + switch($this->queriedContext){ + case 'Project Issues': + $name=static::NAME.'s '.$name; + break; + case 'Issue comments': + $name=static::NAME.' '.$name.' #'.$this->getInput('i'); + break; + } + return $name; + } + + public function getURI(){ + $uri = static::URI.$this->getInput('u').'/'.$this->getInput('p').'/issues/'; + if($this->queriedContext==='Issue comments'){ + $uri.=$this->getInput('i'); + } + return $uri; + } + public function collectData(){ - $uri = self::URI.$this->getInput('u').'/'.$this->getInput('p') - .'/issues/'.$this->getInput('i'); - $html = $this->getSimpleHTMLDOM($uri) + $html = $this->getSimpleHTMLDOM($this->getURI()) or $this->returnServerError('No results for Github Issue '.$this->getInput('i').' in project '.$this->getInput('u').'/'.$this->getInput('p')); switch($this->queriedContext){ @@ -43,7 +62,7 @@ class GithubIssueBridge extends BridgeAbstract{ $comment=$comment->firstChild()->nextSibling(); - $item['uri']=$uri.'#'.$comment->getAttribute('id'); + $item['uri']=$this->getURI().'#'.$comment->getAttribute('id'); $item['title']=trim($comment->firstChild()->plaintext); $item['timestamp']=strtotime($comment->find('relative-time',0)->getAttribute('datetime')); $item['content']=$comment->find('.comment-body',0)->innertext;