]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Item.php
Merge remote-tracking branch 'upstream/develop' into restricted
[friendica.git] / src / Model / Item.php
index d5e9555268900e59dda42fc2bb7566b4efd8729c..8972d3b75e1870214e2da3ecbc8670ac3c9c8b00 100644 (file)
@@ -96,9 +96,9 @@ class Item
                'wall', 'private', 'starred', 'origin', 'parent-origin', 'title', 'body', 'language',
                'content-warning', 'location', 'coord', 'app', 'rendered-hash', 'rendered-html', 'object',
                'quote-uri', 'quote-uri-id', 'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid', 'mention', 'global',
-               'author-id', 'author-link', 'author-alias', 'author-name', 'author-avatar', 'author-network', 'author-updated', 'author-gsid', 'author-addr', 'author-uri-id',
-               'owner-id', 'owner-link', 'owner-alias', 'owner-name', 'owner-avatar', 'owner-network', 'owner-contact-type', 'owner-updated',
-               'causer-id', 'causer-link', 'causer-alias', 'causer-name', 'causer-avatar', 'causer-contact-type', 'causer-network',
+               'author-id', 'author-link', 'author-alias', 'author-name', 'author-avatar', 'author-network', 'author-updated', 'author-gsid', 'author-baseurl', 'author-addr', 'author-uri-id',
+               'owner-id', 'owner-link', 'owner-alias', 'owner-name', 'owner-avatar', 'owner-network', 'owner-contact-type', 'owner-updated', 'owner-gsid',
+               'causer-id', 'causer-link', 'causer-alias', 'causer-name', 'causer-avatar', 'causer-contact-type', 'causer-network', 'causer-gsid',
                'contact-id', 'contact-uid', 'contact-link', 'contact-name', 'contact-avatar',
                'writable', 'self', 'cid', 'alias',
                'event-created', 'event-edited', 'event-start', 'event-finish',
@@ -1250,7 +1250,7 @@ class Item
                        }
                }
 
-               Post::insert($item['uri-id'], $item);
+               $inserted = Post::insert($item['uri-id'], $item);
 
                if ($item['gravity'] == self::GRAVITY_PARENT) {
                        Post\Thread::insert($item['uri-id'], $item);
@@ -1405,6 +1405,10 @@ class Item
                        self::updateDisplayCache($posted_item['uri-id']);
                }
 
+               if ($inserted) {
+                       Post\Engagement::storeFromItem($posted_item);
+               }
+
                return $post_user_id;
        }
 
@@ -2013,11 +2017,8 @@ class Item
 
                $naked_body = self::getDominantLanguage($naked_body);
 
-               $availableLanguages = DI::l10n()->getAvailableLanguages();
-               // See https://github.com/friendica/friendica/issues/10511
-               // Persian is manually added to language detection until a persian translation is provided for the interface, at
-               // which point it will be automatically available through `getAvailableLanguages()` and this should be removed.
-               $availableLanguages['fa'] = 'fa';
+               $availableLanguages = DI::l10n()->getAvailableLanguages(true);
+               $availableLanguages = DI::l10n()->convertForLanguageDetection($availableLanguages);
 
                $ld = new Language(array_keys($availableLanguages));
                return $ld->detect($naked_body)->limit(0, $count)->close() ?: [];