diff options
author | Mario <mario@mariovavti.com> | 2019-05-03 08:36:58 +0200 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2019-05-03 08:36:58 +0200 |
commit | 6da4dfe605cc5dcffaf14f53549a61c0240e31bf (patch) | |
tree | 3107de4b8f3ac28e65c2896fecb7e4245bf8da0a /include | |
parent | b35961c53cde75b133411882e35c76ef4ffd35f3 (diff) | |
parent | 7b4cb31a10a3ad4b9c0c671014074362fa19cb6c (diff) | |
download | volse-hubzilla-6da4dfe605cc5dcffaf14f53549a61c0240e31bf.tar.gz volse-hubzilla-6da4dfe605cc5dcffaf14f53549a61c0240e31bf.tar.bz2 volse-hubzilla-6da4dfe605cc5dcffaf14f53549a61c0240e31bf.zip |
Merge branch 'unfriend_delete_posts_bug' into 'dev'
Unfriend delete posts bug
See merge request hubzilla/core!1624
Diffstat (limited to 'include')
-rw-r--r-- | include/connections.php | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/include/connections.php b/include/connections.php index d97ea3887..6382250d5 100644 --- a/include/connections.php +++ b/include/connections.php @@ -373,19 +373,36 @@ function contact_remove($channel_id, $abook_id) { if(intval($abook['abook_self'])) return false; - $r = q("select id from item where (owner_xchan = '%s' or author_xchan = '%s') and uid = %d and item_retained = 0 and item_starred = 0", + $r = q("select id, parent from item where (owner_xchan = '%s' or author_xchan = '%s') and uid = %d and item_retained = 0 and item_starred = 0", dbesc($abook['abook_xchan']), dbesc($abook['abook_xchan']), intval($channel_id) ); if($r) { foreach($r as $rr) { - $x = q("select uid from term where otype = %d and oid = %d and ttype = %d limit 1", + $w = $x = $y = null; + + // if this isn't the parent, see if the conversation was retained + if($rr['id'] != $rr['parent']) { + $w = q("select id from item where parent = %d and item_retained = 0", + intval($rr['parent']) + ); + if($w) { + // see if the conversation was filed + $x = q("select uid from term where otype = %d and oid = %d and ttype = %d limit 1", + intval(TERM_OBJ_POST), + intval($w[0]['id']), + intval(TERM_FILE) + ); + } + } + // see if this item was filed + $y = q("select uid from term where otype = %d and oid = %d and ttype = %d limit 1", intval(TERM_OBJ_POST), intval($rr['id']), intval(TERM_FILE) ); - if($x) { + if($w || $x || $y) { continue; } drop_item($rr['id'],false); |