]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Contact/Profile.php
Merge pull request #13337 from annando/block-chatgpt
[friendica.git] / src / Module / Contact / Profile.php
index 886798a5f83a672403b88b5508c168d9e18e6bd1..090f7cd86a21c1e4011b3d0e212e9c00261aeb7c 100644 (file)
@@ -37,7 +37,7 @@ use Friendica\Core\Renderer;
 use Friendica\Database\DBA;
 use Friendica\DI;
 use Friendica\Model\Contact;
-use Friendica\Model\Group;
+use Friendica\Model\Circle;
 use Friendica\Module;
 use Friendica\Module\Response;
 use Friendica\Network\HTTPException;
@@ -197,7 +197,7 @@ class Profile extends BaseModule
                                        Contact\User::setIgnored($contact['id'], DI::userSession()->getLocalUserId(), true);
                                        $message = $this->t('Contact has been ignored');
                                }
-       
+
                                // @TODO: add $this->localRelationship->save($localRelationship);
                                DI::sysmsg()->addInfo($message);
                        }
@@ -207,13 +207,13 @@ class Profile extends BaseModule
                                        // @TODO Backward compatibility, replace with $localRelationship->unblock()
                                        Contact\User::setCollapsed($contact['id'], DI::userSession()->getLocalUserId(), false);
 
-                                       $message = $this->t('Contact has been collapsed');
+                                       $message = $this->t('Contact has been uncollapsed');
                                } else {
                                        // @TODO Backward compatibility, replace with $localRelationship->block()
                                        Contact\User::setCollapsed($contact['id'], DI::userSession()->getLocalUserId(), true);
                                        $message = $this->t('Contact has been collapsed');
                                }
-                                       
+
                                // @TODO: add $this->localRelationship->save($localRelationship);
                                DI::sysmsg()->addInfo($message);
                        }
@@ -222,13 +222,13 @@ class Profile extends BaseModule
                }
 
                $vcard_widget  = Widget\VCard::getHTML($contact);
-               $groups_widget = '';
+               $circles_widget = '';
 
                if (!in_array($localRelationship->rel, [Contact::NOTHING, Contact::SELF])) {
-                       $groups_widget = Group::sidebarWidget('contact', 'group', 'full', 'everyone', $data['user']);
+                       $circles_widget = Circle::sidebarWidget('contact', 'circle', 'full', 'everyone', $data['user']);
                }
 
-               $this->page['aside'] .= $vcard_widget . $groups_widget;
+               $this->page['aside'] .= $vcard_widget . $circles_widget;
 
                $o = '';
                Nav::setSelected('contact');
@@ -236,12 +236,8 @@ class Profile extends BaseModule
                $_SESSION['return_path'] = $this->args->getQueryString();
 
                $this->page['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('contact_head.tpl'), [
-                       '$baseurl' => $this->baseUrl->get(true),
                ]);
 
-               $contact['blocked']  = Contact\User::isBlocked($contact['id'], DI::userSession()->getLocalUserId());
-               $contact['readonly'] = Contact\User::isIgnored($contact['id'], DI::userSession()->getLocalUserId());
-
                switch ($localRelationship->rel) {
                        case Contact::FRIEND:   $relation_text = $this->t('You are mutual friends with %s', $contact['name']); break;
                        case Contact::FOLLOWER: $relation_text = $this->t('You are sharing with %s', $contact['name']); break;
@@ -250,7 +246,7 @@ class Profile extends BaseModule
                                $relation_text = '';
                }
 
