Merge pull request #34477 from nextcloud/bugfix/noid/sharee-recommendations-show-group-id

Show group name instead of group id as recommendation
This commit is contained in:
Joas Schilling 2022-12-09 22:39:28 +01:00 committed by GitHub
commit 2f7a1fca5f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View file

@ -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']);

View file

@ -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);