Skip to content

Commit

Permalink
fix unset displayName
Browse files Browse the repository at this point in the history
  • Loading branch information
mruac committed Dec 20, 2024
1 parent 412d071 commit b93d693
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions bridges/BlueskyBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,9 @@ public function collectData()

$postAuthorDID = $post['post']['author']['did'];
$postAuthorHandle = $post['post']['author']['handle'] !== 'handle.invalid' ? '<i>@' . $post['post']['author']['handle'] . '</i> ' : '';
$postDisplayName = e($post['post']['author']['displayName']) ?? '';
$postUri = $item['uri'];
$postDisplayName = $post['post']['author']['displayName'] ?? '';
$postDisplayName = e($postDisplayName);
$postUri = $item['uri'];

if (Debug::isEnabled()) {
$url = explode('/', $post['post']['uri']);
Expand Down Expand Up @@ -256,8 +257,9 @@ public function collectData()
$description .= 'Author of quoted post has blocked OP.';
} else {
$quotedAuthorDid = $quotedRecord['author']['did'];
$quotedDisplayName = e($quotedRecord['author']['displayName']) ?? '';
$quotedAuthorHandle = $quotedRecord['author']['handle'] !== 'handle.invalid' ? '<i>@' . $quotedRecord['author']['handle'] . '</i>' : '';
$quotedDisplayName = $quotedRecord['author']['displayName'] ?? '';
$quotedDisplayName = e($quotedDisplayName);
$quotedAuthorHandle = $quotedRecord['author']['handle'] !== 'handle.invalid' ? '<i>@' . $quotedRecord['author']['handle'] . '</i>' : '';

$parts = explode('/', $quotedRecord['uri']);
$quotedPostId = end($parts);
Expand Down Expand Up @@ -326,8 +328,9 @@ public function collectData()

$replyPostAuthorDID = $replyPost['author']['did'];
$replyPostAuthorHandle = $replyPost['author']['handle'] !== 'handle.invalid' ? '<i>@' . $replyPost['author']['handle'] . '</i> ' : '';
$replyPostDisplayName = e($replyPost['author']['displayName']) ?? '';
$replyPostUri = self::URI . '/profile/' . $this->fallbackAuthor($replyPost['author'], 'url') . '/post/' . explode('app.bsky.feed.post/', $replyPost['uri'])[1];
$replyPostDisplayName = $replyPost['author']['displayName'] ?? '';
$replyPostDisplayName = e($replyPostDisplayName);
$replyPostUri = self::URI . '/profile/' . $this->fallbackAuthor($replyPost['author'], 'url') . '/post/' . explode('app.bsky.feed.post/', $replyPost['uri'])[1];

// reply post
$description .= $this->getPostDescription(
Expand Down Expand Up @@ -398,7 +401,8 @@ public function collectData()
$description .= 'Author of quoted post has blocked OP.';
} else {
$quotedAuthorDid = $replyQuotedRecord['author']['did'];
$quotedDisplayName = e($replyQuotedRecord['author']['displayName']) ?? '';
$quotedDisplayName = $replyQuotedRecord['author']['displayName'] ?? '';
$quotedDisplayName = e($quotedDisplayName);
$quotedAuthorHandle = $replyQuotedRecord['author']['handle'] !== 'handle.invalid' ? '<i>@' . $replyQuotedRecord['author']['handle'] . '</i>' : '';

$parts = explode('/', $replyQuotedRecord['uri']);
Expand Down Expand Up @@ -515,7 +519,8 @@ private function fallbackAuthor($author, $reason)
case 'url':
return $author['did'];
case 'display':
return e($author['displayName']);
$displayName = $author['displayName'] ?? '';
return e($displayName);
}
}
return $author['handle'];
Expand Down

0 comments on commit b93d693

Please sign in to comment.