]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Contact.php
Replace reference to post plink by author base URL
[friendica.git] / src / Model / Contact.php
index 3ca84515a9af54d71b4d05d8999c43d46f2e8bd7..35ca4e49eb8106d0ef106d566d402b4945e9425e 100644 (file)
@@ -22,7 +22,9 @@
 namespace Friendica\Model;
 
 use Friendica\Contact\Avatar;
+use Friendica\Contact\Header;
 use Friendica\Contact\Introduction\Exception\IntroductionNotFoundException;
+use Friendica\Contact\LocalRelationship\Entity\LocalRelationship;
 use Friendica\Content\Conversation as ConversationContent;
 use Friendica\Content\Pager;
 use Friendica\Content\Text\HTML;
@@ -111,10 +113,14 @@ class Contact
         * @}
         */
 
-       const MIRROR_DEACTIVATED = 0;
-       const MIRROR_FORWARDED = 1; // Deprecated, now does the same like MIRROR_OWN_POST
-       const MIRROR_OWN_POST = 2;
-       const MIRROR_NATIVE_RESHARE = 3;
+       /** @deprecated Use Entity\LocalRelationship::MIRROR_DEACTIVATED instead */
+       const MIRROR_DEACTIVATED = LocalRelationship::MIRROR_DEACTIVATED;
+       /** @deprecated Now does the same as MIRROR_OWN_POST */
+       const MIRROR_FORWARDED = 1;
+       /** @deprecated Use Entity\LocalRelationship::MIRROR_OWN_POST instead */
+       const MIRROR_OWN_POST = LocalRelationship::MIRROR_OWN_POST;
+       /** @deprecated Use Entity\LocalRelationship::MIRROR_NATIVE_RESHARE instead */
+       const MIRROR_NATIVE_RESHARE = LocalRelationship::MIRROR_NATIVE_RESHARE;
 
        /**
         * @param array $fields    Array of selected fields, empty for all
@@ -782,10 +788,10 @@ class Contact
        /**
         * Updates the self-contact for the provided user id
         *
-        * @param int   $uid
-        * @param bool  $update_avatar Force the avatar update
+        * @param int  $uid
+        * @param bool $update_avatar Force the avatar update
         * @return bool "true" if updated
-        * @throws HTTPException\InternalServerErrorException
+        * @throws \Exception
         */
        public static function updateSelfFromUserID(int $uid, bool $update_avatar = false): bool
        {
@@ -799,7 +805,7 @@ class Contact
                        return false;
                }
 
-               $fields = ['uid', 'nickname', 'page-flags', 'account-type', 'prvkey', 'pubkey'];
+               $fields = ['uid', 'username', 'nickname', 'page-flags', 'account-type', 'prvkey', 'pubkey'];
                $user = DBA::selectFirst('user', $fields, ['uid' => $uid, 'account_expired' => false]);
                if (!DBA::isResult($user)) {
                        return false;
@@ -818,7 +824,7 @@ class Contact
                $url = DI::baseUrl() . '/profile/' . $user['nickname'];
 
                $fields = [
-                       'name'         => $profile['name'],
+                       'name'         => $user['username'],
                        'nick'         => $user['nickname'],
                        'avatar-date'  => $self['avatar-date'],
                        'location'     => Profile::formatLocation($profile),
@@ -841,7 +847,6 @@ class Contact
                        'confirm'      => DI::baseUrl() . '/dfrn_confirm/' . $user['nickname'],
                ];
 
-
                $avatar = Photo::selectFirst(['resource-id', 'type'], ['uid' => $uid, 'profile' => true]);
                if (DBA::isResult($avatar)) {
                        if ($update_avatar) {
@@ -1895,13 +1900,7 @@ class Contact
                switch ($platform) {
                        case 'friendica':
                        case 'friendika':
-                               /**
-                                * Picture credits
-                                * @author  Lostinlight <https://mastodon.xyz/@lightone>
-                                * @license CC0 https://creativecommons.org/share-your-work/public-domain/cc0/
-                                * @link    https://gitlab.com/lostinlight/per_aspera_ad_astra/-/blob/master/friendica-404/friendica-promo-bubbles.jpg
-                                */
-                               $header = DI::baseUrl() . '/images/friendica-banner.jpg';
+                               $header = DI::baseUrl() . (new Header(DI::config()))->getMastodonBannerPath();
                                break;
                        case 'diaspora':
                                /**