]> git.mxchange.org Git - friendica.git/commitdiff
Use "account-type" instead of "page-flags"
authorMichael <heluecht@pirati.ca>
Wed, 9 Feb 2022 05:56:12 +0000 (05:56 +0000)
committerMichael <heluecht@pirati.ca>
Wed, 9 Feb 2022 05:56:12 +0000 (05:56 +0000)
src/Module/Profile/Status.php
src/Module/Settings/Profile/Index.php
src/Navigation/Notifications/Repository/Notify.php
src/Protocol/ActivityPub/Transmitter.php
src/Protocol/DFRN.php
src/Protocol/Diaspora.php

index 2bb7b6eaa5f24eb91fd1e2f92fa293f5d26c9961..1c07281b2f5d6d193efc7e91efabacfb35b18645 100644 (file)
@@ -159,7 +159,7 @@ class Status extends BaseProfile
 
                // Does the profile page belong to a forum?
                // If not then we can improve the performance with an additional condition
-               $condition2 = ['uid' => $profile['uid'], 'page-flags' => [User::PAGE_FLAGS_COMMUNITY, User::PAGE_FLAGS_PRVGROUP]];
+               $condition2 = ['uid' => $profile['uid'], 'account-type' => User::ACCOUNT_TYPE_COMMUNITY];
                if (!DBA::exists('user', $condition2)) {
                        $condition = DBA::mergeConditions($condition, ['contact-id' => $profile['id']]);
                }
index adc4fa68db7b5a1de09acdaff6e5fed6240bf0f8..49130e8c574cceb95940fa577fb1ebd74a88b5b3 100644 (file)
@@ -208,7 +208,7 @@ class Index extends BaseSettings
                        '$baseurl' => DI::baseUrl()->get(true),
                ]);
 
-               $personal_account = !in_array($profile['page-flags'], [User::PAGE_FLAGS_COMMUNITY, User::PAGE_FLAGS_PRVGROUP]);
+               $personal_account = ($profile['account-type'] != User::ACCOUNT_TYPE_COMMUNITY);
 
                $tpl = Renderer::getMarkupTemplate('settings/profile/index.tpl');
                $o .= Renderer::replaceMacros($tpl, [
index 9b195a753bcf6e37968e81e44790fc3ab42c1712..6d56258b37baa2b45e2888c88a986f70e19352df 100644 (file)
@@ -216,7 +216,7 @@ class Notify extends BaseRepository
                }
 
                // Ensure that the important fields are set at any time
-               $fields = ['nickname', 'page-flags', 'notify-flags', 'language', 'username', 'email'];
+               $fields = ['nickname', 'account-type', 'notify-flags', 'language', 'username', 'email'];
                $user = DBA::selectFirst('user', $fields, ['uid' => $params['uid']]);
 
                if (!DBA::isResult($user)) {
@@ -225,7 +225,7 @@ class Notify extends BaseRepository
                }
 
                // There is no need to create notifications for forum accounts
-               if (in_array($user['page-flags'], [Model\User::PAGE_FLAGS_COMMUNITY, Model\User::PAGE_FLAGS_PRVGROUP])) {
+               if ($user['account-type'] == Model\User::ACCOUNT_TYPE_COMMUNITY) {
                        return false;
                }
 
index 0b7159ec909275b5043f1af3cd0892079fa91a2a..31c6d2295348db5bd54e4dfc0df0892627a19d98 100644 (file)
@@ -505,13 +505,13 @@ class Transmitter
         * @param array   $item       Item array
         * @param boolean $blindcopy  addressing via "bcc" or "cc"?
         * @param integer $last_id    Last item id for adding receivers
-        * @param boolean $forum_mode "true" means that we are sending content to a forum
+        * @param boolean $forum_post "true" means that we are sending content to a forum
         *
         * @return array with permission data
         * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         * @throws \ImagickException
         */
-       private static function createPermissionBlockForItem($item, $blindcopy, $last_id = 0, $forum_mode = false)
+       private static function createPermissionBlockForItem($item, $blindcopy, $last_id = 0, $forum_post = false)
        {
                if ($last_id == 0) {
                        $last_id = $item['id'];
@@ -638,7 +638,7 @@ class Transmitter
                                                        // Public thread parent post always are directed to the followers.
                                                        // This mustn't be done by posts that are directed to forum servers via the exclusive mention.
                                                        // But possibly in that case we could add the "followers" collection of the forum to the message.
-                                                       if (($item['private'] != Item::PRIVATE) && !$forum_mode) {
+                                                       if (($item['private'] != Item::PRIVATE) && !$forum_post) {
                                                                $data['cc'][] = $actor_profile['followers'];
                                                        }
                                                }
@@ -808,14 +808,14 @@ class Transmitter
         * @param integer $uid        User ID
         * @param boolean $personal   fetch personal inboxes
         * @param integer $last_id    Last item id for adding receivers
-        * @param boolean $forum_mode "true" means that we are sending content to a forum
+        * @param boolean $forum_post "true" means that we are sending content to a forum
         * @return array with inboxes
         * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         * @throws \ImagickException
         */
-       public static function fetchTargetInboxes($item, $uid, $personal = false, $last_id = 0, $forum_mode = false)
+       public static function fetchTargetInboxes($item, $uid, $personal = false, $last_id = 0, $forum_post = false)
        {
-               $permissions = self::createPermissionBlockForItem($item, true, $last_id, $forum_mode);
+               $permissions = self::createPermissionBlockForItem($item, true, $last_id, $forum_post);
                if (empty($permissions)) {
                        return [];
                }
index 3a14a0db9a6845fa7950907ef33ad76c5244d2ff..833c616ab9b2eafaf438b305757b6844a9c99d00 100644 (file)
@@ -1547,7 +1547,7 @@ class DFRN
                if ($item["thr-parent"] != $item["uri"]) {
                        $community = false;
 
-                       if ($importer["page-flags"] == User::PAGE_FLAGS_COMMUNITY || $importer["page-flags"] == User::PAGE_FLAGS_PRVGROUP) {
+                       if ($importer['account-type'] == User::ACCOUNT_TYPE_COMMUNITY) {
                                $sql_extra = "";
                                $community = true;
                                Logger::notice("possible community action");
@@ -2381,14 +2381,11 @@ class DFRN
                        return false;
                }
 
-               $user = DBA::selectFirst('user', ['page-flags', 'nickname'], ['uid' => $uid]);
+               $user = DBA::selectFirst('user', ['account-type', 'nickname'], ['uid' => $uid]);
                if (!DBA::isResult($user)) {
                        return false;
                }
 
-               $community_page = ($user['page-flags'] == User::PAGE_FLAGS_COMMUNITY);
-               $prvgroup = ($user['page-flags'] == User::PAGE_FLAGS_PRVGROUP);
-
                $link = Strings::normaliseLink(DI::baseUrl() . '/profile/' . $user['nickname']);
 
                /*
@@ -2411,7 +2408,7 @@ class DFRN
                        return false;
                }
 
-               return $community_page || $prvgroup;
+               return ($user['account-type'] == User::ACCOUNT_TYPE_COMMUNITY);
        }
 
        /**
index 45879df2aef340a08a4ccfc8afa022ac79be35a5..aba79364f406ab41eccaffd256c77ea436f4c39a 100644 (file)
@@ -859,7 +859,7 @@ class Diaspora
                        // Yes, then it is fine.
                        return true;
                        // Is it a post to a community?
-               } elseif (($contact["rel"] == Contact::FOLLOWER) && in_array($importer["page-flags"], [User::PAGE_FLAGS_COMMUNITY, User::PAGE_FLAGS_PRVGROUP])) {
+               } elseif (($contact["rel"] == Contact::FOLLOWER) && ($importer['account-type'] == User::ACCOUNT_TYPE_COMMUNITY)) {
                        // That's good
                        return true;
                        // Is the message a global user or a comment?