]> git.mxchange.org Git - friendica.git/commitdiff
Move addLanguageToItemArray call when body is ensured
authorHypolite Petovan <mrpetovan@gmail.com>
Tue, 24 Jul 2018 12:52:25 +0000 (08:52 -0400)
committerHypolite Petovan <mrpetovan@gmail.com>
Tue, 24 Jul 2018 12:52:25 +0000 (08:52 -0400)
src/Model/Item.php

index ea5abab4520fa697bfc815755cad11bc3ac28fa6..8c803fff963e21ff30d62e2096d251c502f5fa79 100644 (file)
@@ -1330,8 +1330,6 @@ class Item extends BaseObject
                        $item['uri-hash'] = $existing['uri-hash'];
                }
 
-               self::addLanguageToItemArray($item);
-
                $item['wall']          = intval(defaults($item, 'wall', 0));
                $item['extid']         = trim(defaults($item, 'extid', ''));
                $item['author-name']   = trim(defaults($item, 'author-name', ''));
@@ -1383,6 +1381,8 @@ class Item extends BaseObject
                        return 0;
                }
 
+               self::addLanguageToItemArray($item);
+
                // Items cannot be stored before they happen ...
                if ($item['created'] > DateTimeFormat::utcNow()) {
                        $item['created'] = DateTimeFormat::utcNow();
@@ -2227,9 +2227,6 @@ class Item extends BaseObject
         */
        private static function addLanguageToItemArray(&$item)
        {
-               // @TODO Find out why body can be empty here
-               $item['body'] = defaults($item, 'body', '');
-
                $naked_body = BBCode::toPlaintext($item['body'], false);
 
                $ld = new Text_LanguageDetect();