]> git.mxchange.org Git - friendica.git/commitdiff
Don't display the "follow/unfollow" vcard-link on pages meant for follow/unfollow
authorMichael <heluecht@pirati.ca>
Sat, 6 Apr 2024 08:28:32 +0000 (08:28 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 7 Apr 2024 21:30:39 +0000 (21:30 +0000)
src/Content/Widget/VCard.php
src/Module/Contact/Follow.php
src/Module/Contact/Unfollow.php
src/Module/Profile/RemoteFollow.php

index 30718cc424867f55ed85859d162868ddd318e294..c254bb0967f3f686b698af791a884727ec63387a 100644 (file)
@@ -43,9 +43,10 @@ class VCard
         * @template widget/vcard.tpl
         * @param array $contact
         * @param bool  $hide_mention
+        * @param bool  $hide_follow
         * @return string
         */
-       public static function getHTML(array $contact, bool $hide_mention = false): string
+       public static function getHTML(array $contact, bool $hide_mention = false, bool $hide_follow = false): string
        {
                if (!isset($contact['network']) || !isset($contact['id'])) {
                        Logger::warning('Incomplete contact', ['contact' => $contact ?? []]);
@@ -87,7 +88,7 @@ class VCard
                                }
                        }
 
-                       if (empty($contact['self']) && Protocol::supportsFollow($contact['network'])) {
+                       if (!$hide_follow && empty($contact['self']) && Protocol::supportsFollow($contact['network'])) {
                                if (in_array($rel, [Contact::SHARING, Contact::FRIEND])) {
                                        $unfollow_link = 'contact/unfollow?url=' . urlencode($contact_url) . '&auto=1';
                                } elseif (!$pending) {
index 28a13da033bdc0e9c6a158234fdcff1c1522106f..ece0d0e4ba2b349d9a7be69c0fd897a5c572ed35 100644 (file)
@@ -186,7 +186,7 @@ class Follow extends BaseModule
                $this->page['aside'] = '';
 
                if (!in_array($protocol, [Protocol::PHANTOM, Protocol::MAIL])) {
-                       $this->page['aside'] = VCard::getHTML($contact);
+                       $this->page['aside'] = VCard::getHTML($contact, false, true);
 
                        $output .= Renderer::replaceMacros(Renderer::getMarkupTemplate('section_title.tpl'),
                                ['$title' => $this->t('Posts and Replies')]
index b9cdfc80d310e9555435f456772b11928c2aa9fd..eb855d7fb6087e5df9fb18eff55c8a372d845334 100644 (file)
@@ -133,7 +133,7 @@ class Unfollow extends \Friendica\BaseModule
                        '$keywords_label' => ''
                ]);
 
-               $this->page['aside'] = Widget\VCard::getHTML(Contact::getByURL($contact['url'], false));
+               $this->page['aside'] = Widget\VCard::getHTML(Contact::getByURL($contact['url'], false), false, true);
 
                $o .= Renderer::replaceMacros(Renderer::getMarkupTemplate('section_title.tpl'), ['$title' => $this->t('Posts and Replies')]);
 
index df6f885b8d484497d9520602b15d43d7465152ae..5871f542e299582a2b074c77a0d6070aab542664 100644 (file)
@@ -118,7 +118,7 @@ class RemoteFollow extends BaseModule
 
        protected function content(array $request = []): string
        {
-               $this->page['aside'] = Widget\VCard::getHTML($this->owner);
+               $this->page['aside'] = Widget\VCard::getHTML($this->owner, false, true);
 
                $target_addr = $this->owner['addr'];
                $target_url  = $this->owner['url'];