From 64a336ee8de35fbea9de668e2497b2dd1220fdaf Mon Sep 17 00:00:00 2001 From: Philipp Date: Sun, 17 Oct 2021 23:12:26 +0200 Subject: [PATCH] Rename method again --- src/Module/ActivityPub/Objects.php | 2 +- src/Module/Profile/Status.php | 2 +- src/Profile/ProfileField/Depository/ProfileField.php | 4 ++-- src/Protocol/ActivityPub/Transmitter.php | 2 +- src/Security/PermissionSet/Depository/PermissionSet.php | 6 +++--- .../Profile/ProfileField/Depository/ProfileFieldTest.php | 4 ++-- .../Security/PermissionSet/Depository/PermissionSetTest.php | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Module/ActivityPub/Objects.php b/src/Module/ActivityPub/Objects.php index 47d5409d5..5ee1b65d8 100644 --- a/src/Module/ActivityPub/Objects.php +++ b/src/Module/ActivityPub/Objects.php @@ -86,7 +86,7 @@ class Objects extends BaseModule $permissionSets = DI::permissionSet()->selectByContactId($requester_id, $item['uid']); if (!empty($permissionSets)) { $psid = array_merge($permissionSets->column('id'), - [DI::permissionSet()->selectPublic($item['uid'])]); + [DI::permissionSet()->selectPublicForUser($item['uid'])]); $validated = in_array($item['psid'], $psid); } } diff --git a/src/Module/Profile/Status.php b/src/Module/Profile/Status.php index c2d691f1c..e93fc5699 100644 --- a/src/Module/Profile/Status.php +++ b/src/Module/Profile/Status.php @@ -213,7 +213,7 @@ class Status extends BaseProfile $permissionSets = DI::permissionSet()->selectByContactId($remote_user, $profile['uid']); if (!empty($permissionSets)) { $condition = ['psid' => array_merge($permissionSets->column('id'), - [DI::permissionSet()->selectPublic($profile['uid'])->id])]; + [DI::permissionSet()->selectPublicForUser($profile['uid'])->id])]; } } elseif ($profile['uid'] == local_user()) { $condition = []; diff --git a/src/Profile/ProfileField/Depository/ProfileField.php b/src/Profile/ProfileField/Depository/ProfileField.php index 79bf21b49..b792edf8f 100644 --- a/src/Profile/ProfileField/Depository/ProfileField.php +++ b/src/Profile/ProfileField/Depository/ProfileField.php @@ -125,7 +125,7 @@ class ProfileField extends BaseDepository public function selectPublicFieldsByUserId(int $uid): Collection\ProfileFields { try { - $publicPermissionSet = $this->permissionSetDepository->selectPublic($uid); + $publicPermissionSet = $this->permissionSetDepository->selectPublicForUser($uid); return $this->select([ 'uid' => $uid, @@ -168,7 +168,7 @@ class ProfileField extends BaseDepository $permissionSetIds = $permissionSets->column('id'); // Includes public custom fields - $permissionSetIds[] = $this->permissionSetDepository->selectPublic($uid)->id; + $permissionSetIds[] = $this->permissionSetDepository->selectPublicForUser($uid)->id; return $this->select( ['uid' => $uid, 'psid' => $permissionSetIds], diff --git a/src/Protocol/ActivityPub/Transmitter.php b/src/Protocol/ActivityPub/Transmitter.php index f0ed0cf5a..ab7b63866 100644 --- a/src/Protocol/ActivityPub/Transmitter.php +++ b/src/Protocol/ActivityPub/Transmitter.php @@ -229,7 +229,7 @@ class Transmitter $permissionSets = DI::permissionSet()->selectByContactId($requester_id, $owner['uid']); if (!empty($permissionSets)) { $condition = ['psid' => array_merge($permissionSets->column('id'), - [DI::permissionSet()->selectPublic($owner['uid'])])]; + [DI::permissionSet()->selectPublicForUser($owner['uid'])])]; } } } diff --git a/src/Security/PermissionSet/Depository/PermissionSet.php b/src/Security/PermissionSet/Depository/PermissionSet.php index b65a933b4..09ecceaf0 100644 --- a/src/Security/PermissionSet/Depository/PermissionSet.php +++ b/src/Security/PermissionSet/Depository/PermissionSet.php @@ -202,7 +202,7 @@ class PermissionSet extends BaseDepository * * @return Entity\PermissionSet */ - public function selectPublic(int $uid): Entity\PermissionSet + public function selectPublicForUser(int $uid): Entity\PermissionSet { return $this->factory->createFromString($uid, '', '', '', '', self::PUBLIC); } @@ -222,7 +222,7 @@ class PermissionSet extends BaseDepository // Don't select/update Public permission sets if ($this->checkPublic($permissionSet)) { - return $this->selectPublic($permissionSet->uid); + return $this->selectPublicForUser($permissionSet->uid); } try { @@ -242,7 +242,7 @@ class PermissionSet extends BaseDepository { // Don't save/update the common public PermissionSet if ($this->checkPublic($permissionSet)) { - return $this->selectPublic($permissionSet->uid); + return $this->selectPublicForUser($permissionSet->uid); } $fields = $this->convertToTableRow($permissionSet); diff --git a/tests/src/Profile/ProfileField/Depository/ProfileFieldTest.php b/tests/src/Profile/ProfileField/Depository/ProfileFieldTest.php index ecd4014fa..2218deebb 100644 --- a/tests/src/Profile/ProfileField/Depository/ProfileFieldTest.php +++ b/tests/src/Profile/ProfileField/Depository/ProfileFieldTest.php @@ -136,12 +136,12 @@ class ProfileFieldTest extends DatabaseTest self::assertEquals($savedProfileField, $selectedProfileField); - $savedProfileField->update('another', 5, $this->permissionSetDepository->selectPublic(42)); + $savedProfileField->update('another', 5, $this->permissionSetDepository->selectPublicForUser(42)); self::assertEquals(PermissionSet::PUBLIC, $savedProfileField->permissionSet->id); $publicProfileField = $this->depository->save($savedProfileField); - self::assertEquals($this->permissionSetDepository->selectPublic(42), $publicProfileField->permissionSet); + self::assertEquals($this->permissionSetDepository->selectPublicForUser(42), $publicProfileField->permissionSet); self::assertEquals('another', $publicProfileField->value); self::assertEquals(5, $publicProfileField->order); } diff --git a/tests/src/Security/PermissionSet/Depository/PermissionSetTest.php b/tests/src/Security/PermissionSet/Depository/PermissionSetTest.php index a136ff84c..f5d2e22c6 100644 --- a/tests/src/Security/PermissionSet/Depository/PermissionSetTest.php +++ b/tests/src/Security/PermissionSet/Depository/PermissionSetTest.php @@ -31,7 +31,7 @@ class PermissionSetTest extends DatabaseTest public function testSelectOneByIdPublic() { - $permissionSet = $this->depository->selectPublic(1); + $permissionSet = $this->depository->selectPublicForUser(1); $this->assertInstanceOf(\Friendica\Security\PermissionSet\Entity\PermissionSet::class, $permissionSet); self::assertEmpty($permissionSet->allow_cid);