]> git.mxchange.org Git - friendica.git/commitdiff
Use "getActorName"
authorMichael <heluecht@pirati.ca>
Sat, 22 Aug 2020 18:52:37 +0000 (18:52 +0000)
committerMichael <heluecht@pirati.ca>
Sat, 22 Aug 2020 18:52:37 +0000 (18:52 +0000)
src/Model/User.php
src/Module/Admin/Site.php
src/Module/Xrd.php

index fe20857b95b59350be649c0d9acf9fcf9eddb948..2a954e6e609c6853ca63efe455aaaccb10fdaecb 100644 (file)
@@ -102,7 +102,7 @@ class User
        /**
         * Fetch the system account
         *
-        * @return return system account
+        * @return array system account
         */
        public static function getSystemAccount()
        {
@@ -128,12 +128,9 @@ class User
         */
        private static function createSystemAccount()
        {
-               $system_actor_name = DI::config()->get('system', 'actor_name');
+               $system_actor_name = self::getActorName();
                if (empty($system_actor_name)) {
-                       $system_actor_name = self::getActorName();
-                       if (empty($system_actor_name)) {
-                               return;
-                       }
+                       return;
                }
 
                $keys = Crypto::newKeypair(4096);
@@ -176,6 +173,11 @@ class User
         */
        public static function getActorName()
        {
+               $system_actor_name = DI::config()->get('system', 'actor_name');
+               if (!empty($system_actor_name)) {
+                       return $system_actor_name;
+               }
+
                // List of possible actor names
                $possible_accounts = ['friendica', 'actor', 'system', 'internal'];
                foreach ($possible_accounts as $name) {
@@ -686,7 +688,7 @@ class User
                }
 
                // Add the name of the internal actor to the "forbidden" list
-               $actor_name = DI::config()->get('system', 'actor_name');
+               $actor_name = self::getActorName();
                if (!empty($actor_name)) {
                        $forbidden[] = $actor_name;
                }
index 7033f09b9cb9ba39a9110dbe581b72541f97ffa1..64b9395dad7bed89de55ae0ba88fa490c674a84b 100644 (file)
@@ -513,11 +513,6 @@ class Site extends BaseAdmin
                get_temppath();
                get_itemcachepath();
 
-               $system_actor_name = DI::config()->get('system', 'actor_name');
-               if (empty($system_actor_name)) {
-                       $system_actor_name = User::getActorName();
-               }
-
                /* Register policy */
                $register_choices = [
                        Register::CLOSED => DI::l10n()->t('Closed'),
@@ -608,7 +603,7 @@ class Site extends BaseAdmin
                        // name, label, value, help string, extra data...
                        '$sitename'         => ['sitename', DI::l10n()->t('Site name'), DI::config()->get('config', 'sitename'), ''],
                        '$sender_email'     => ['sender_email', DI::l10n()->t('Sender Email'), DI::config()->get('config', 'sender_email'), DI::l10n()->t('The email address your server shall use to send notification emails from.'), '', '', 'email'],
-                       '$system_actor_name' => ['system_actor_name', DI::l10n()->t('Name of the system actor'), $system_actor_name, DI::l10n()->t("Name of the internal system account that is used to perform ActivityPub requests. This must be an unused username. If set, this shouldn't be changed again.")],
+                       '$system_actor_name' => ['system_actor_name', DI::l10n()->t('Name of the system actor'), User::getActorName(), DI::l10n()->t("Name of the internal system account that is used to perform ActivityPub requests. This must be an unused username. If set, this shouldn't be changed again.")],
                        '$banner'           => ['banner', DI::l10n()->t('Banner/Logo'), $banner, ''],
                        '$email_banner'     => ['email_banner', DI::l10n()->t('Email Banner/Logo'), $email_banner, ''],
                        '$shortcut_icon'    => ['shortcut_icon', DI::l10n()->t('Shortcut icon'), DI::config()->get('system', 'shortcut_icon'), DI::l10n()->t('Link to an icon that will be used for browsers.')],
index 87adef5cfc9e4736958cfcee225fafccb712a397..be6a3bf9c58519341a917f725d20f19258f91e7c 100644 (file)
@@ -78,7 +78,7 @@ class Xrd extends BaseModule
                        $name = substr($local, 0, strpos($local, '@'));
                }
 
-               if ($name == DI::config()->get('system', 'actor_name')) {
+               if ($name == User::getActorName()) {
                        $owner = User::getSystemAccount();
                        if (empty($owner)) {
                                throw new \Friendica\Network\HTTPException\NotFoundException();