diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2022-12-09 22:39:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-09 22:39:28 +0100 |
commit | 2f7a1fca5f1e2a14bcda169b9e8e8da14e720f2c (patch) | |
tree | 72a1cca53ce8e2275ce0919ab2c5e4f555b9d42f | |
parent | 21576ff271a7cf4b4c0cc48a223bbdb4eda7351d (diff) | |
parent | e674087ebf5630834248098eefa1004a98f46468 (diff) | |
download | nextcloud-server-2f7a1fca5f1e2a14bcda169b9e8e8da14e720f2c.tar.gz nextcloud-server-2f7a1fca5f1e2a14bcda169b9e8e8da14e720f2c.zip |
Merge pull request #34477 from nextcloud/bugfix/noid/sharee-recommendations-show-group-id
Show group name instead of group id as recommendation
-rw-r--r-- | lib/private/Share20/DefaultShareProvider.php | 4 | ||||
-rw-r--r-- | tests/lib/Share20/DefaultShareProviderTest.php | 7 |
2 files changed, 11 insertions, 0 deletions
diff --git a/lib/private/Share20/DefaultShareProvider.php b/lib/private/Share20/DefaultShareProvider.php index c78cf62e069..a5a5568788d 100644 --- a/lib/private/Share20/DefaultShareProvider.php +++ b/lib/private/Share20/DefaultShareProvider.php @@ -1087,6 +1087,10 @@ class DefaultShareProvider implements IShareProvider { } } elseif ($share->getShareType() === IShare::TYPE_GROUP) { $share->setSharedWith($data['share_with']); + $group = $this->groupManager->get($data['share_with']); + if ($group !== null) { + $share->setSharedWithDisplayName($group->getDisplayName()); + } } elseif ($share->getShareType() === IShare::TYPE_LINK) { $share->setPassword($data['password']); $share->setSendPasswordByTalk((bool)$data['password_by_talk']); diff --git a/tests/lib/Share20/DefaultShareProviderTest.php b/tests/lib/Share20/DefaultShareProviderTest.php index ed2bc2a4eda..d7b5dbc9b74 100644 --- a/tests/lib/Share20/DefaultShareProviderTest.php +++ b/tests/lib/Share20/DefaultShareProviderTest.php @@ -365,6 +365,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $group0 = $this->createMock(IGroup::class); $group0->method('inGroup')->with($user1)->willReturn(true); + $group0->method('getDisplayName')->willReturn('g0-displayname'); $node = $this->createMock(Folder::class); $node->method('getId')->willReturn(42); @@ -1488,6 +1489,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $group = $this->createMock(IGroup::class); $group->method('getGID')->willReturn('group'); $group->method('inGroup')->with($user2)->willReturn(true); + $group->method('getDisplayName')->willReturn('group-displayname'); $this->groupManager->method('get')->with('group')->willReturn($group); $file = $this->createMock(File::class); @@ -1559,6 +1561,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $group = $this->createMock(IGroup::class); $group->method('getGID')->willReturn('group'); $group->method('inGroup')->with($user2)->willReturn(true); + $group->method('getDisplayName')->willReturn('group-displayname'); $this->groupManager->method('get')->with('group')->willReturn($group); $file = $this->createMock(File::class); @@ -1616,6 +1619,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $group = $this->createMock(IGroup::class); $group->method('getGID')->willReturn('group'); $group->method('inGroup')->with($user2)->willReturn(false); + $group->method('getDisplayName')->willReturn('group-displayname'); $this->groupManager->method('get')->with('group')->willReturn($group); $file = $this->createMock(File::class); @@ -2002,6 +2006,7 @@ class DefaultShareProviderTest extends \Test\TestCase { for ($i = 0; $i < 2; $i++) { $group = $this->createMock(IGroup::class); $group->method('getGID')->willReturn('group'.$i); + $group->method('getDisplayName')->willReturn('group-displayname' . $i); $groups['group'.$i] = $group; } @@ -2080,6 +2085,7 @@ class DefaultShareProviderTest extends \Test\TestCase { for ($i = 0; $i < 2; $i++) { $group = $this->createMock(IGroup::class); $group->method('getGID')->willReturn('group'.$i); + $group->method('getDisplayName')->willReturn('group-displayname'.$i); $groups['group'.$i] = $group; } @@ -2196,6 +2202,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $group0 = $this->createMock(IGroup::class); $group0->method('getGID')->willReturn('group0'); $group0->method('inGroup')->with($user0)->willReturn(true); + $group0->method('getDisplayName')->willReturn('group0-displayname'); $this->groupManager->method('get')->with('group0')->willReturn($group0); |