Merge pull request #9628 from annando/dfrn-delete

Don't create the parent during a deletion
This commit is contained in:
Hypolite Petovan 2020-12-06 08:37:50 -05:00 committed by GitHub
commit a863228e09
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 9 deletions

View file

@ -2705,8 +2705,12 @@ class DFRN
}
$deletions = $xpath->query("/atom:feed/at:deleted-entry");
foreach ($deletions as $deletion) {
self::processDeletion($xpath, $deletion, $importer);
if (!empty($deletions)) {
foreach ($deletions as $deletion) {
self::processDeletion($xpath, $deletion, $importer);
}
Logger::notice('Deletions had been processed');
return 200;
}
if (!$sort_by_date) {

View file

@ -296,13 +296,17 @@ class Delivery
$msgitems = [$target_item];
$atom = DFRN::entries($msgitems, $owner);
} else {
$msgitems = [];
foreach ($items as $item) {
// Only add the parent when we don't delete other items.
if (($target_item['id'] == $item['id']) || ($cmd != self::DELETION)) {
$item["entry:comment-allow"] = true;
$item["entry:cid"] = ($top_level ? $contact['id'] : 0);
$msgitems[] = $item;
if ($target_item['deleted']) {
$msgitems = [$target_item];
} else {
$msgitems = [];
foreach ($items as $item) {
// Only add the parent when we don't delete other items.
if (($target_item['id'] == $item['id']) || ($cmd != self::DELETION)) {
$item["entry:comment-allow"] = true;
$item["entry:cid"] = ($top_level ? $contact['id'] : 0);
$msgitems[] = $item;
}
}
}
$atom = DFRN::entries($msgitems, $owner);