Move webmention type logic into blade template

This commit is contained in:
Jonny Barnes 2017-06-22 16:42:10 +01:00
parent 005685ed42
commit 8ec265f686
2 changed files with 19 additions and 33 deletions

View file

@ -37,35 +37,9 @@ class NotesController extends Controller
*/
public function show($urlId)
{
$note = Note::nb60($urlId)->first();
$replies = [];
$reposts = [];
$likes = [];
foreach ($note->webmentions as $webmention) {
$content['author'] = $webmention->author;
$content['published'] = $webmention->published;
$content['source'] = $webmention->source;
switch ($webmention->type) {
case 'in-reply-to':
$content['reply'] = $webmention->reply;
$microformats = json_decode($webmention->mf2, true);
$content['reply'] = $this->filterHTML(
$microformats['items'][0]['properties']['content'][0]['html']
);
$replies[] = $content;
break;
$note = Note::nb60($urlId)->with('webmentions')->first();
case 'repost-of':
$reposts[] = $content;
break;
case 'like-of':
$likes[] = $content;
break;
}
}
return view('notes.show', compact('note', 'replies', 'reposts', 'likes'));
return view('notes.show', compact('note'));
}
/**