do not re-import manually deleted posts (but do update expired posts that have new content)

This commit is contained in:
Mike Macgirvin 2023-04-27 22:35:28 -07:00
parent c146cd0f0b
commit 8c76acc132
3 changed files with 19 additions and 3 deletions

View file

@ -3678,6 +3678,11 @@ class Activity
$item['item_private'] = 2;
}
if (Tombstone::check($item['mid'], $channel['channel_id'])) {
logger('tombstone: post was deleted. Ignoring update.');
return;
}
if ($item['parent_mid'] && $item['parent_mid'] !== $item['mid']) {
$is_child_node = true;
}

View file

@ -1654,6 +1654,12 @@ class Libzot
$DR->set_name($channel['channel_name'] . ' <' . Channel::get_webfinger($channel) . '>');
if (Tombstone::check($arr['mid'], $channel['channel_id'])) {
$DR->update('update ignored');
$result[] = $DR->get();
continue;
}
if (($act) && ($act->obj) && (!is_array($act->obj))) {
// The initial object fetch failed using the sys channel credentials.
// Try again using the delivery channel credentials.

View file

@ -21,6 +21,7 @@ use Code\Lib\ObjCache;
use Code\Lib\PConfig;
use Code\Lib\LibBlock;
use Code\Lib\ThreadListener;
use Code\Lib\Tombstone;
use Code\Access\PermissionLimits;
use Code\Access\PermissionRoles;
use Code\Access\AccessControl;
@ -3621,11 +3622,11 @@ function drop_item($id, $stage = DROPITEM_NORMAL, $force = false, $uid = 0, $obs
);
if ($items) {
foreach ($items as $i) {
delete_item_lowlevel($i, $stage, $force);
delete_item_lowlevel($i, $stage, $force, $expire);
}
}
else {
delete_item_lowlevel($item, $stage, $force);
delete_item_lowlevel($item, $stage, $force, $expire);
}
return true;
@ -3646,11 +3647,15 @@ function drop_item($id, $stage = DROPITEM_NORMAL, $force = false, $uid = 0, $obs
* @param bool $force
* @return bool
*/
function delete_item_lowlevel($item, $stage = DROPITEM_NORMAL, $force = false) {
function delete_item_lowlevel($item, $stage = DROPITEM_NORMAL, $force = false, $expire = false) {
logger('item: ' . $item['id'] . ' stage: ' . $stage . ' force: ' . ($force) ? 'true' : 'false', LOGGER_DATA);
if (!$expire) {
Tombstone::store($item['mid'], $item['uid']);
}
match ($stage) {
DROPITEM_PHASE2 => q("UPDATE item SET item_pending_remove = 1, body = '', title = '',
changed = '%s', edited = '%s' WHERE id = %d",