Browse Source

adds in-reply-to property for HN comments

pull/49/head v1.3.0
Aaron Parecki 4 years ago
parent
commit
a16b845af3
No known key found for this signature in database GPG Key ID: 276C2817346D6056
2 changed files with 5 additions and 0 deletions
  1. +4
    -0
      lib/XRay/Formats/Hackernews.php
  2. +1
    -0
      tests/HackernewsTest.php

+ 4
- 0
lib/XRay/Formats/Hackernews.php View File

@ -75,6 +75,10 @@ class Hackernews extends Format {
];
}
if(isset($data['parent'])) {
$entry['in-reply-to'] = ['https://news.ycombinator.com/item?id='.$data['parent']];
}
return [
'data' => $entry,
'original' => $json

+ 1
- 0
tests/HackernewsTest.php View File

@ -53,6 +53,7 @@ What projects or companies are you working on to combat filter bubbles, walled g
$this->assertEquals('2017-06-08T20:23:20+00:00', $data['data']['published']);
$this->assertEquals('aaronpk', $data['data']['author']['name']);
$this->assertEquals('https://news.ycombinator.com/user?id=aaronpk', $data['data']['author']['url']);
$this->assertEquals('https://news.ycombinator.com/item?id=14516538', $data['data']['in-reply-to'][0]);
$this->assertArrayNotHasKey('name', $data['data']);
$this->assertEquals('I am a member of the W3C Social Web Working Group (<a href="https://www.w3.org/wiki/Socialwg">https://www.w3.org/wiki/Socialwg</a>), and have been organizing IndieWebCamp (<a href="https://indieweb.org/">https://indieweb.org/</a>) conferences in this space for the last 7 years. We\'ve been making a lot of progress:<p>* <a href="https://www.w3.org/TR/webmention/">https://www.w3.org/TR/webmention/</a> - cross-site commenting</p><p>* <a href="https://www.w3.org/TR/micropub/">https://www.w3.org/TR/micropub/</a> - API for apps to create posts on various servers</p><p>* <a href="https://www.w3.org/TR/websub/">https://www.w3.org/TR/websub/</a> - realtime subscriptions to feeds</p><p>* More: <a href="https://indieweb.org/specs">https://indieweb.org/specs</a></p><p>We focus on making sure there are a plurality of implementations and approaches rather than trying to build a single software solution to solve everything.</p><p>Try commenting on my copy of this post on my website by sending me a webmention! <a href="https://aaronparecki.com/2017/06/08/9/indieweb">https://aaronparecki.com/2017/06/08/9/indieweb</a></p>', $data['data']['content']['html']);
$this->assertEquals('I am a member of the W3C Social Web Working Group (https://www.w3.org/wiki/Socialwg), and have been organizing IndieWebCamp (https://indieweb.org/) conferences in this space for the last 7 years. We\'ve been making a lot of progress:

Loading…
Cancel
Save