Correctly return the group name

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2018-01-24 13:39:17 +01:00
parent 97dbaa26c4
commit 63089821a4
No known key found for this signature in database
GPG Key ID: 7076EA9751AACDDA
2 changed files with 6 additions and 11 deletions

View File

@ -160,7 +160,7 @@ class MetaData {
private function generateGroupMetaData(\OCP\IGroup $group, $userSearch) { private function generateGroupMetaData(\OCP\IGroup $group, $userSearch) {
return array( return array(
'id' => $group->getGID(), 'id' => $group->getGID(),
'name' => $group->getGID(), 'name' => $group->getDisplayName(),
'usercount' => $this->sorting === self::SORT_USERCOUNT ? $group->count($userSearch) : 0, 'usercount' => $this->sorting === self::SORT_USERCOUNT ? $group->count($userSearch) : 0,
); );
} }

View File

@ -28,6 +28,7 @@ use OC\AppFramework\Http;
use OC\Group\MetaData; use OC\Group\MetaData;
use OCP\AppFramework\Controller; use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Http\DataResponse;
use OCP\IGroup;
use OCP\IGroupManager; use OCP\IGroupManager;
use OCP\IL10N; use OCP\IL10N;
use OCP\IRequest; use OCP\IRequest;
@ -108,13 +109,9 @@ class GroupsController extends Controller {
Http::STATUS_CONFLICT Http::STATUS_CONFLICT
); );
} }
if($this->groupManager->createGroup($id)) { $group = $this->groupManager->createGroup($id);
return new DataResponse( if($group instanceof IGroup) {
array( return new DataResponse(['groupname' => $group->getDisplayName()], Http::STATUS_CREATED);
'groupname' => $id
),
Http::STATUS_CREATED
);
} }
return new DataResponse( return new DataResponse(
@ -140,9 +137,7 @@ class GroupsController extends Controller {
return new DataResponse( return new DataResponse(
array( array(
'status' => 'success', 'status' => 'success',
'data' => array( 'data' => ['groupname' => $group->getDisplayName()]
'groupname' => $id
)
), ),
Http::STATUS_NO_CONTENT Http::STATUS_NO_CONTENT
); );