remove add activity when object is removed, fix duplicated dropItem function in js.

This commit is contained in:
Mike Macgirvin 2024-04-25 10:42:44 +10:00
parent 36fc28f7a2
commit ccbbf1f994
2 changed files with 1 additions and 22 deletions

View file

@ -3592,7 +3592,6 @@ function drop_items($items, $stage = DROPITEM_NORMAL, $force = false, $expire =
function drop_item($id, $stage = DROPITEM_NORMAL, $force = false, $uid = 0, $observer_hash = '', $expire = false, $recurse = false) {
// locate item to be deleted
$r = q("SELECT * FROM item WHERE id = %d",
intval($id)
);
@ -3723,7 +3722,7 @@ function drop_related($item, $stage = DROPITEM_NORMAL, $force = false, $uid = 0,
foreach ($allRelated as $related) {
if ($related['verb'] === 'Add' && str_contains($related['tgt_type'], 'Collection')) {
$thisItem = json_decode($related['obj'], true);
if (isset($thisItem['object']['id']) && $thisItem['object']['id'] === $item['mid']) {
if (isset($thisItem['id']) && $thisItem['id'] === str_replace('/item/', '/activity/', $item['mid'])) {
drop_item($related['id'], $stage, $force, $uid, $observer_hash, $expire, recurse: true);
break;
}

View file

@ -1232,26 +1232,6 @@ function dopin(id) {
})
}
function dropItem(url, object) {
let confirm = confirmDelete();
if(confirm) {
let id = url.split('/')[2];
$('body').css('cursor', 'wait');
$(object + ', #pinned-wrapper-' + id).fadeTo('fast', 0.33, function () {
$.post('pin', { 'id' : id });
$.get(url).done(function() {
$(object + ', #pinned-wrapper-' + id).remove();
$('body').css('cursor', 'auto');
});
});
return true;
}
else {
return false;
}
}
function dropItem(url, object) {
let confirm = confirmDelete();