Skip to content

Commit

Permalink
Merge branch 'issue-581-fix-postgres-sharing'
Browse files Browse the repository at this point in the history
Signed-off-by: binsky <[email protected]>
  • Loading branch information
binsky08 committed Jun 25, 2023
2 parents b4f6ec0 + 3cfb3bd commit 04c2d27
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
5 changes: 2 additions & 3 deletions lib/Db/ShareRequestMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,14 @@ public function getRequestByItemAndVaultGuid(string $item_guid, string $target_v
* @return Entity[]
* @throws Exception
*/
public function getRequestsByItemGuidGroupedByUser(string $item_guid) {
public function getRequestsByItemGuid(string $item_guid) {
if (strtolower($this->db->getDatabasePlatform()->getName()) === 'mysql') {
$this->db->executeQuery("SET sql_mode = '';");
}
$qb = $this->db->getQueryBuilder();
$qb->select('*')
->from(self::TABLE_NAME)
->where($qb->expr()->eq('item_guid', $qb->createNamedParameter($item_guid, IQueryBuilder::PARAM_STR)))
->groupBy('target_user_id');
->where($qb->expr()->eq('item_guid', $qb->createNamedParameter($item_guid, IQueryBuilder::PARAM_STR)));

return $this->findEntities($qb);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Service/ShareService.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ public function getVaultAclList(string $user_id, string $vault_guid) {
* @throws Exception
*/
public function getCredentialPendingAclList(string $item_guid) {
return $this->shareRequest->getRequestsByItemGuidGroupedByUser($item_guid);
return $this->shareRequest->getRequestsByItemGuid($item_guid);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/lib/Db/ShareRequestMapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function testCreateRequest() {
}

/**
* @covers ::getRequestsByItemGuidGroupedByUser
* @covers ::getRequestsByItemGuid
*/
public function testGetRequestsByItemGuidGroupedByUser() {
$dataset = $this->findInDataset(
Expand All @@ -121,7 +121,7 @@ public function testGetRequestsByItemGuidGroupedByUser() {
$this->dataset->getRow(0)['item_guid']
);

$result = $this->mapper->getRequestsByItemGuidGroupedByUser($dataset[0]['item_guid']);
$result = $this->mapper->getRequestsByItemGuid($dataset[0]['item_guid']);

$this->assertCount(count($dataset), $result);

Expand Down

0 comments on commit 04c2d27

Please sign in to comment.