From afa194200beb2b814612119acb5ab5cf54ae4d36 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 7 Jul 2018 19:39:00 +0000 Subject: [PATCH] Fix: Ensure that the value is set. --- src/Model/Item.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Model/Item.php b/src/Model/Item.php index 87ea80005e..4a7d8639d5 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -752,7 +752,7 @@ class Item extends BaseObject if (!empty($item['plink'])) { $content_fields['plink'] = $item['plink']; } - if ((self::activityToIndex($item['verb']) >= 0) || !empty($item['iaid'])) { + if (!empty($item['iaid']) || (!empty($content_fields['verb']) && (self::activityToIndex($content_fields['verb']) >= 0))) { self::updateActivity($content_fields, ['uri' => $item['uri']]); if (empty($item['iaid'])) { @@ -768,6 +768,12 @@ class Item extends BaseObject dba::delete('item-content', ['id' => $item['icid']]); } } + } elseif (!empty($item['icid'])) { + dba::update('item', ['icid' => null], ['id' => $item['id']]); + + if (!dba::exists('item', ['icid' => $item['icid']])) { + dba::delete('item-content', ['id' => $item['icid']]); + } } } else { self::updateContent($content_fields, ['uri' => $item['uri']]);