From d872a0ca86c2ec50f5be75cf6ee53dd7101fc12c Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 30 Apr 2018 14:33:35 +0200 Subject: activitypub xchans do not have an xchan_addr. use xchan_url for the follow button if we do not find an xchan_addr --- include/connections.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/connections.php') diff --git a/include/connections.php b/include/connections.php index e5bf07d96..32baa94bd 100644 --- a/include/connections.php +++ b/include/connections.php @@ -127,7 +127,7 @@ function vcard_from_xchan($xchan, $observer = null, $mode = '') { return replace_macros(get_markup_template('xchan_vcard.tpl'),array( '$name' => $xchan['xchan_name'], '$photo' => ((is_array(App::$profile) && array_key_exists('photo',App::$profile)) ? App::$profile['photo'] : $xchan['xchan_photo_l']), - '$follow' => $xchan['xchan_addr'], + '$follow' => (($xchan['xchan_addr']) ? $xchan['xchan_addr'] : $xchan['xchan_url']), '$link' => zid($xchan['xchan_url']), '$connect' => $connect, '$newwin' => (($mode === 'chanview') ? t('New window') : ''), -- cgit v1.2.3 From 5d83469621facf89884ada4036bd25b7b566b616 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 31 May 2018 16:11:51 -0700 Subject: when removing a connection, use the same rules as expire: don't remove items that are starred, filed, or that you replied to. --- include/connections.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'include/connections.php') diff --git a/include/connections.php b/include/connections.php index 32baa94bd..5a9e31950 100644 --- a/include/connections.php +++ b/include/connections.php @@ -374,14 +374,19 @@ function contact_remove($channel_id, $abook_id) { 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']), intval($channel_id) ); if($r) { + $r = fetch_post_tags($r,true); + foreach($r as $rr) { - drop_item($rr['id'],false); + $terms = get_terms_oftype($item['term'],TERM_FILE); + if(! $terms) { + drop_item($rr['id'],false); + } } } -- cgit v1.2.3 From eedfb7de3238f202e539407e7c6eaac1838f7015 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Fri, 15 Jun 2018 16:28:36 -0700 Subject: slightly more memory efficient way to drop posts of removed connections --- include/connections.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'include/connections.php') diff --git a/include/connections.php b/include/connections.php index 5a9e31950..20f7c24ff 100644 --- a/include/connections.php +++ b/include/connections.php @@ -373,23 +373,24 @@ 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", dbesc($abook['abook_xchan']), dbesc($abook['abook_xchan']), intval($channel_id) ); if($r) { - $r = fetch_post_tags($r,true); - foreach($r as $rr) { - $terms = get_terms_oftype($item['term'],TERM_FILE); - if(! $terms) { - drop_item($rr['id'],false); + $x = q("select uid from term where otype = %d and oid = %d ttype = %d limit 1", + intval(TERM_OBJ_POST), + intval($rr['id']), + intval(TERM_FILE) + ); + if($x) { + continue; } + drop_item($rr['id'],false); } } - q("delete from abook where abook_id = %d and abook_channel = %d", intval($abook['abook_id']), -- cgit v1.2.3 From 931afe98b13399342d5abb4cb13cb09efc09ecad Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 18 Jul 2018 17:05:38 -0700 Subject: mangled urls on redirects (cherry picked from commit 5ce50d0a2e15ae66765a68ba2785a87ecda57f6a) --- include/connections.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/connections.php') diff --git a/include/connections.php b/include/connections.php index 20f7c24ff..807d07220 100644 --- a/include/connections.php +++ b/include/connections.php @@ -120,7 +120,7 @@ function vcard_from_xchan($xchan, $observer = null, $mode = '') { App::$profile_uid = $xchan['channel_id']; $url = (($observer) - ? z_root() . '/magic?f=&owa=1&dest=' . $xchan['xchan_url'] . '&addr=' . $xchan['xchan_addr'] + ? z_root() . '/magic?f=&owa=1&bdest=' . bin2hex($xchan['xchan_url']) . '&addr=' . $xchan['xchan_addr'] : $xchan['xchan_url'] ); -- cgit v1.2.3