Remove references to item.parent-uri in Worker\OnePoll

This commit is contained in:
Hypolite Petovan 2020-11-13 04:54:01 -05:00
parent a9d114316d
commit ff66633a44

View file

@ -583,9 +583,9 @@ class OnePoll
} }
} }
$condition = ['uri' => $refs_arr, 'uid' => $importer_uid]; $condition = ['uri' => $refs_arr, 'uid' => $importer_uid];
$parent = Item::selectFirst(['parent-uri'], $condition); $parent = Item::selectFirst(['uri'], $condition);
if (DBA::isResult($parent)) { if (DBA::isResult($parent)) {
$datarray['parent-uri'] = $parent['parent-uri']; // Set the parent as the top-level item $datarray['thr-parent'] = $parent['uri'];
} }
} }
@ -613,20 +613,15 @@ class OnePoll
$datarray['title'] = self::RemoveReply($datarray['title']); $datarray['title'] = self::RemoveReply($datarray['title']);
// If it seems to be a reply but a header couldn't be found take the last message with matching subject // If it seems to be a reply but a header couldn't be found take the last message with matching subject
if (empty($datarray['parent-uri']) && $reply) { if (empty($datarray['thr-parent']) && $reply) {
$condition = ['title' => $datarray['title'], 'uid' => $importer_uid, 'network' => Protocol::MAIL]; $condition = ['title' => $datarray['title'], 'uid' => $importer_uid, 'network' => Protocol::MAIL];
$params = ['order' => ['created' => true]]; $params = ['order' => ['created' => true]];
$parent = Item::selectFirst(['parent-uri'], $condition, $params); $parent = Item::selectFirst(['uri'], $condition, $params);
if (DBA::isResult($parent)) { if (DBA::isResult($parent)) {
$datarray['parent-uri'] = $parent['parent-uri']; $datarray['thr-parent'] = $parent['uri'];
} }
} }
if (!empty($datarray['parent-uri'])) {
$datarray['thr-parent'] = $datarray['parent-uri'];
}
unset($datarray['parent-uri']);
$headers = imap_headerinfo($mbox, $meta->msgno); $headers = imap_headerinfo($mbox, $meta->msgno);
$object = []; $object = [];