Merge pull request #212 from jonnybarnes/fix_webmention_authorship_info
Fix error when webmention author can’t be found
This commit is contained in:
commit
08b97ec116
2 changed files with 16 additions and 3 deletions
|
@ -90,6 +90,11 @@ class WebMention extends Model
|
||||||
{
|
{
|
||||||
$authorship = new Authorship();
|
$authorship = new Authorship();
|
||||||
$hCard = $authorship->findAuthor(json_decode($this->mf2, true));
|
$hCard = $authorship->findAuthor(json_decode($this->mf2, true));
|
||||||
|
|
||||||
|
if ($hCard === false) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
array_key_exists('properties', $hCard) &&
|
array_key_exists('properties', $hCard) &&
|
||||||
array_key_exists('photo', $hCard['properties'])
|
array_key_exists('photo', $hCard['properties'])
|
||||||
|
|
|
@ -9,9 +9,17 @@
|
||||||
return ($webmention->type == 'in-reply-to');
|
return ($webmention->type == 'in-reply-to');
|
||||||
}) as $reply)
|
}) as $reply)
|
||||||
<div class="u-comment h-cite">
|
<div class="u-comment h-cite">
|
||||||
|
@if ($reply['author'])
|
||||||
<a class="u-author h-card mini-h-card" href="{{ $reply['author']['properties']['url'][0] }}">
|
<a class="u-author h-card mini-h-card" href="{{ $reply['author']['properties']['url'][0] }}">
|
||||||
@if (array_key_exists('photo', $reply['author']['properties']))<img src="{{ $reply['author']['properties']['photo'][0] }}" alt="" class="photo u-photo logo">@endif <span class="fn">{{ $reply['author']['properties']['name'][0] }}</span>
|
@if (array_key_exists('photo', $reply['author']['properties']))
|
||||||
</a> said at <a class="dt-published u-url" href="{{ $reply['source'] }}">{{ $reply['published'] }}</a>
|
<img src="{{ $reply['author']['properties']['photo'][0] }}" alt="" class="photo u-photo logo">
|
||||||
|
@endif
|
||||||
|
<span class="fn">{{ $reply['author']['properties']['name'][0] }}</span>
|
||||||
|
</a>
|
||||||
|
@else
|
||||||
|
Unknown author
|
||||||
|
@endif
|
||||||
|
said at <a class="dt-published u-url" href="{{ $reply['source'] }}">{{ $reply['published'] }}</a>
|
||||||
<div class="e-content p-name">
|
<div class="e-content p-name">
|
||||||
{!! $reply['reply'] !!}
|
{!! $reply['reply'] !!}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue