[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);
|
||||
|
||||
$author = $comment->find('.author', 0)->plaintext;
|
||||
|
||||
$title .= ' / ' . trim($comment->plaintext);
|
||||
|
||||
$content = $title;
|
||||
if (null !== $comment->nextSibling()) {
|
||||
$content = $comment->nextSibling()->innertext;
|
||||
if ($comment->nextSibling()->nodeName() === 'span') {
|
||||
$content = $comment->nextSibling()->nextSibling()->innertext;
|
||||
}
|
||||
$author = $comment->find('.author', 0);
|
||||
if ($author) {
|
||||
$author = $author->plaintext;
|
||||
} else {
|
||||
$author = '';
|
||||
}
|
||||
|
||||
$title .= ' / '
|
||||
. trim(str_replace(
|
||||
array('octicon','-'), array(''),
|
||||
$comment->find('.octicon', 0)->getAttribute('class')
|
||||
));
|
||||
|
||||
$content = $comment->plaintext;
|
||||
|
||||
$item = array();
|
||||
$item['author'] = $author;
|
||||
$item['uri'] = $uri;
|
||||
|
@ -135,32 +138,20 @@ class GithubIssueBridge extends BridgeAbstract {
|
|||
substr($issue->find('.gh-header-number', 0)->plaintext, 1)
|
||||
);
|
||||
|
||||
$comments = $issue->find('
|
||||
[id^="issue-"] > .comment,
|
||||
[id^="issuecomment-"] > .comment,
|
||||
[id^="event-"],
|
||||
[id^="ref-"]
|
||||
');
|
||||
$comments = $issue->find(
|
||||
'.comment, .TimelineItem-badge'
|
||||
);
|
||||
|
||||
foreach($comments as $comment) {
|
||||
|
||||
if (!$comment->hasChildNodes()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!$comment->hasClass('discussion-item-header')) {
|
||||
if ($comment->hasClass('comment')) {
|
||||
$comment = $comment->parent;
|
||||
$item = $this->extractIssueComment($issueNbr, $title, $comment);
|
||||
$items[] = $item;
|
||||
continue;
|
||||
}
|
||||
|
||||
while ($comment->hasClass('discussion-item-header')) {
|
||||
} else {
|
||||
$comment = $comment->parent;
|
||||
$item = $this->extractIssueEvent($issueNbr, $title, $comment);
|
||||
$items[] = $item;
|
||||
$comment = $comment->nextSibling();
|
||||
if (null == $comment) {
|
||||
break;
|
||||
}
|
||||
$classes = explode(' ', $comment->getAttribute('class'));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue