Fix calculation if there are more results
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
a31439e89d
commit
a2f3f0a681
|
@ -172,10 +172,14 @@ class MailPlugin implements ISearchPlugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$reachedEnd = true;
|
||||||
if (!$this->shareeEnumeration) {
|
if (!$this->shareeEnumeration) {
|
||||||
$result['wide'] = [];
|
$result['wide'] = [];
|
||||||
$userResults['wide'] = [];
|
$userResults['wide'] = [];
|
||||||
} else {
|
} else {
|
||||||
|
$reachedEnd = (count($result['wide']) < $offset + $limit) &&
|
||||||
|
(count($userResults['wide']) < $offset + $limit);
|
||||||
|
|
||||||
$result['wide'] = array_slice($result['wide'], $offset, $limit);
|
$result['wide'] = array_slice($result['wide'], $offset, $limit);
|
||||||
$userResults['wide'] = array_slice($userResults['wide'], $offset, $limit);
|
$userResults['wide'] = array_slice($userResults['wide'], $offset, $limit);
|
||||||
}
|
}
|
||||||
|
@ -196,7 +200,7 @@ class MailPlugin implements ISearchPlugin {
|
||||||
}
|
}
|
||||||
$searchResult->addResultSet($emailType, $result['wide'], $result['exact']);
|
$searchResult->addResultSet($emailType, $result['wide'], $result['exact']);
|
||||||
|
|
||||||
return true;
|
return !$reachedEnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isCurrentUser(ICloudId $cloud) {
|
public function isCurrentUser(ICloudId $cloud) {
|
||||||
|
|
|
@ -120,15 +120,15 @@ class MailPluginTest extends TestCase {
|
||||||
|
|
||||||
public function dataGetEmail() {
|
public function dataGetEmail() {
|
||||||
return [
|
return [
|
||||||
['test', [], true, ['emails' => [], 'exact' => ['emails' => []]], false, true],
|
['test', [], true, ['emails' => [], 'exact' => ['emails' => []]], false, false],
|
||||||
['test', [], false, ['emails' => [], 'exact' => ['emails' => []]], false, true],
|
['test', [], false, ['emails' => [], 'exact' => ['emails' => []]], false, false],
|
||||||
[
|
[
|
||||||
'test@remote.com',
|
'test@remote.com',
|
||||||
[],
|
[],
|
||||||
true,
|
true,
|
||||||
['emails' => [], 'exact' => ['emails' => [['label' => 'test@remote.com', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'test@remote.com']]]]],
|
['emails' => [], 'exact' => ['emails' => [['label' => 'test@remote.com', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'test@remote.com']]]]],
|
||||||
false,
|
false,
|
||||||
true,
|
false,
|
||||||
],
|
],
|
||||||
[ // no valid email address
|
[ // no valid email address
|
||||||
'test@remote',
|
'test@remote',
|
||||||
|
@ -136,7 +136,7 @@ class MailPluginTest extends TestCase {
|
||||||
true,
|
true,
|
||||||
['emails' => [], 'exact' => ['emails' => []]],
|
['emails' => [], 'exact' => ['emails' => []]],
|
||||||
false,
|
false,
|
||||||
true,
|
false,
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'test@remote.com',
|
'test@remote.com',
|
||||||
|
@ -144,7 +144,7 @@ class MailPluginTest extends TestCase {
|
||||||
false,
|
false,
|
||||||
['emails' => [], 'exact' => ['emails' => [['label' => 'test@remote.com', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'test@remote.com']]]]],
|
['emails' => [], 'exact' => ['emails' => [['label' => 'test@remote.com', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'test@remote.com']]]]],
|
||||||
false,
|
false,
|
||||||
true,
|
false,
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'test',
|
'test',
|
||||||
|
@ -167,7 +167,7 @@ class MailPluginTest extends TestCase {
|
||||||
true,
|
true,
|
||||||
['emails' => [['label' => 'User @ Localhost (username@localhost)', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'username@localhost']]], 'exact' => ['emails' => []]],
|
['emails' => [['label' => 'User @ Localhost (username@localhost)', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'username@localhost']]], 'exact' => ['emails' => []]],
|
||||||
false,
|
false,
|
||||||
true,
|
false,
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'test',
|
'test',
|
||||||
|
@ -190,7 +190,7 @@ class MailPluginTest extends TestCase {
|
||||||
false,
|
false,
|
||||||
['emails' => [], 'exact' => ['emails' => []]],
|
['emails' => [], 'exact' => ['emails' => []]],
|
||||||
false,
|
false,
|
||||||
true,
|
false,
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'test@remote.com',
|
'test@remote.com',
|
||||||
|
@ -213,7 +213,7 @@ class MailPluginTest extends TestCase {
|
||||||
true,
|
true,
|
||||||
['emails' => [['label' => 'User @ Localhost (username@localhost)', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'username@localhost']]], 'exact' => ['emails' => [['label' => 'test@remote.com', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'test@remote.com']]]]],
|
['emails' => [['label' => 'User @ Localhost (username@localhost)', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'username@localhost']]], 'exact' => ['emails' => [['label' => 'test@remote.com', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'test@remote.com']]]]],
|
||||||
false,
|
false,
|
||||||
true,
|
false,
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'test@remote.com',
|
'test@remote.com',
|
||||||
|
@ -236,7 +236,7 @@ class MailPluginTest extends TestCase {
|
||||||
false,
|
false,
|
||||||
['emails' => [], 'exact' => ['emails' => [['label' => 'test@remote.com', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'test@remote.com']]]]],
|
['emails' => [], 'exact' => ['emails' => [['label' => 'test@remote.com', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'test@remote.com']]]]],
|
||||||
false,
|
false,
|
||||||
true,
|
false,
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'username@localhost',
|
'username@localhost',
|
||||||
|
@ -259,7 +259,7 @@ class MailPluginTest extends TestCase {
|
||||||
true,
|
true,
|
||||||
['emails' => [], 'exact' => ['emails' => [['label' => 'User @ Localhost (username@localhost)', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'username@localhost']]]]],
|
['emails' => [], 'exact' => ['emails' => [['label' => 'User @ Localhost (username@localhost)', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'username@localhost']]]]],
|
||||||
true,
|
true,
|
||||||
true,
|
false,
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'username@localhost',
|
'username@localhost',
|
||||||
|
@ -282,7 +282,7 @@ class MailPluginTest extends TestCase {
|
||||||
false,
|
false,
|
||||||
['emails' => [], 'exact' => ['emails' => [['label' => 'User @ Localhost (username@localhost)', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'username@localhost']]]]],
|
['emails' => [], 'exact' => ['emails' => [['label' => 'User @ Localhost (username@localhost)', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'username@localhost']]]]],
|
||||||
true,
|
true,
|
||||||
true,
|
false,
|
||||||
],
|
],
|
||||||
// contact with space
|
// contact with space
|
||||||
[
|
[
|
||||||
|
@ -306,7 +306,7 @@ class MailPluginTest extends TestCase {
|
||||||
false,
|
false,
|
||||||
['emails' => [], 'exact' => ['emails' => [['label' => 'User Name @ Localhost (user name@localhost)', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'user name@localhost']]]]],
|
['emails' => [], 'exact' => ['emails' => [['label' => 'User Name @ Localhost (user name@localhost)', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'user name@localhost']]]]],
|
||||||
true,
|
true,
|
||||||
true,
|
false,
|
||||||
],
|
],
|
||||||
// remote with space, no contact
|
// remote with space, no contact
|
||||||
[
|
[
|
||||||
|
@ -330,7 +330,7 @@ class MailPluginTest extends TestCase {
|
||||||
false,
|
false,
|
||||||
['emails' => [], 'exact' => ['emails' => []]],
|
['emails' => [], 'exact' => ['emails' => []]],
|
||||||
false,
|
false,
|
||||||
true,
|
false,
|
||||||
],
|
],
|
||||||
// Local user found by email
|
// Local user found by email
|
||||||
[
|
[
|
||||||
|
@ -344,7 +344,7 @@ class MailPluginTest extends TestCase {
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
false,
|
false,
|
||||||
['users' => [], 'exact' => ['users' => [['label' => 'User (test@example.com)','value' => ['shareType' => 0, 'shareWith' => 'test'],]]]],
|
['users' => [], 'exact' => ['users' => [['label' => 'User (test@example.com)','value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test'],]]]],
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
],
|
],
|
||||||
|
@ -395,8 +395,8 @@ class MailPluginTest extends TestCase {
|
||||||
],
|
],
|
||||||
true,
|
true,
|
||||||
['users' => [
|
['users' => [
|
||||||
['label' => 'User1 (test@example.com)','value' => ['shareType' => 0, 'shareWith' => 'test1']],
|
['label' => 'User1 (test@example.com)', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test1']],
|
||||||
['label' => 'User2 (test@example.de)','value' => ['shareType' => 0, 'shareWith' => 'test2']],
|
['label' => 'User2 (test@example.de)', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test2']],
|
||||||
], 'emails' => [], 'exact' => ['users' => [], 'emails' => []]],
|
], 'emails' => [], 'exact' => ['users' => [], 'emails' => []]],
|
||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
|
@ -515,7 +515,7 @@ class MailPluginTest extends TestCase {
|
||||||
],
|
],
|
||||||
['users' => [['label' => 'User (test@example.com)','value' => ['shareType' => 0, 'shareWith' => 'test'],]], 'emails' => [], 'exact' => ['emails' => [], 'users' => []]],
|
['users' => [['label' => 'User (test@example.com)','value' => ['shareType' => 0, 'shareWith' => 'test'],]], 'emails' => [], 'exact' => ['emails' => [], 'users' => []]],
|
||||||
false,
|
false,
|
||||||
true,
|
false,
|
||||||
[
|
[
|
||||||
"currentUser" => ["group1"],
|
"currentUser" => ["group1"],
|
||||||
"User" => ["group1"]
|
"User" => ["group1"]
|
||||||
|
@ -535,7 +535,7 @@ class MailPluginTest extends TestCase {
|
||||||
],
|
],
|
||||||
['emails'=> [], 'exact' => ['emails' => []]],
|
['emails'=> [], 'exact' => ['emails' => []]],
|
||||||
false,
|
false,
|
||||||
true,
|
false,
|
||||||
[
|
[
|
||||||
"currentUser" => ["group1"],
|
"currentUser" => ["group1"],
|
||||||
"User" => ["group2"]
|
"User" => ["group2"]
|
||||||
|
@ -555,7 +555,7 @@ class MailPluginTest extends TestCase {
|
||||||
],
|
],
|
||||||
['emails' => [], 'exact' => ['emails' => [['label' => 'test@example.com', 'value' => ['shareType' => 4,'shareWith' => 'test@example.com']]]]],
|
['emails' => [], 'exact' => ['emails' => [['label' => 'test@example.com', 'value' => ['shareType' => 4,'shareWith' => 'test@example.com']]]]],
|
||||||
false,
|
false,
|
||||||
true,
|
false,
|
||||||
[
|
[
|
||||||
"currentUser" => ["group1"],
|
"currentUser" => ["group1"],
|
||||||
"User" => ["group2"]
|
"User" => ["group2"]
|
||||||
|
|
Loading…
Reference in New Issue