]> git.mxchange.org Git - friendica-addons.git/commitdiff
Store hash tags
authorMichael <heluecht@pirati.ca>
Sat, 25 Nov 2023 22:00:45 +0000 (22:00 +0000)
committerMichael <heluecht@pirati.ca>
Sat, 25 Nov 2023 22:00:45 +0000 (22:00 +0000)
bluesky/bluesky.php

index dd946a5afda7817b240780cb8cfde2c5720f2fc4..47e45f4ebb53f2a7ba96450449a4e8cc77d4923f 100644 (file)
@@ -41,6 +41,7 @@ use Friendica\Model\Item;
 use Friendica\Model\ItemURI;
 use Friendica\Model\Photo;
 use Friendica\Model\Post;
 use Friendica\Model\ItemURI;
 use Friendica\Model\Photo;
 use Friendica\Model\Post;
+use Friendica\Model\Tag;
 use Friendica\Network\HTTPClient\Client\HttpClientAccept;
 use Friendica\Network\HTTPClient\Client\HttpClientOptions;
 use Friendica\Object\Image;
 use Friendica\Network\HTTPClient\Client\HttpClientAccept;
 use Friendica\Network\HTTPClient\Client\HttpClientOptions;
 use Friendica\Object\Image;
@@ -1134,13 +1135,13 @@ function bluesky_get_content(array $item, stdClass $record, string $uri, int $ui
                }
        }
 
                }
        }
 
-       $item['body']    = bluesky_get_text($record);
+       $item['body']    = bluesky_get_text($record, $item['uri-id']);
        $item['created'] = DateTimeFormat::utc($record->createdAt, DateTimeFormat::MYSQL);
        $item['transmitted-languages'] = $record->langs ?? [];
        return $item;
 }
 
        $item['created'] = DateTimeFormat::utc($record->createdAt, DateTimeFormat::MYSQL);
        $item['transmitted-languages'] = $record->langs ?? [];
        return $item;
 }
 
-function bluesky_get_text(stdClass $record): string
+function bluesky_get_text(stdClass $record, int $uri_id): string
 {
        $text = $record->text ?? '';
 
 {
        $text = $record->text ?? '';
 
@@ -1180,6 +1181,7 @@ function bluesky_get_text(stdClass $record): string
                                        break;
 
                                case 'app.bsky.richtext.facet#tag';
                                        break;
 
                                case 'app.bsky.richtext.facet#tag';
+                                       Tag::store($uri_id, Tag::HASHTAG, $feature->tag);
                                        $url      = DI::baseUrl() . '/search?tag=' . urlencode($feature->tag);
                                        $linktext = '#' . $feature->tag;
                                        break;
                                        $url      = DI::baseUrl() . '/search?tag=' . urlencode($feature->tag);
                                        $linktext = '#' . $feature->tag;
                                        break;