Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117922909
D3538.1775437378.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
16 KB
Referenced Files
None
Subscribers
None
D3538.1775437378.diff
View Options
diff --git a/src/app/Http/Controllers/API/V4/Admin/SharedFoldersController.php b/src/app/Http/Controllers/API/V4/Admin/SharedFoldersController.php
--- a/src/app/Http/Controllers/API/V4/Admin/SharedFoldersController.php
+++ b/src/app/Http/Controllers/API/V4/Admin/SharedFoldersController.php
@@ -39,7 +39,7 @@
$result = [
'list' => $result,
'count' => count($result),
- 'message' => \trans('app.search-foundxsharedfolders', ['x' => count($result)]),
+ 'message' => \trans('app.search-foundxshared-folders', ['x' => count($result)]),
];
return response()->json($result);
diff --git a/src/app/Http/Controllers/RelationController.php b/src/app/Http/Controllers/RelationController.php
--- a/src/app/Http/Controllers/RelationController.php
+++ b/src/app/Http/Controllers/RelationController.php
@@ -69,11 +69,20 @@
}
}
+ // TODO: Search and paging
+
$result = $query->get()
->map(function ($resource) {
return $this->objectToClient($resource);
});
+ $result = [
+ 'list' => $result,
+ 'count' => count($result),
+ 'hasMore' => false,
+ 'message' => \trans("app.search-foundx{$this->label}s", ['x' => count($result)]),
+ ];
+
return response()->json($result);
}
diff --git a/src/resources/lang/en/app.php b/src/resources/lang/en/app.php
--- a/src/resources/lang/en/app.php
+++ b/src/resources/lang/en/app.php
@@ -100,7 +100,7 @@
'search-foundxdomains' => ':x domains have been found.',
'search-foundxdistlists' => ':x distribution lists have been found.',
'search-foundxresources' => ':x resources have been found.',
- 'search-foundxsharedfolders' => ':x shared folders have been found.',
+ 'search-foundxshared-folders' => ':x shared folders have been found.',
'search-foundxusers' => ':x user accounts have been found.',
'signup-invitations-created' => 'The invitation has been created.|:count invitations has been created.',
diff --git a/src/resources/lang/fr/app.php b/src/resources/lang/fr/app.php
--- a/src/resources/lang/fr/app.php
+++ b/src/resources/lang/fr/app.php
@@ -90,8 +90,9 @@
'search-foundxdomains' => "Les domaines :x ont été trouvés.",
'search-foundxdistlists' => "Les listes de distribution :x ont été trouvés.",
+ 'search-foundxresources' => "Les ressources :x ont été trouvés.",
'search-foundxusers' => "Les comptes d'utilisateurs :x ont été trouvés.",
- 'search-foundxsharedfolders' => ":x dossiers partagés ont été trouvés.",
+ 'search-foundxshared-folders' => ":x dossiers partagés ont été trouvés.",
'signup-invitations-created' => "L'invitation à été crée.|:count nombre d'invitations ont été crée.",
'signup-invitations-csv-empty' => "Aucune adresses email valides ont été trouvées dans le fichier téléchargé.",
diff --git a/src/resources/vue/Distlist/List.vue b/src/resources/vue/Distlist/List.vue
--- a/src/resources/vue/Distlist/List.vue
+++ b/src/resources/vue/Distlist/List.vue
@@ -56,7 +56,7 @@
created() {
axios.get('/api/v4/groups', { loader: true })
.then(response => {
- this.lists = response.data
+ this.lists = response.data.list
})
.catch(this.$root.errorHandler)
}
diff --git a/src/resources/vue/Domain/List.vue b/src/resources/vue/Domain/List.vue
--- a/src/resources/vue/Domain/List.vue
+++ b/src/resources/vue/Domain/List.vue
@@ -51,7 +51,7 @@
created() {
axios.get('/api/v4/domains', { loader: true })
.then(response => {
- this.domains = response.data
+ this.domains = response.data.list
})
.catch(this.$root.errorHandler)
}
diff --git a/src/resources/vue/Resource/Info.vue b/src/resources/vue/Resource/Info.vue
--- a/src/resources/vue/Resource/Info.vue
+++ b/src/resources/vue/Resource/Info.vue
@@ -116,7 +116,7 @@
} else {
axios.get('/api/v4/domains', { loader: true })
.then(response => {
- this.domains = response.data
+ this.domains = response.data.list
this.resource.domain = this.domains[0].namespace
})
.catch(this.$root.errorHandler)
diff --git a/src/resources/vue/Resource/List.vue b/src/resources/vue/Resource/List.vue
--- a/src/resources/vue/Resource/List.vue
+++ b/src/resources/vue/Resource/List.vue
@@ -56,7 +56,7 @@
created() {
axios.get('/api/v4/resources', { loader: true })
.then(response => {
- this.resources = response.data
+ this.resources = response.data.list
})
.catch(this.$root.errorHandler)
}
diff --git a/src/resources/vue/SharedFolder/Info.vue b/src/resources/vue/SharedFolder/Info.vue
--- a/src/resources/vue/SharedFolder/Info.vue
+++ b/src/resources/vue/SharedFolder/Info.vue
@@ -116,7 +116,7 @@
} else {
axios.get('/api/v4/domains', { loader: true })
.then(response => {
- this.domains = response.data
+ this.domains = response.data.list
this.folder.domain = this.domains[0].namespace
})
.catch(this.$root.errorHandler)
diff --git a/src/resources/vue/SharedFolder/List.vue b/src/resources/vue/SharedFolder/List.vue
--- a/src/resources/vue/SharedFolder/List.vue
+++ b/src/resources/vue/SharedFolder/List.vue
@@ -55,7 +55,7 @@
created() {
axios.get('/api/v4/shared-folders', { loader: true })
.then(response => {
- this.folders = response.data
+ this.folders = response.data.list
})
.catch(this.$root.errorHandler)
}
diff --git a/src/tests/Feature/Controller/DomainsTest.php b/src/tests/Feature/Controller/DomainsTest.php
--- a/src/tests/Feature/Controller/DomainsTest.php
+++ b/src/tests/Feature/Controller/DomainsTest.php
@@ -180,7 +180,11 @@
$json = $response->json();
- $this->assertSame([], $json);
+ $this->assertCount(4, $json);
+ $this->assertSame(0, $json['count']);
+ $this->assertSame(false, $json['hasMore']);
+ $this->assertSame("0 domains have been found.", $json['message']);
+ $this->assertSame([], $json['list']);
// User with custom domain(s)
$john = $this->getTestUser('john@kolab.org');
@@ -190,23 +194,28 @@
$response->assertStatus(200);
$json = $response->json();
- $this->assertCount(1, $json);
- $this->assertSame('kolab.org', $json[0]['namespace']);
+ $this->assertCount(4, $json);
+ $this->assertSame(1, $json['count']);
+ $this->assertSame(false, $json['hasMore']);
+ $this->assertSame("1 domains have been found.", $json['message']);
+ $this->assertCount(1, $json['list']);
+ $this->assertSame('kolab.org', $json['list'][0]['namespace']);
// Values below are tested by Unit tests
- $this->assertArrayHasKey('isConfirmed', $json[0]);
- $this->assertArrayHasKey('isDeleted', $json[0]);
- $this->assertArrayHasKey('isVerified', $json[0]);
- $this->assertArrayHasKey('isSuspended', $json[0]);
- $this->assertArrayHasKey('isActive', $json[0]);
- $this->assertArrayHasKey('isLdapReady', $json[0]);
+ $this->assertArrayHasKey('isConfirmed', $json['list'][0]);
+ $this->assertArrayHasKey('isDeleted', $json['list'][0]);
+ $this->assertArrayHasKey('isVerified', $json['list'][0]);
+ $this->assertArrayHasKey('isSuspended', $json['list'][0]);
+ $this->assertArrayHasKey('isActive', $json['list'][0]);
+ $this->assertArrayHasKey('isLdapReady', $json['list'][0]);
$response = $this->actingAs($ned)->get("api/v4/domains");
$response->assertStatus(200);
$json = $response->json();
- $this->assertCount(1, $json);
- $this->assertSame('kolab.org', $json[0]['namespace']);
+ $this->assertCount(4, $json);
+ $this->assertCount(1, $json['list']);
+ $this->assertSame('kolab.org', $json['list'][0]['namespace']);
}
/**
diff --git a/src/tests/Feature/Controller/GroupsTest.php b/src/tests/Feature/Controller/GroupsTest.php
--- a/src/tests/Feature/Controller/GroupsTest.php
+++ b/src/tests/Feature/Controller/GroupsTest.php
@@ -93,7 +93,11 @@
$json = $response->json();
- $this->assertCount(0, $json);
+ $this->assertCount(4, $json);
+ $this->assertSame(0, $json['count']);
+ $this->assertSame(false, $json['hasMore']);
+ $this->assertSame("0 distribution lists have been found.", $json['message']);
+ $this->assertSame([], $json['list']);
// Test a user with a single group
$response = $this->actingAs($john)->get("/api/v4/groups");
@@ -101,14 +105,18 @@
$json = $response->json();
- $this->assertCount(1, $json);
- $this->assertSame($group->id, $json[0]['id']);
- $this->assertSame($group->email, $json[0]['email']);
- $this->assertSame($group->name, $json[0]['name']);
- $this->assertArrayHasKey('isDeleted', $json[0]);
- $this->assertArrayHasKey('isSuspended', $json[0]);
- $this->assertArrayHasKey('isActive', $json[0]);
- $this->assertArrayHasKey('isLdapReady', $json[0]);
+ $this->assertCount(4, $json);
+ $this->assertSame(1, $json['count']);
+ $this->assertSame(false, $json['hasMore']);
+ $this->assertSame("1 distribution lists have been found.", $json['message']);
+ $this->assertCount(1, $json['list']);
+ $this->assertSame($group->id, $json['list'][0]['id']);
+ $this->assertSame($group->email, $json['list'][0]['email']);
+ $this->assertSame($group->name, $json['list'][0]['name']);
+ $this->assertArrayHasKey('isDeleted', $json['list'][0]);
+ $this->assertArrayHasKey('isSuspended', $json['list'][0]);
+ $this->assertArrayHasKey('isActive', $json['list'][0]);
+ $this->assertArrayHasKey('isLdapReady', $json['list'][0]);
// Test that another wallet controller has access to groups
$response = $this->actingAs($ned)->get("/api/v4/groups");
@@ -116,8 +124,12 @@
$json = $response->json();
- $this->assertCount(1, $json);
- $this->assertSame($group->email, $json[0]['email']);
+ $this->assertCount(4, $json);
+ $this->assertSame(1, $json['count']);
+ $this->assertSame(false, $json['hasMore']);
+ $this->assertSame("1 distribution lists have been found.", $json['message']);
+ $this->assertCount(1, $json['list']);
+ $this->assertSame($group->email, $json['list'][0]['email']);
}
/**
diff --git a/src/tests/Feature/Controller/ResourcesTest.php b/src/tests/Feature/Controller/ResourcesTest.php
--- a/src/tests/Feature/Controller/ResourcesTest.php
+++ b/src/tests/Feature/Controller/ResourcesTest.php
@@ -90,7 +90,11 @@
$json = $response->json();
- $this->assertCount(0, $json);
+ $this->assertCount(4, $json);
+ $this->assertSame(0, $json['count']);
+ $this->assertSame(false, $json['hasMore']);
+ $this->assertSame("0 resources have been found.", $json['message']);
+ $this->assertSame([], $json['list']);
// Test a user with two resources
$response = $this->actingAs($john)->get("/api/v4/resources");
@@ -100,14 +104,18 @@
$resource = Resource::where('name', 'Conference Room #1')->first();
- $this->assertCount(2, $json);
- $this->assertSame($resource->id, $json[0]['id']);
- $this->assertSame($resource->email, $json[0]['email']);
- $this->assertSame($resource->name, $json[0]['name']);
- $this->assertArrayHasKey('isDeleted', $json[0]);
- $this->assertArrayHasKey('isActive', $json[0]);
- $this->assertArrayHasKey('isLdapReady', $json[0]);
- $this->assertArrayHasKey('isImapReady', $json[0]);
+ $this->assertCount(4, $json);
+ $this->assertSame(2, $json['count']);
+ $this->assertSame(false, $json['hasMore']);
+ $this->assertSame("2 resources have been found.", $json['message']);
+ $this->assertCount(2, $json['list']);
+ $this->assertSame($resource->id, $json['list'][0]['id']);
+ $this->assertSame($resource->email, $json['list'][0]['email']);
+ $this->assertSame($resource->name, $json['list'][0]['name']);
+ $this->assertArrayHasKey('isDeleted', $json['list'][0]);
+ $this->assertArrayHasKey('isActive', $json['list'][0]);
+ $this->assertArrayHasKey('isLdapReady', $json['list'][0]);
+ $this->assertArrayHasKey('isImapReady', $json['list'][0]);
// Test that another wallet controller has access to resources
$response = $this->actingAs($ned)->get("/api/v4/resources");
@@ -115,8 +123,12 @@
$json = $response->json();
- $this->assertCount(2, $json);
- $this->assertSame($resource->email, $json[0]['email']);
+ $this->assertCount(4, $json);
+ $this->assertSame(2, $json['count']);
+ $this->assertSame(false, $json['hasMore']);
+ $this->assertSame("2 resources have been found.", $json['message']);
+ $this->assertCount(2, $json['list']);
+ $this->assertSame($resource->email, $json['list'][0]['email']);
}
/**
diff --git a/src/tests/Feature/Controller/SharedFoldersTest.php b/src/tests/Feature/Controller/SharedFoldersTest.php
--- a/src/tests/Feature/Controller/SharedFoldersTest.php
+++ b/src/tests/Feature/Controller/SharedFoldersTest.php
@@ -89,7 +89,11 @@
$json = $response->json();
- $this->assertCount(0, $json);
+ $this->assertCount(4, $json);
+ $this->assertSame(0, $json['count']);
+ $this->assertSame(false, $json['hasMore']);
+ $this->assertSame("0 shared folders have been found.", $json['message']);
+ $this->assertSame([], $json['list']);
// Test a user with two shared folders
$response = $this->actingAs($john)->get("/api/v4/shared-folders");
@@ -99,15 +103,19 @@
$folder = SharedFolder::where('name', 'Calendar')->first();
- $this->assertCount(2, $json);
- $this->assertSame($folder->id, $json[0]['id']);
- $this->assertSame($folder->email, $json[0]['email']);
- $this->assertSame($folder->name, $json[0]['name']);
- $this->assertSame($folder->type, $json[0]['type']);
- $this->assertArrayHasKey('isDeleted', $json[0]);
- $this->assertArrayHasKey('isActive', $json[0]);
- $this->assertArrayHasKey('isLdapReady', $json[0]);
- $this->assertArrayHasKey('isImapReady', $json[0]);
+ $this->assertCount(4, $json);
+ $this->assertSame(2, $json['count']);
+ $this->assertSame(false, $json['hasMore']);
+ $this->assertSame("2 shared folders have been found.", $json['message']);
+ $this->assertCount(2, $json['list']);
+ $this->assertSame($folder->id, $json['list'][0]['id']);
+ $this->assertSame($folder->email, $json['list'][0]['email']);
+ $this->assertSame($folder->name, $json['list'][0]['name']);
+ $this->assertSame($folder->type, $json['list'][0]['type']);
+ $this->assertArrayHasKey('isDeleted', $json['list'][0]);
+ $this->assertArrayHasKey('isActive', $json['list'][0]);
+ $this->assertArrayHasKey('isLdapReady', $json['list'][0]);
+ $this->assertArrayHasKey('isImapReady', $json['list'][0]);
// Test that another wallet controller has access to shared folders
$response = $this->actingAs($ned)->get("/api/v4/shared-folders");
@@ -115,8 +123,12 @@
$json = $response->json();
- $this->assertCount(2, $json);
- $this->assertSame($folder->email, $json[0]['email']);
+ $this->assertCount(4, $json);
+ $this->assertSame(2, $json['count']);
+ $this->assertSame(false, $json['hasMore']);
+ $this->assertSame("2 shared folders have been found.", $json['message']);
+ $this->assertCount(2, $json['list']);
+ $this->assertSame($folder->email, $json['list'][0]['email']);
}
/**
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Apr 6, 1:02 AM (10 h, 46 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18835112
Default Alt Text
D3538.1775437378.diff (16 KB)
Attached To
Mode
D3538: Unify resources/domains/shared folders/distlists listing API with the rest
Attached
Detach File
Event Timeline