Skip to content

Commit 3a7a056

Browse files
committed
semantics
1 parent 55aa383 commit 3a7a056

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

bridges/BlueskyBridge.php

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ public function collectData()
173173
$item['author'] = $this->fallbackAuthor($post['post']['author'], 'display');
174174

175175
$postAuthorDID = $post['post']['author']['did'];
176-
$postAuthorHandle = $post['post']['author']['handle'] !== 'handle.invalid' ? '<i>@' . $post['post']['author']['handle'] . '</i> ' : '';
176+
$postAuthorHandle = $post['post']['author']['handle'] !== 'handle.invalid' ? '<i>@' . $post['post']['author']['handle'] . '</i>' : '';
177177
$postDisplayName = $post['post']['author']['displayName'] ?? '';
178178
$postDisplayName = e($postDisplayName);
179179
$postUri = $item['uri'];
@@ -340,7 +340,7 @@ public function collectData()
340340
} else {
341341
$replyPostRecord = $replyPost['record'];
342342
$replyPostAuthorDID = $replyPost['author']['did'];
343-
$replyPostAuthorHandle = $replyPost['author']['handle'] !== 'handle.invalid' ? '<i>@' . $replyPost['author']['handle'] . '</i> ' : '';
343+
$replyPostAuthorHandle = $replyPost['author']['handle'] !== 'handle.invalid' ? '<i>@' . $replyPost['author']['handle'] . '</i>' : '';
344344
$replyPostDisplayName = $replyPost['author']['displayName'] ?? '';
345345
$replyPostDisplayName = e($replyPostDisplayName);
346346
$replyPostUri = self::URI . '/profile/' . $this->fallbackAuthor($replyPost['author'], 'url') . '/post/' . explode('app.bsky.feed.post/', $replyPost['uri'])[1];
@@ -528,8 +528,9 @@ private function getPostDescription(
528528
$postType = isset($postRecord['reply']) ? 'reply' : 'post';
529529
$description .= "Replying to <b>$postDisplayName</b> $postAuthorHandle's <a href=\"$postUri\">$postType</a>:<br>";
530530
} else {
531-
// aaa @aaa.com posted:
532-
$description .= "<b>$postDisplayName</b> $postAuthorHandle <a href=\"$postUri\">posted</a>:<br>";
531+
// aaa @aaa.com posted/replied:
532+
$postType = isset($postRecord['reply']) ? 'replied' : 'posted';
533+
$description .= "<b>$postDisplayName</b> $postAuthorHandle <a href=\"$postUri\">$postType</a>:<br>";
533534
}
534535
$description .= $this->textToDescription($postRecord);
535536
return $description;
@@ -555,9 +556,19 @@ private function generateVerboseTitle($post)
555556
//use "Post by A, replying to B, quoting C" instead of post contents
556557
$title = '';
557558
if (isset($post['reason']) && str_contains($post['reason']['$type'], 'reasonRepost')) {
558-
$title .= 'Repost by ' . $this->fallbackAuthor($post['reason']['by'], 'display') . ', post by ' . $this->fallbackAuthor($post['post']['author'], 'display');
559+
$title .= 'Repost by ' . $this->fallbackAuthor($post['reason']['by'], 'display');
560+
if (isset($post['reply'])) {
561+
$title .= ', reply by ';
562+
} else {
563+
$title .= ', post by ';
564+
}
565+
$title .= $this->fallbackAuthor($post['post']['author'], 'display');
559566
} else {
560-
$title .= 'Post by ' . $this->fallbackAuthor($post['post']['author'], 'display');
567+
if (isset($post['reply'])) {
568+
$title .= 'Reply by ' . $this->fallbackAuthor($post['post']['author'], 'display');
569+
} else {
570+
$title .= 'Post by ' . $this->fallbackAuthor($post['post']['author'], 'display');
571+
}
561572
}
562573

563574
if (isset($post['reply'])) {

0 commit comments

Comments
 (0)