-               if (!in_array($contact['network'], array_merge(Protocol::FEDERATED, [Protocol::TWITTER]))) {
+               if (!Protocol::supportsFollow($contact['network'])) {
                        $relation_text = '';
                }
 
@@ -287,10 +283,10 @@ class Profile extends BaseModule
                                $localRelationship->fetchFurtherInformation,
                                $this->t('Fetch information like preview pictures, title and teaser from the feed item. You can activate this if the feed doesn\'t contain much text. Keywords are taken from the meta header in the feed item and are posted as hash tags.'),
                                [
-                                       '0' => $this->t('Disabled'),
-                                       '1' => $this->t('Fetch information'),
-                                       '3' => $this->t('Fetch keywords'),
-                                       '2' => $this->t('Fetch information and keywords')
+                                       Entity\LocalRelationship::FFI_NONE        => $this->t('Disabled'),
+                                       Entity\LocalRelationship::FFI_INFORMATION => $this->t('Fetch information'),
+                                       Entity\LocalRelationship::FFI_KEYWORD     => $this->t('Fetch keywords'),
+                                       Entity\LocalRelationship::FFI_BOTH        => $this->t('Fetch information and keywords')
                                ]
                        ];
                }
@@ -361,16 +357,13 @@ class Profile extends BaseModule
                        '$last_update'               => $last_update,
                        '$udnow'                     => $this->t('Update now'),
                        '$contact_id'                => $contact['id'],
-                       '$block_text'                => ($contact['blocked'] ? $this->t('Unblock') : $this->t('Block')),
-                       '$ignore_text'               => ($contact['readonly'] ? $this->t('Unignore') : $this->t('Ignore')),
+                       '$pending'                   => $localRelationship->pending   ? $this->t('Awaiting connection acknowledge') : '',
+                       '$blocked'                   => $localRelationship->blocked   ? $this->t('Currently blocked') : '',
+                       '$ignored'                   => $localRelationship->ignored   ? $this->t('Currently ignored') : '',
+                       '$collapsed'                 => $localRelationship->collapsed ? $this->t('Currently collapsed') : '',
+                       '$archived'                  => ($contact['archive'] ? $this->t('Currently archived') : ''),
                        '$insecure'                  => (in_array($contact['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::MAIL, Protocol::DIASPORA]) ? '' : $insecure),
-                       '$info'                      => $localRelationship->info,
                        '$cinfo'                     => ['info', '', $localRelationship->info, ''],
-                       '$blocked'                   => ($contact['blocked'] ? $this->t('Currently blocked') : ''),
-                       '$ignored'                   => ($contact['readonly'] ? $this->t('Currently ignored') : ''),
-                       '$collapsed'                 => (Contact\User::isCollapsed($contact['id'], DI::userSession()->getLocalUserId()) ? $this->t('Currently collapsed') : ''),
-                       '$archived'                  => ($contact['archive'] ? $this->t('Currently archived') : ''),
-                       '$pending'                   => ($contact['pending'] ? $this->t('Awaiting connection acknowledge') : ''),
                        '$hidden'                    => ['hidden', $this->t('Hide this contact from others'), $localRelationship->hidden, $this->t('Replies/likes to your public posts <strong>may</strong> still be visible')],
                        '$notify_new_posts'          => ['notify_new_posts', $this->t('Notification for new posts'), ($localRelationship->notifyNewPosts), $this->t('Send a notification of every new post of this contact')],
                        '$fetch_further_information' => $fetch_further_information,
@@ -401,7 +394,7 @@ class Profile extends BaseModule
                        '$remote_self'               => [
                                'remote_self',
                                $this->t('Mirror postings from this contact'),
-                               $localRelationship->isRemoteSelf,
+                               $localRelationship->remoteSelf,
                                $this->t('Mark this contact as remote_self, this will cause friendica to repost new entries from this contact.'),
                                $remote_self_options
                        ],
@@ -470,7 +463,7 @@ class Profile extends BaseModule
                        ];
                }
 
-               if (in_array($contact['network'], Protocol::NATIVE_SUPPORT)) {
+               if (Protocol::supportsProbe($contact['network'])) {
                        $contact_actions['updateprofile'] = [
                                'label' => $this->t('Refetch contact data'),
                                'url'   => 'contact/' . $contact['id'] . '/updateprofile?t=' . $formSecurityToken,