]> git.mxchange.org Git - friendica.git/commitdiff
Set iaid after update
authorMichael <heluecht@pirati.ca>
Thu, 5 Jul 2018 22:50:33 +0000 (22:50 +0000)
committerMichael <heluecht@pirati.ca>
Thu, 5 Jul 2018 22:50:33 +0000 (22:50 +0000)
src/Model/Item.php

index 1382e5217ea7a32b6c431bd76470f60abb0b2d4a..bfaebf4b291ee275e01bfa41efa92b4a1bf2d330 100644 (file)
@@ -748,9 +748,22 @@ class Item extends BaseObject
 
                while ($item = dba::fetch($items)) {
                        if (!empty($item['plink'])) {
-                               $content_fields['plink'] =  $item['plink'];
+                               $content_fields['plink'] = $item['plink'];
                        }
-                       if (!self::updateActivity($content_fields, ['uri' => $item['uri']])) {
+                       if (self::updateActivity($content_fields, ['uri' => $item['uri']])) {
+                               if (empty($item['iaid'])) {
+                                       $item_activity = dba::selectFirst('item-activity', ['id'], ['uri' => $item['uri']]);
+                                       if (DBM::is_result($item_activity)) {
+                                               $item_fields = ['iaid' => $item_activity['id'], 'icid' => 0,
+                                                       'verb' => '', 'object' => '', 'body' => 'activity'];
+                                               dba::update('item', $item_fields, ['id' => $item['id']]);
+
+                                               if (!empty($item['icid']) && !dba::exists('item', ['icid' => $item['icid']])) {
+                                                       dba::delete('item-content', ['id' => $item['icid']]);
+                                               }
+                                       }
+                               }
+                       } else {
                                self::updateContent($content_fields, ['uri' => $item['uri']]);
 
                                if (empty($item['icid'])) {
@@ -766,10 +779,6 @@ class Item extends BaseObject
                                                dba::update('item', $item_fields, ['id' => $item['id']]);
                                        }
                                }
-                       } else {
-                               if (empty($item['iaid'])) {
-                                       // To-Do
-                               }
                        }
 
                        if (!empty($tags)) {