From 46242aeaae084191244008529703c964fa5b2d53 Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 4 May 2020 09:24:22 +0000 Subject: display complete perminfo only to owner --- Zotlabs/Module/Viewconnections.php | 6 ++---- include/text.php | 7 +++++-- view/tpl/contact_template.tpl | 2 +- view/tpl/micropro_card.tpl | 2 +- view/tpl/micropro_img.tpl | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Zotlabs/Module/Viewconnections.php b/Zotlabs/Module/Viewconnections.php index 320a331d1..a0c293ddf 100644 --- a/Zotlabs/Module/Viewconnections.php +++ b/Zotlabs/Module/Viewconnections.php @@ -97,7 +97,6 @@ class Viewconnections extends \Zotlabs\Web\Controller { $perminfo['connperms'] .= t('Nothing'); } - $url = chanlink_hash($rr['xchan_hash']); if($url) { $contacts[] = array( @@ -111,13 +110,12 @@ class Viewconnections extends \Zotlabs\Web\Controller { 'sparkle' => '', 'itemurl' => $rr['url'], 'network' => '', - 'perminfo' => $perminfo, + 'perminfo' => (($is_owner) ? $perminfo : (($perminfo['connpermcount'] === 0) ? $perminfo : [])), 'oneway' => $oneway ); } } - - + if($_REQUEST['aj']) { if($contacts) { $o = replace_macros(get_markup_template('viewcontactsajax.tpl'),array( diff --git a/include/text.php b/include/text.php index 6f56a0754..0202061ab 100644 --- a/include/text.php +++ b/include/text.php @@ -1010,7 +1010,7 @@ function contact_block() { if(count($r)) { $contacts = t('Connections'); - $micropro = Array(); + $micropro = []; foreach($r as $rr) { // There is no setting to discover if you are bi-directionally connected @@ -1037,6 +1037,9 @@ function contact_block() { $rr['perminfo']['connperms'] .= t('Nothing'); } + if($is_owner && $rr['perminfo']['connpermcount'] !== 0) + unset($rr['perminfo']); + $micropro[] = micropro($rr,true,'mpfriend'); } } @@ -1047,7 +1050,7 @@ function contact_block() { '$contacts' => $contacts, '$nickname' => App::$profile['channel_address'], '$viewconnections' => (($total > $shown) ? sprintf(t('View all %s connections'),$total) : ''), - '$micropro' => $micropro, + '$micropro' => $micropro )); $arr = ['contacts' => $r, 'output' => $o]; diff --git a/view/tpl/contact_template.tpl b/view/tpl/contact_template.tpl index 40495b789..73fa5adde 100755 --- a/view/tpl/contact_template.tpl +++ b/view/tpl/contact_template.tpl @@ -1,7 +1,7 @@
{{$contact.name}} - {{include "connstatus.tpl" perminfo=$contact.perminfo}} + {{if $contact.perminfo}}{{include "connstatus.tpl" perminfo=$contact.perminfo}}{{/if}}
{{$contact.name}}
diff --git a/view/tpl/micropro_card.tpl b/view/tpl/micropro_card.tpl index 1bdf92da1..058bfc14c 100644 --- a/view/tpl/micropro_card.tpl +++ b/view/tpl/micropro_card.tpl @@ -1,5 +1,5 @@ - {{include "connstatus.tpl"}} + {{if $perminfo}}{{include "connstatus.tpl"}}{{/if}} {{$name}} {{$addr}}
{{$network}}
diff --git a/view/tpl/micropro_img.tpl b/view/tpl/micropro_img.tpl index f023a2d00..98f33d119 100755 --- a/view/tpl/micropro_img.tpl +++ b/view/tpl/micropro_img.tpl @@ -1 +1 @@ - + -- cgit v1.2.3