when removing a connection, use the same rules as expire: don't remove items that are starred, filed, or that you replied to.
(cherry picked from commit 5d83469621
)
This commit is contained in:
parent
ac8f798e56
commit
5e5b9895df
@ -374,16 +374,21 @@ function contact_remove($channel_id, $abook_id) {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
||||||
$r = q("select id from item where (owner_xchan = '%s' or author_xchan = '%s') and uid = %d",
|
$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",
|
||||||
dbesc($abook['abook_xchan']),
|
dbesc($abook['abook_xchan']),
|
||||||
dbesc($abook['abook_xchan']),
|
dbesc($abook['abook_xchan']),
|
||||||
intval($channel_id)
|
intval($channel_id)
|
||||||
);
|
);
|
||||||
if($r) {
|
if($r) {
|
||||||
|
$r = fetch_post_tags($r,true);
|
||||||
|
|
||||||
foreach($r as $rr) {
|
foreach($r as $rr) {
|
||||||
|
$terms = get_terms_oftype($item['term'],TERM_FILE);
|
||||||
|
if(! $terms) {
|
||||||
drop_item($rr['id'],false);
|
drop_item($rr['id'],false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
q("delete from abook where abook_id = %d and abook_channel = %d",
|
q("delete from abook where abook_id = %d and abook_channel = %d",
|
||||||
|
Reference in New Issue
Block a user