From 9390d2830d36373e1c5fdf02ad15b0ee7879a00c Mon Sep 17 00:00:00 2001 From: Jonny Barnes Date: Wed, 21 Sep 2016 19:54:45 +0100 Subject: [PATCH 1/2] Hotfix: Correctly parse microformats data for view --- app/Http/Controllers/NotesController.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/NotesController.php b/app/Http/Controllers/NotesController.php index f1bddc32..3d99b929 100644 --- a/app/Http/Controllers/NotesController.php +++ b/app/Http/Controllers/NotesController.php @@ -77,6 +77,7 @@ class NotesController extends Controller $replies = []; $reposts = []; $likes = []; + $carbon = new Carbon\Carbon(); foreach ($note->webmentions as $webmention) { /* reply->url | @@ -96,7 +97,7 @@ class NotesController extends Controller like->photo | Author like->name | */ - $microformats = json_decode($webmention->mf2); + $microformats = json_decode($webmention->mf2, true); $authorHCard = $authorship->findAuthor($microformats); $content['url'] = $authorHCard['properties']['url'][0]; $content['photo'] = $this->createPhotoLink($authorHCard['properties']['photo'][0]); @@ -104,13 +105,13 @@ class NotesController extends Controller switch ($webmention->type) { case 'in-reply-to': $content['source'] = $webmention->source; - $content['date'] = $carbon->parse($content['date'])->toDayDateTimeString(); + $content['date'] = $carbon->parse($microformats['items'][0]['properties']['published'][0])->toDayDateTimeString(); $content['reply'] = $this->filterHTML($microformats['items'][0]['properties']['content'][0]['html']); $replies[] = $content; break; case 'repost-of': - $content['date'] = $carbon->parse($content['date'])->toDayDateTimeString(); + $content['date'] = $carbon->parse($microformats['items'][0]['properties']['published'][0])->toDayDateTimeString(); $content['source'] = $webmention->source; $reposts[] = $content; break; From c96900837cc94877cd2780b2b6688108a79d89c2 Mon Sep 17 00:00:00 2001 From: Jonny Barnes Date: Wed, 21 Sep 2016 19:55:58 +0100 Subject: [PATCH 2/2] Bump version, add fix --- changelog.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/changelog.md b/changelog.md index 1557a21e..306e6078 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,8 @@ # Changelog +## Version 0.0.11.9 (2016-09-21) + - Fix: Correctly parse microformats data for single note view + ## Version 0.0.11.8 (2016-09-21) - Fix: remove index.html from generated url