another complication to deletion

This commit is contained in:
friendica 2014-03-28 01:19:30 -07:00
parent 34403d3bd3
commit 85d61813ca

View File

@ -899,20 +899,27 @@ function item_content(&$a) {
if($i) { if($i) {
$can_delete = false; $can_delete = false;
$local_delete = false;
if(local_user() && local_user() == $i[0]['uid']) if(local_user() && local_user() == $i[0]['uid'])
$can_delete = true; $local_delete = true;
$ob_hash = get_observer_hash(); $ob_hash = get_observer_hash();
if($ob_hash && ($ob_hash === $i[0]['author_xchan'] || $ob_hash === $i[0]['owner_xchan'] || $ob_hash === $i[0]['source_xchan'])) if($ob_hash && ($ob_hash === $i[0]['author_xchan'] || $ob_hash === $i[0]['owner_xchan'] || $ob_hash === $i[0]['source_xchan']))
$can_delete = true; $can_delete = true;
if(! $can_delete) { if(! ($can_delete || $local_delete)) {
notice( t('Permission denied.') . EOL); notice( t('Permission denied.') . EOL);
return; return;
} }
if($i[0]['item_restrict']) // if this is a different page type or it's just a local delete
// but not by the item author or owner, do a simple deletion
if($i[0]['item_restrict'] || ($local_delete && (! $can_delete))) {
drop_item($i[0]['id']); drop_item($i[0]['id']);
}
else { else {
// complex deletion that needs to propagate and be performed in phases
drop_item($i[0]['id'],true,DROPITEM_PHASE1); drop_item($i[0]['id'],true,DROPITEM_PHASE1);
tag_deliver($i[0]['uid'],$i[0]['id']); tag_deliver($i[0]['uid'],$i[0]['id']);
} }