[GithubIssueBridgeIssue] Fix bridge (#1453)
* fix bridge according to website evolution
This commit is contained in:
parent
3179c1e884
commit
d39741c296
1 changed files with 21 additions and 30 deletions
|
@ -82,18 +82,21 @@ class GithubIssueBridge extends BridgeAbstract {
|
||||||
|
|
||||||
$uri = $this->buildGitHubIssueCommentUri($issueNbr, $comment->id);
|
$uri = $this->buildGitHubIssueCommentUri($issueNbr, $comment->id);
|
||||||
|
|
||||||
$author = $comment->find('.author', 0)->plaintext;
|
$author = $comment->find('.author', 0);
|
||||||
|
if ($author) {
|
||||||
$title .= ' / ' . trim($comment->plaintext);
|
$author = $author->plaintext;
|
||||||
|
} else {
|
||||||
$content = $title;
|
$author = '';
|
||||||
if (null !== $comment->nextSibling()) {
|
|
||||||
$content = $comment->nextSibling()->innertext;
|
|
||||||
if ($comment->nextSibling()->nodeName() === 'span') {
|
|
||||||
$content = $comment->nextSibling()->nextSibling()->innertext;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$title .= ' / '
|
||||||
|
. trim(str_replace(
|
||||||
|
array('octicon','-'), array(''),
|
||||||
|
$comment->find('.octicon', 0)->getAttribute('class')
|
||||||
|
));
|
||||||
|
|
||||||
|
$content = $comment->plaintext;
|
||||||
|
|
||||||
$item = array();
|
$item = array();
|
||||||
$item['author'] = $author;
|
$item['author'] = $author;
|
||||||
$item['uri'] = $uri;
|
$item['uri'] = $uri;
|
||||||
|
@ -135,32 +138,20 @@ class GithubIssueBridge extends BridgeAbstract {
|
||||||
substr($issue->find('.gh-header-number', 0)->plaintext, 1)
|
substr($issue->find('.gh-header-number', 0)->plaintext, 1)
|
||||||
);
|
);
|
||||||
|
|
||||||
$comments = $issue->find('
|
$comments = $issue->find(
|
||||||
[id^="issue-"] > .comment,
|
'.comment, .TimelineItem-badge'
|
||||||
[id^="issuecomment-"] > .comment,
|
);
|
||||||
[id^="event-"],
|
|
||||||
[id^="ref-"]
|
|
||||||
');
|
|
||||||
foreach($comments as $comment) {
|
foreach($comments as $comment) {
|
||||||
|
if ($comment->hasClass('comment')) {
|
||||||
if (!$comment->hasChildNodes()) {
|
$comment = $comment->parent;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$comment->hasClass('discussion-item-header')) {
|
|
||||||
$item = $this->extractIssueComment($issueNbr, $title, $comment);
|
$item = $this->extractIssueComment($issueNbr, $title, $comment);
|
||||||
$items[] = $item;
|
$items[] = $item;
|
||||||
continue;
|
continue;
|
||||||
}
|
} else {
|
||||||
|
$comment = $comment->parent;
|
||||||
while ($comment->hasClass('discussion-item-header')) {
|
|
||||||
$item = $this->extractIssueEvent($issueNbr, $title, $comment);
|
$item = $this->extractIssueEvent($issueNbr, $title, $comment);
|
||||||
$items[] = $item;
|
$items[] = $item;
|
||||||
$comment = $comment->nextSibling();
|
|
||||||
if (null == $comment) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
$classes = explode(' ', $comment->getAttribute('class'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue