From 7e732839491f83ea3b3618aee8f38fab9f881995 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 8 Sep 2023 15:01:51 +0000 Subject: [PATCH 1/4] The query condition for active users are unified --- mod/lostpass.php | 2 +- src/Model/Contact.php | 4 ++-- src/Model/Profile.php | 4 ++-- src/Model/User.php | 23 +++++++++++------------ src/Module/Moderation/BaseUsers.php | 2 +- src/Module/Moderation/Users/Active.php | 2 +- src/Module/OStatus/PubSub.php | 4 ++-- src/Module/OStatus/PubSubHubBub.php | 2 +- src/Module/OStatus/Salmon.php | 2 +- src/Module/Profile/Profile.php | 2 +- src/Module/Security/OpenID.php | 2 +- src/Protocol/DFRN.php | 2 +- src/Protocol/Diaspora.php | 5 +---- src/Worker/Cron.php | 2 +- src/Worker/Directory.php | 2 +- src/Worker/ExpireAndRemoveUsers.php | 2 +- src/Worker/PollContacts.php | 4 ++-- src/Worker/UpdatePhotoAlbums.php | 2 +- src/Worker/UpdateScores.php | 2 +- 19 files changed, 33 insertions(+), 37 deletions(-) diff --git a/mod/lostpass.php b/mod/lostpass.php index 6505db549..5eb53ae2f 100644 --- a/mod/lostpass.php +++ b/mod/lostpass.php @@ -34,7 +34,7 @@ function lostpass_post(App $a) DI::baseUrl()->redirect(); } - $condition = ['(`email` = ? OR `nickname` = ?) AND `verified` = 1 AND `blocked` = 0 AND `account_removed` = 0 AND `account_expired` = 0', $loginame, $loginame]; + $condition = ['(`email` = ? OR `nickname` = ?) AND `verified` AND NOT `blocked` AND NOT `account_removed` AND NOT `account_expired`', $loginame, $loginame]; $user = DBA::selectFirst('user', ['uid', 'username', 'nickname', 'email', 'language'], $condition); if (!DBA::isResult($user)) { DI::sysmsg()->addNotice(DI::l10n()->t('No valid account found.')); diff --git a/src/Model/Contact.php b/src/Model/Contact.php index 944ff39cd..243b48ad1 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -750,7 +750,7 @@ class Contact $user = DBA::selectFirst( 'user', ['uid', 'username', 'nickname', 'pubkey', 'prvkey'], - ['uid' => $uid, 'account_expired' => false] + ['uid' => $uid, 'verified' => true, 'blocked' => false, 'account_removed' => false, 'account_expired' => false] ); if (!DBA::isResult($user)) { return false; @@ -822,7 +822,7 @@ class Contact } $fields = ['uid', 'username', 'nickname', 'page-flags', 'account-type', 'prvkey', 'pubkey']; - $user = DBA::selectFirst('user', $fields, ['uid' => $uid, 'account_expired' => false]); + $user = DBA::selectFirst('user', $fields, ['uid' => $uid, 'verified' => true, 'blocked' => false, 'account_removed' => false, 'account_expired' => false]); if (!DBA::isResult($user)) { return false; } diff --git a/src/Model/Profile.php b/src/Model/Profile.php index c1a350673..b80c83881 100644 --- a/src/Model/Profile.php +++ b/src/Model/Profile.php @@ -940,7 +940,7 @@ class Profile if (!empty($search)) { $publish = (DI::config()->get('system', 'publish_all') ? '' : "AND `publish` "); $searchTerm = '%' . $search . '%'; - $condition = ["NOT `blocked` AND NOT `account_removed` + $condition = ["`verified` AND NOT `blocked` AND NOT `account_removed` AND NOT `account_expired` $publish AND ((`name` LIKE ?) OR (`nickname` LIKE ?) OR @@ -953,7 +953,7 @@ class Profile $searchTerm, $searchTerm, $searchTerm, $searchTerm, $searchTerm, $searchTerm, $searchTerm, $searchTerm]; } else { - $condition = ['blocked' => false, 'account_removed' => false]; + $condition = ['verified' => true, 'blocked' => false, 'account_removed' => false, 'account_expired' => false]; if (!DI::config()->get('system', 'publish_all')) { $condition['publish'] = true; } diff --git a/src/Model/User.php b/src/Model/User.php index b4df99d82..3505f3b7a 100644 --- a/src/Model/User.php +++ b/src/Model/User.php @@ -280,8 +280,7 @@ class User // List of possible actor names $possible_accounts = ['friendica', 'actor', 'system', 'internal']; foreach ($possible_accounts as $name) { - if (!DBA::exists('user', ['nickname' => $name, 'account_removed' => false, 'account_expired' => false]) && - !DBA::exists('userd', ['username' => $name])) { + if (!DBA::exists('user', ['nickname' => $name]) && DBA::exists('userd', ['username' => $name])) { DI::config()->set('system', 'actor_name', $name); return $name; } @@ -326,7 +325,7 @@ class User public static function getByGuid(string $guid, array $fields = [], bool $active = true) { if ($active) { - $cond = ['guid' => $guid, 'account_expired' => false, 'account_removed' => false]; + $cond = ['guid' => $guid, 'verified' => true, 'blocked' => false, 'account_removed' => false, 'account_expired' => false]; } else { $cond = ['guid' => $guid]; } @@ -702,7 +701,7 @@ class User $fields = ['uid', 'nickname', 'password', 'legacy_password']; $condition = [ "(`email` = ? OR `username` = ? OR `nickname` = ?) - AND NOT `blocked` AND NOT `account_expired` AND NOT `account_removed` AND `verified`", + AND `verified` AND NOT `blocked` AND NOT `account_removed` AND NOT `account_expired`", $user_info, $user_info, $user_info ]; $user = DBA::selectFirst('user', $fields, $condition); @@ -738,7 +737,7 @@ class User if ($user['last-activity'] != $current_day) { User::update(['last-activity' => $current_day], $uid); // Set the last activity for all identities of the user - DBA::update('user', ['last-activity' => $current_day], ['parent-uid' => $uid, 'account_removed' => false]); + DBA::update('user', ['last-activity' => $current_day], ['parent-uid' => $uid, 'verified' => true, 'blocked' => false, 'account_removed' => false, 'account_expired' => false]); } } @@ -1703,7 +1702,7 @@ class User $identities = []; - $user = DBA::selectFirst('user', ['uid', 'nickname', 'username', 'parent-uid'], ['uid' => $uid]); + $user = DBA::selectFirst('user', ['uid', 'nickname', 'username', 'parent-uid'], ['uid' => $uid, 'verified' => true, 'blocked' => false, 'account_removed' => false, 'account_expired' => false]); if (!DBA::isResult($user)) { return $identities; } @@ -1720,7 +1719,7 @@ class User $r = DBA::select( 'user', ['uid', 'username', 'nickname'], - ['parent-uid' => $user['uid'], 'account_removed' => false] + ['parent-uid' => $user['uid'], 'verified' => true, 'blocked' => false, 'account_removed' => false, 'account_expired' => false] ); if (DBA::isResult($r)) { $identities = array_merge($identities, DBA::toArray($r)); @@ -1730,7 +1729,7 @@ class User $r = DBA::select( 'user', ['uid', 'username', 'nickname'], - ['uid' => $user['parent-uid'], 'account_removed' => false] + ['uid' => $user['parent-uid'], 'verified' => true, 'blocked' => false, 'account_removed' => false, 'account_expired' => false] ); if (DBA::isResult($r)) { $identities = DBA::toArray($r); @@ -1740,7 +1739,7 @@ class User $r = DBA::select( 'user', ['uid', 'username', 'nickname'], - ['parent-uid' => $user['parent-uid'], 'account_removed' => false] + ['parent-uid' => $user['parent-uid'], 'verified' => true, 'blocked' => false, 'account_removed' => false, 'account_expired' => false] ); if (DBA::isResult($r)) { $identities = array_merge($identities, DBA::toArray($r)); @@ -1751,7 +1750,7 @@ class User "SELECT `user`.`uid`, `user`.`username`, `user`.`nickname` FROM `manage` INNER JOIN `user` ON `manage`.`mid` = `user`.`uid` - WHERE `user`.`account_removed` = 0 AND `manage`.`uid` = ?", + WHERE NOT `user`.`account_removed` AND `manage`.`uid` = ?", $user['uid'] ); if (DBA::isResult($r)) { @@ -1773,7 +1772,7 @@ class User return false; } - $user = DBA::selectFirst('user', ['parent-uid'], ['uid' => $uid, 'account_removed' => false]); + $user = DBA::selectFirst('user', ['parent-uid'], ['uid' => $uid, 'verified' => true, 'blocked' => false, 'account_removed' => false, 'account_expired' => false]); if (!DBA::isResult($user)) { return false; } @@ -1782,7 +1781,7 @@ class User return true; } - if (DBA::exists('user', ['parent-uid' => $uid, 'account_removed' => false])) { + if (DBA::exists('user', ['parent-uid' => $uid, 'verified' => true, 'blocked' => false, 'account_removed' => false, 'account_expired' => false])) { return true; } diff --git a/src/Module/Moderation/BaseUsers.php b/src/Module/Moderation/BaseUsers.php index 2d352dbdc..33a013961 100644 --- a/src/Module/Moderation/BaseUsers.php +++ b/src/Module/Moderation/BaseUsers.php @@ -59,7 +59,7 @@ abstract class BaseUsers extends BaseModeration protected function getTabsHTML(string $selectedTab): string { $all = $this->database->count('user', ["`uid` != ?", 0]); - $active = $this->database->count('user', ["NOT `blocked` AND `verified` AND NOT `account_removed` AND `uid` != ?", 0]); + $active = $this->database->count('user', ["`verified` AND NOT `blocked` AND NOT `account_removed` AND NOT `account_expired` AND `uid` != ?", 0]); $pending = Register::getPendingCount(); $blocked = $this->database->count('user', ['blocked' => true, 'verified' => true, 'account_removed' => false]); $deleted = $this->database->count('user', ['account_removed' => true]); diff --git a/src/Module/Moderation/Users/Active.php b/src/Module/Moderation/Users/Active.php index c4805b7b0..1476578e0 100644 --- a/src/Module/Moderation/Users/Active.php +++ b/src/Module/Moderation/Users/Active.php @@ -125,7 +125,7 @@ class Active extends BaseUsers $th_users = array_map(null, [$this->t('Name'), $this->t('Email'), $this->t('Register date'), $this->t('Last login'), $this->t('Last public item'), $this->t('Type')], $valid_orders); - $count = $this->database->count('user', ["NOT `blocked` AND `verified` AND NOT `account_removed` AND `uid` != ?", 0]); + $count = $this->database->count('user', ["`verified` AND NOT `blocked` AND NOT `account_removed` AND NOT `account_expired` AND `uid` != ?", 0]); $t = Renderer::getMarkupTemplate('moderation/users/active.tpl'); return self::getTabsHTML('active') . Renderer::replaceMacros($t, [ diff --git a/src/Module/OStatus/PubSub.php b/src/Module/OStatus/PubSub.php index 5fbc52983..f1f3266cb 100644 --- a/src/Module/OStatus/PubSub.php +++ b/src/Module/OStatus/PubSub.php @@ -63,7 +63,7 @@ class PubSub extends \Friendica\BaseModule $nickname = $this->parameters['nickname'] ?? ''; $contact_id = $this->parameters['cid'] ?? 0; - $importer = $this->database->selectFirst('user', [], ['nickname' => $nickname, 'account_expired' => false, 'account_removed' => false]); + $importer = $this->database->selectFirst('user', [], ['nickname' => $nickname, 'verified' => true, 'blocked' => false, 'account_removed' => false, 'account_expired' => false]); if (!$importer) { throw new HTTPException\OKException(); } @@ -119,7 +119,7 @@ class PubSub extends \Friendica\BaseModule $this->logger->notice('Subscription start.', ['from' => $this->request->getRemoteAddress(), 'mode' => $hub_mode, 'nickname' => $nickname]); $this->logger->debug('Data: ', ['get' => $request]); - $owner = $this->database->selectFirst('user', ['uid'], ['nickname' => $nickname, 'account_expired' => false, 'account_removed' => false]); + $owner = $this->database->selectFirst('user', ['uid'], ['nickname' => $nickname, 'verified' => true, 'blocked' => false, 'account_removed' => false, 'account_expired' => false]); if (!$owner) { $this->logger->notice('Local account not found.', ['nickname' => $nickname]); throw new HTTPException\NotFoundException(); diff --git a/src/Module/OStatus/PubSubHubBub.php b/src/Module/OStatus/PubSubHubBub.php index caaa31f98..c8fcb4249 100644 --- a/src/Module/OStatus/PubSubHubBub.php +++ b/src/Module/OStatus/PubSubHubBub.php @@ -111,7 +111,7 @@ class PubSubHubBub extends \Friendica\BaseModule } // fetch user from database given the nickname - $condition = ['nickname' => $nickname, 'account_expired' => false, 'account_removed' => false]; + $condition = ['nickname' => $nickname, 'verified' => true, 'blocked' => false, 'account_removed' => false, 'account_expired' => false]; $owner = $this->database->selectFirst('user', ['uid', 'nickname'], $condition); if (!$owner) { $this->logger->notice('Local account not found', ['nickname' => $nickname, 'topic' => $hub_topic, 'callback' => $hub_callback]); diff --git a/src/Module/OStatus/Salmon.php b/src/Module/OStatus/Salmon.php index 889d852d9..9f0648692 100644 --- a/src/Module/OStatus/Salmon.php +++ b/src/Module/OStatus/Salmon.php @@ -74,7 +74,7 @@ class Salmon extends \Friendica\BaseModule $this->logger->debug('New Salmon', ['nickname' => $nickname, 'xml' => $xml]); - $importer = $this->database->selectFirst('user', [], ['nickname' => $nickname, 'account_expired' => false, 'account_removed' => false]); + $importer = $this->database->selectFirst('user', [], ['nickname' => $nickname, 'verified' => true, 'blocked' => false, 'account_removed' => false, 'account_expired' => false]); if (!$this->database->isResult($importer)) { throw new HTTPException\InternalServerErrorException(); } diff --git a/src/Module/Profile/Profile.php b/src/Module/Profile/Profile.php index 054943c13..99262fcc5 100644 --- a/src/Module/Profile/Profile.php +++ b/src/Module/Profile/Profile.php @@ -81,7 +81,7 @@ class Profile extends BaseProfile protected function rawContent(array $request = []) { if (ActivityPub::isRequest()) { - $user = $this->database->selectFirst('user', ['uid'], ['nickname' => $this->parameters['nickname'] ?? '', 'account_removed' => false]); + $user = $this->database->selectFirst('user', ['uid'], ['nickname' => $this->parameters['nickname'] ?? '', 'verified' => true, 'blocked' => false, 'account_removed' => false, 'account_expired' => false]); if ($user) { try { $data = ActivityPub\Transmitter::getProfile($user['uid'], ActivityPub::isAcceptedRequester($user['uid'])); diff --git a/src/Module/Security/OpenID.php b/src/Module/Security/OpenID.php index e0a13954d..3db063f28 100644 --- a/src/Module/Security/OpenID.php +++ b/src/Module/Security/OpenID.php @@ -60,7 +60,7 @@ class OpenID extends BaseModule // in commit 8367cadeeffec4b6792a502847304b17ceba5882, so it might // have left mixed records in the user table // - $condition = ['blocked' => false, 'account_expired' => false, 'account_removed' => false, 'verified' => true, + $condition = ['verified' => true, 'blocked' => false, 'account_removed' => false, 'account_expired' => false, 'openid' => [$authId, Strings::normaliseOpenID($authId)]]; $dba = DI::dba(); diff --git a/src/Protocol/DFRN.php b/src/Protocol/DFRN.php index 1fcaaba7f..1ab12089d 100644 --- a/src/Protocol/DFRN.php +++ b/src/Protocol/DFRN.php @@ -88,7 +88,7 @@ class DFRN $contact['senderName'] = $contact['name']; if ($uid != 0) { - $condition = ['uid' => $uid, 'account_expired' => false, 'account_removed' => false]; + $condition = ['uid' => $uid, 'verified' => true, 'blocked' => false, 'account_removed' => false, 'account_expired' => false]; $user = DBA::selectFirst('user', [], $condition); if (!DBA::isResult($user)) { return []; diff --git a/src/Protocol/Diaspora.php b/src/Protocol/Diaspora.php index dd6c2115b..8bdb878ab 100644 --- a/src/Protocol/Diaspora.php +++ b/src/Protocol/Diaspora.php @@ -3062,10 +3062,7 @@ class Diaspora // If the item belongs to a user, we take this user id. if ($item['uid'] == 0) { // @todo Possibly use an administrator account? - $condition = [ - 'verified' => true, 'blocked' => false, - 'account_removed' => false, 'account_expired' => false, 'account-type' => User::ACCOUNT_TYPE_PERSON - ]; + $condition = ['verified' => true, 'blocked' => false, 'account_removed' => false, 'account_expired' => false, 'account-type' => User::ACCOUNT_TYPE_PERSON]; $first_user = DBA::selectFirst('user', ['uid'], $condition, ['order' => ['uid']]); $owner = User::getOwnerDataById($first_user['uid']); } else { diff --git a/src/Worker/Cron.php b/src/Worker/Cron.php index 6ba68d177..accf76d56 100644 --- a/src/Worker/Cron.php +++ b/src/Worker/Cron.php @@ -145,7 +145,7 @@ class Cron DBA::close($users); // Update contact relations for our users - $users = DBA::select('user', ['uid'], ["NOT `account_expired` AND NOT `account_removed` AND `uid` > ?", 0]); + $users = DBA::select('user', ['uid'], ["`verified` AND NOT `blocked` AND NOT `account_removed` AND NOT `account_expired` AND `uid` > ?", 0]); while ($user = DBA::fetch($users)) { Worker::add(Worker::PRIORITY_LOW, 'ContactDiscoveryForUser', $user['uid']); } diff --git a/src/Worker/Directory.php b/src/Worker/Directory.php index b66b662d4..2d56cb3c0 100644 --- a/src/Worker/Directory.php +++ b/src/Worker/Directory.php @@ -62,7 +62,7 @@ class Directory } private static function updateAll() { - $users = DBA::select('owner-view', ['url'], ['net-publish' => true, 'account_expired' => false, 'verified' => true]); + $users = DBA::select('owner-view', ['url'], ['net-publish' => true, 'verified' => true, 'blocked' => false, 'account_removed' => false, 'account_expired' => false]); while ($user = DBA::fetch($users)) { Worker::add(Worker::PRIORITY_LOW, 'Directory', $user['url']); } diff --git a/src/Worker/ExpireAndRemoveUsers.php b/src/Worker/ExpireAndRemoveUsers.php index c04741462..47c3e9a60 100644 --- a/src/Worker/ExpireAndRemoveUsers.php +++ b/src/Worker/ExpireAndRemoveUsers.php @@ -42,7 +42,7 @@ class ExpireAndRemoveUsers DBA::update('user', ['account_expired' => true], $condition); // Ensure to never remove the user with uid=0 - DBA::update('user', ['account_expired' => false, 'account_removed' => false, + DBA::update('user', ['verified' => true, 'blocked' => false, 'account_removed' => false, 'account_expired' => false, 'account_expires_on' => DBA::NULL_DATETIME], ['uid' => 0]); // Remove any freshly expired account diff --git a/src/Worker/PollContacts.php b/src/Worker/PollContacts.php index 81ce0f8f0..80b7ae445 100644 --- a/src/Worker/PollContacts.php +++ b/src/Worker/PollContacts.php @@ -45,10 +45,10 @@ class PollContacts if (!empty($abandon_days)) { $condition = DBA::mergeConditions($condition, - ["`uid` != ? AND `uid` IN (SELECT `uid` FROM `user` WHERE NOT `blocked` AND NOT `account_expired` AND NOT `account_removed` AND `last-activity` > ?)", 0, DateTimeFormat::utc('now - ' . $abandon_days . ' days')]); + ["`uid` != ? AND `uid` IN (SELECT `uid` FROM `user` WHERE `verified` AND NOT `blocked` AND NOT `account_removed` AND NOT `account_expired` AND `last-activity` > ?)", 0, DateTimeFormat::utc('now - ' . $abandon_days . ' days')]); } else { $condition = DBA::mergeConditions($condition, - ["`uid` != ? AND `uid` IN (SELECT `uid` FROM `user` WHERE NOT `blocked` AND NOT `account_expired` AND NOT `account_removed`)", 0]); + ["`uid` != ? AND `uid` IN (SELECT `uid` FROM `user` WHERE `verified` AND NOT `blocked` AND NOT `account_removed` AND NOT `account_expired`)", 0]); } $contacts = DBA::select('contact', ['id', 'nick', 'name', 'network', 'archive', 'last-update', 'priority', 'rating'], $condition); diff --git a/src/Worker/UpdatePhotoAlbums.php b/src/Worker/UpdatePhotoAlbums.php index 234ee6313..a0e3bca02 100644 --- a/src/Worker/UpdatePhotoAlbums.php +++ b/src/Worker/UpdatePhotoAlbums.php @@ -31,7 +31,7 @@ class UpdatePhotoAlbums { public static function execute() { - $users = DBA::select('user', ['uid'], ['account_expired' => false, 'account_removed' => false]); + $users = DBA::select('user', ['uid'], ['verified' => true, 'blocked' => false, 'account_removed' => false, 'account_expired' => false]); while ($user = DBA::fetch($users)) { Photo::clearAlbumCache($user['uid']); } diff --git a/src/Worker/UpdateScores.php b/src/Worker/UpdateScores.php index 1f02bf415..f17027a09 100644 --- a/src/Worker/UpdateScores.php +++ b/src/Worker/UpdateScores.php @@ -35,7 +35,7 @@ class UpdateScores { Logger::notice('Start score update'); - $users = DBA::select('user', ['uid'], ["NOT `account_expired` AND NOT `account_removed` AND `uid` > ?", 0]); + $users = DBA::select('user', ['uid'], ["`verified` AND NOT `blocked` AND NOT `account_removed` AND NOT `account_expired` AND `uid` > ?", 0]); while ($user = DBA::fetch($users)) { Relation::calculateInteractionScore($user['uid']); } From 5d457f99e7732be00d186b10726bcb4e9abc1a88 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 8 Sep 2023 15:15:38 +0000 Subject: [PATCH 2/4] Inverse logic --- src/Model/User.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Model/User.php b/src/Model/User.php index 3505f3b7a..79e238638 100644 --- a/src/Model/User.php +++ b/src/Model/User.php @@ -280,7 +280,7 @@ class User // List of possible actor names $possible_accounts = ['friendica', 'actor', 'system', 'internal']; foreach ($possible_accounts as $name) { - if (!DBA::exists('user', ['nickname' => $name]) && DBA::exists('userd', ['username' => $name])) { + if (!DBA::exists('user', ['nickname' => $name]) && !DBA::exists('userd', ['username' => $name])) { DI::config()->set('system', 'actor_name', $name); return $name; } From 6288b5cc51297f0f6b311bfc8417fb7b6dc98f13 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 8 Sep 2023 16:32:36 +0000 Subject: [PATCH 3/4] Fix tests --- tests/src/Model/UserTest.php | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/tests/src/Model/UserTest.php b/tests/src/Model/UserTest.php index 939d28245..e7b1e0458 100644 --- a/tests/src/Model/UserTest.php +++ b/tests/src/Model/UserTest.php @@ -50,21 +50,33 @@ class UserTest extends MockedTest DI::init($diceMock, true); $this->parent = [ - 'uid' => 1, - 'username' => 'maxmuster', - 'nickname' => 'Max Muster' + 'uid' => 1, + 'username' => 'maxmuster', + 'nickname' => 'Max Muster', + 'verified' => true, + 'blocked' => false, + 'account_removed' => false, + 'account_expired' => false, ]; $this->child = [ - 'uid' => 2, - 'username' => 'johndoe', - 'nickname' => 'John Doe' + 'uid' => 2, + 'username' => 'johndoe', + 'nickname' => 'John Doe', + 'verified' => true, + 'blocked' => false, + 'account_removed' => false, + 'account_expired' => false, ]; $this->manage = [ - 'uid' => 3, - 'username' => 'janesmith', - 'nickname' => 'Jane Smith' + 'uid' => 3, + 'username' => 'janesmith', + 'nickname' => 'Jane Smith', + 'verified' => true, + 'blocked' => false, + 'account_removed' => false, + 'account_expired' => false, ]; } From 97e3ff1901e9a3cb673e499799d588733ac53528 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 8 Sep 2023 16:45:59 +0000 Subject: [PATCH 4/4] Fix test? --- tests/src/Model/UserTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/src/Model/UserTest.php b/tests/src/Model/UserTest.php index e7b1e0458..680482570 100644 --- a/tests/src/Model/UserTest.php +++ b/tests/src/Model/UserTest.php @@ -83,7 +83,7 @@ class UserTest extends MockedTest public function testIdentitiesEmpty() { $this->dbMock->shouldReceive('selectFirst')->with('user', - ['uid', 'nickname', 'username', 'parent-uid'],['uid' => $this->parent['uid']], [])->andReturn($this->parent)->once(); + ['uid', 'nickname', 'username', 'parent-uid'],['uid' => $this->parent['uid'], 'verified' => true, 'blocked' => false, 'account_removed' => false, 'account_expired' => false], [])->andReturn($this->parent)->once(); $this->dbMock->shouldReceive('isResult')->with($this->parent)->andReturn(false)->once(); $record = User::identities($this->parent['uid']); @@ -98,7 +98,7 @@ class UserTest extends MockedTest // Select the user itself (=parent) $this->dbMock->shouldReceive('selectFirst')->with('user', - ['uid', 'nickname', 'username', 'parent-uid'],['uid' => $this->parent['uid']], [])->andReturn($parentSelect)->once(); + ['uid', 'nickname', 'username', 'parent-uid'],['uid' => $this->parent['uid'], 'verified' => true, 'blocked' => false, 'account_removed' => false, 'account_expired' => false], [])->andReturn($parentSelect)->once(); $this->dbMock->shouldReceive('isResult')->with($parentSelect)->andReturn(true)->once(); // Select one child @@ -132,7 +132,7 @@ class UserTest extends MockedTest // Select the user itself (=child) $this->dbMock->shouldReceive('selectFirst')->with('user', - ['uid', 'nickname', 'username', 'parent-uid'],['uid' => $this->child['uid']], [])->andReturn($childSelect)->once(); + ['uid', 'nickname', 'username', 'parent-uid'],['uid' => $this->child['uid'], 'verified' => true, 'blocked' => false, 'account_removed' => false, 'account_expired' => false], [])->andReturn($childSelect)->once(); $this->dbMock->shouldReceive('isResult')->with($childSelect)->andReturn(true)->once(); // Select the parent