aboutsummaryrefslogtreecommitdiffstats
path: root/include/connections.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2019-05-03 14:16:56 +0200
committerMario <mario@mariovavti.com>2019-05-03 14:16:56 +0200
commit98b6362c075167eb2260b8b07d7f5e5a56ab8601 (patch)
tree56bdd00bd5a75d3d5961a2edb1c4caf31eea8da4 /include/connections.php
parentcd829c096bf355a0502a89fe475eeaae1dd0a72f (diff)
parentf127c558025958ee9f1c60f1dd8f178a8a85c03e (diff)
downloadvolse-hubzilla-98b6362c075167eb2260b8b07d7f5e5a56ab8601.tar.gz
volse-hubzilla-98b6362c075167eb2260b8b07d7f5e5a56ab8601.tar.bz2
volse-hubzilla-98b6362c075167eb2260b8b07d7f5e5a56ab8601.zip
Merge branch 'dev' into 'dev'
removing items from ex-connections turns out to be more complicated than originally envisioned See merge request hubzilla/core!1626
Diffstat (limited to 'include/connections.php')
-rw-r--r--include/connections.php16
1 files changed, 13 insertions, 3 deletions
diff --git a/include/connections.php b/include/connections.php
index 533c5be39..e942503f0 100644
--- a/include/connections.php
+++ b/include/connections.php
@@ -379,12 +379,18 @@ function contact_remove($channel_id, $abook_id) {
intval($channel_id)
);
if($r) {
+ $already_saved = [];
foreach($r as $rr) {
$w = $x = $y = null;
- // if this isn't the parent, see if the conversation was retained
+ // optimise so we only process newly seen parent items
+ if (in_array($rr['parent'],$already_saved)) {
+ continue;
+ }
+ // if this isn't the parent, fetch the parent's item_retained and item_starred to see if the conversation
+ // should be retained
if($rr['id'] != $rr['parent']) {
- $w = q("select id from item where id = %d and item_retained = 0",
+ $w = q("select id, item_retained, item_starred from item where id = %d",
intval($rr['parent'])
);
if($w) {
@@ -394,6 +400,10 @@ function contact_remove($channel_id, $abook_id) {
intval($w[0]['id']),
intval(TERM_FILE)
);
+ if (intval($w[0]['item_retained']) || intval($w[0]['item_starred']) || $x) {
+ $already_saved[] = $rr['parent'];
+ continue;
+ }
}
}
// see if this item was filed
@@ -402,7 +412,7 @@ function contact_remove($channel_id, $abook_id) {
intval($rr['id']),
intval(TERM_FILE)
);
- if($w || $x || $y) {
+ if ($y) {
continue;
}
drop_item($rr['id'],false);