diff options
author | Joas Schilling <coding@schilljs.com> | 2018-01-24 13:39:17 +0100 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-03-08 17:13:48 +0100 |
commit | 82137f443d050c5856071ea5cd5b3569738d6095 (patch) | |
tree | 741ccea0495214c6f82e5781b9a6fcd1cca30283 | |
parent | aef86a5f5a385840ac264e61605519a4caa7c815 (diff) | |
download | nextcloud-server-82137f443d050c5856071ea5cd5b3569738d6095.tar.gz nextcloud-server-82137f443d050c5856071ea5cd5b3569738d6095.zip |
Correctly return the group name
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r-- | lib/private/Group/MetaData.php | 2 | ||||
-rw-r--r-- | settings/Controller/GroupsController.php | 15 |
2 files changed, 6 insertions, 11 deletions
diff --git a/lib/private/Group/MetaData.php b/lib/private/Group/MetaData.php index d5c8b581f8b..99594301990 100644 --- a/lib/private/Group/MetaData.php +++ b/lib/private/Group/MetaData.php @@ -160,7 +160,7 @@ class MetaData { private function generateGroupMetaData(\OCP\IGroup $group, $userSearch) { return array( 'id' => $group->getGID(), - 'name' => $group->getGID(), + 'name' => $group->getDisplayName(), 'usercount' => $this->sorting === self::SORT_USERCOUNT ? $group->count($userSearch) : 0, ); } diff --git a/settings/Controller/GroupsController.php b/settings/Controller/GroupsController.php index 8985a76ec95..19b7c53f8b9 100644 --- a/settings/Controller/GroupsController.php +++ b/settings/Controller/GroupsController.php @@ -28,6 +28,7 @@ use OC\AppFramework\Http; use OC\Group\MetaData; use OCP\AppFramework\Controller; use OCP\AppFramework\Http\DataResponse; +use OCP\IGroup; use OCP\IGroupManager; use OCP\IL10N; use OCP\IRequest; @@ -108,13 +109,9 @@ class GroupsController extends Controller { Http::STATUS_CONFLICT ); } - if($this->groupManager->createGroup($id)) { - return new DataResponse( - array( - 'groupname' => $id - ), - Http::STATUS_CREATED - ); + $group = $this->groupManager->createGroup($id); + if($group instanceof IGroup) { + return new DataResponse(['groupname' => $group->getDisplayName()], Http::STATUS_CREATED); } return new DataResponse( @@ -140,9 +137,7 @@ class GroupsController extends Controller { return new DataResponse( array( 'status' => 'success', - 'data' => array( - 'groupname' => $id - ) + 'data' => ['groupname' => $group->getDisplayName()] ), Http::STATUS_NO_CONTENT ); |