From d6af9515ba13bf6350fd3a2714e44e0d2765a121 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 7 Jul 2018 16:38:01 +0000 Subject: [PATCH] Avoid storing an icid value when iaid is stored/Fix item retraction --- src/Model/Item.php | 4 +++- src/Protocol/Diaspora.php | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Model/Item.php b/src/Model/Item.php index a95bc184f..87ea80005 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -752,7 +752,9 @@ class Item extends BaseObject if (!empty($item['plink'])) { $content_fields['plink'] = $item['plink']; } - if (self::updateActivity($content_fields, ['uri' => $item['uri']])) { + if ((self::activityToIndex($item['verb']) >= 0) || !empty($item['iaid'])) { + 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)) { diff --git a/src/Protocol/Diaspora.php b/src/Protocol/Diaspora.php index 7b55fc682..87f798427 100644 --- a/src/Protocol/Diaspora.php +++ b/src/Protocol/Diaspora.php @@ -2709,10 +2709,11 @@ class Diaspora // When we receive a public retraction, we delete every item that we find. if ($importer['uid'] == 0) { - $condition = ["`guid` = ? AND NOT `file` LIKE '%%[%%' AND NOT `deleted`", $target_guid]; + $condition = ['guid' => $target_guid, 'deleted' => false]; } else { - $condition = ["`guid` = ? AND `uid` = ? AND NOT `file` LIKE '%%[%%' AND NOT `deleted`", $target_guid, $importer['uid']]; + $condition = ['guid' => $target_guid, 'deleted' => false, 'uid' => $importer['uid']]; } + $r = Item::select($fields, $condition); if (!DBM::is_result($r)) { logger("Target guid ".$target_guid." was not found on this system for user ".$importer['uid'].".");