From b93d693809f64a3b0f5b86e58a4354156174ed5e Mon Sep 17 00:00:00 2001 From: mruac Date: Fri, 20 Dec 2024 18:48:13 +1030 Subject: [PATCH] fix unset displayName --- bridges/BlueskyBridge.php | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/bridges/BlueskyBridge.php b/bridges/BlueskyBridge.php index 37712ea2d9d..720b37e25b4 100644 --- a/bridges/BlueskyBridge.php +++ b/bridges/BlueskyBridge.php @@ -174,8 +174,9 @@ public function collectData() $postAuthorDID = $post['post']['author']['did']; $postAuthorHandle = $post['post']['author']['handle'] !== 'handle.invalid' ? '@' . $post['post']['author']['handle'] . ' ' : ''; - $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']); @@ -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' ? '@' . $quotedRecord['author']['handle'] . '' : ''; + $quotedDisplayName = $quotedRecord['author']['displayName'] ?? ''; + $quotedDisplayName = e($quotedDisplayName); + $quotedAuthorHandle = $quotedRecord['author']['handle'] !== 'handle.invalid' ? '@' . $quotedRecord['author']['handle'] . '' : ''; $parts = explode('/', $quotedRecord['uri']); $quotedPostId = end($parts); @@ -326,8 +328,9 @@ public function collectData() $replyPostAuthorDID = $replyPost['author']['did']; $replyPostAuthorHandle = $replyPost['author']['handle'] !== 'handle.invalid' ? '@' . $replyPost['author']['handle'] . ' ' : ''; - $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( @@ -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' ? '@' . $replyQuotedRecord['author']['handle'] . '' : ''; $parts = explode('/', $replyQuotedRecord['uri']); @@ -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'];