Merge pull request #12298 from annando/api-suggestions

Contact suggestions are now cached
This commit is contained in:
Hypolite Petovan 2022-12-01 05:25:44 -05:00 committed by GitHub
commit 2baa56d478
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 276 additions and 18 deletions

View file

@ -167,9 +167,23 @@ class Status extends BaseFactory
if (!empty($shared)) {
$shared_uri_id = $shared['post']['uri-id'];
$mentions = array_merge($mentions, $this->mstdnMentionFactory->createFromUriId($shared_uri_id)->getArrayCopy());
$tags = array_merge($tags, $this->mstdnTagFactory->createFromUriId($shared_uri_id));
$attachments = array_merge($attachments, $this->mstdnAttachementFactory->createFromUriId($shared_uri_id));
foreach ($this->mstdnMentionFactory->createFromUriId($shared_uri_id)->getArrayCopy() as $mention) {
if (!in_array($mention, $mentions)) {
$mentions[] = $mention;
}
}
foreach ($this->mstdnTagFactory->createFromUriId($shared_uri_id) as $tag) {
if (!in_array($tag, $tags)) {
$tags[] = $tag;
}
}
foreach ($this->mstdnAttachementFactory->createFromUriId($shared_uri_id) as $attachment) {
if (!in_array($attachment, $attachments)) {
$attachments[] = $attachment;
}
}
if (empty($card->toArray())) {
$card = $this->mstdnCardFactory->createFromUriId($shared_uri_id);