summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorVitor Mattos <vitor@php.rio>2023-02-01 11:07:18 -0300
committerGitHub <noreply@github.com>2023-02-01 11:07:18 -0300
commitdf25d5ec4acbdddee6292ba90ad3cea0b689591d (patch)
tree0546465cb018dbe4daa3b093634f2c78367f0380 /tests
parente9aa7d109dd2c87a57b4c678c0235a0299073e51 (diff)
parent12b8adaff5e9f3dca4df0b24a20d316c8b66e27e (diff)
Merge pull request #8651 from nextcloud/bugfix/noid/only-filter-attendees-when-being-a-member
Only filter mentions for conversation members
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/features/bootstrap/FeatureContext.php48
-rw-r--r--tests/integration/features/conversation/add-participant.feature43
2 files changed, 91 insertions, 0 deletions
diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php
index 7e91444b4..aa5729251 100644
--- a/tests/integration/features/bootstrap/FeatureContext.php
+++ b/tests/integration/features/bootstrap/FeatureContext.php
@@ -2343,6 +2343,54 @@ class FeatureContext implements Context, SnippetAcceptingContext {
}
/**
+ * @Then /^user "([^"]*)" gets the following collaborator suggestions in room "([^"]*)" for "([^"]*)" with (\d+)$/
+ *
+ * @param string $user
+ * @param string $identifier
+ * @param string $search
+ * @param string $statusCode
+ * @param string $apiVersion
+ * @param TableNode|null $formData
+ */
+ public function userGetsTheFollowingCollaboratorSuggestions($user, $identifier, $search, $statusCode, $apiVersion = 'v1', TableNode $formData = null) {
+ $this->setCurrentUser($user);
+ $this->sendRequest('GET', '/core/autocomplete/get?search=' . $search . '&itemType=call&itemId=' . self::$identifierToToken[$identifier] . '&shareTypes[]=0&shareTypes[]=1&shareTypes[]=7&shareTypes[]=4');
+ $this->assertStatusCode($this->response, $statusCode);
+
+ $mentions = $this->getDataFromResponse($this->response);
+
+ if ($formData === null) {
+ Assert::assertEmpty($mentions);
+ return;
+ }
+
+ Assert::assertCount(count($formData->getHash()), $mentions, 'Mentions count does not match');
+
+ usort($mentions, function ($a, $b) {
+ if ($a['source'] === $b['source']) {
+ return $a['label'] <=> $b['label'];
+ }
+ return $a['source'] <=> $b['source'];
+ });
+
+ $expected = $formData->getHash();
+ usort($expected, function ($a, $b) {
+ if ($a['source'] === $b['source']) {
+ return $a['label'] <=> $b['label'];
+ }
+ return $a['source'] <=> $b['source'];
+ });
+
+ foreach ($expected as $key => $row) {
+ unset($mentions[$key]['icon']);
+ unset($mentions[$key]['status']);
+ unset($mentions[$key]['subline']);
+ unset($mentions[$key]['shareWithDisplayNameUnique']);
+ Assert::assertEquals($row, $mentions[$key]);
+ }
+ }
+
+ /**
* @Then /^guest "([^"]*)" sets name to "([^"]*)" in room "([^"]*)" with (\d+)(?: \((v1)\))?$/
*
* @param string $user
diff --git a/tests/integration/features/conversation/add-participant.feature b/tests/integration/features/conversation/add-participant.feature
index eb8b6f110..6799e9556 100644
--- a/tests/integration/features/conversation/add-participant.feature
+++ b/tests/integration/features/conversation/add-participant.feature
@@ -133,3 +133,46 @@ Feature: conversation/add-participant
| users | participant1 | 1 |
And user "participant2" is not participant of room "room" (v4)
And user "participant3" is not participant of room "room" (v4)
+
+ Scenario: Getting participant suggestions in a private room
+ Given user "participant1" creates room "room" (v4)
+ | roomType | 2 |
+ | roomName | room |
+ And user "participant1" gets the following collaborator suggestions in room "room" for "particip" with 200
+ | source | id | label |
+ | users | participant2 | participant2-displayname |
+ | users | participant3 | participant3-displayname |
+ And user "participant1" gets the following collaborator suggestions in room "room" for "participant2" with 200
+ | source | id | label |
+ | users | participant2 | participant2-displayname |
+ And user "participant3" gets the following collaborator suggestions in room "room" for "participant2" with 200
+ | source | id | label |
+ | users | participant2 | participant2-displayname |
+ And user "participant1" adds user "participant2" to room "room" with 200 (v4)
+ And user "participant1" gets the following collaborator suggestions in room "room" for "participant2" with 200
+ And user "participant3" gets the following collaborator suggestions in room "room" for "participant2" with 200
+ | source | id | label |
+ | users | participant2 | participant2-displayname |
+
+ Scenario: Getting participant suggestions in a public room
+ Given user "participant1" creates room "room" (v4)
+ | roomType | 3 |
+ | roomName | room |
+ And user "participant1" gets the following collaborator suggestions in room "room" for "particip" with 200
+ | source | id | label |
+ | users | participant2 | participant2-displayname |
+ | users | participant3 | participant3-displayname |
+ And user "participant1" gets the following collaborator suggestions in room "room" for "participant2" with 200
+ | source | id | label |
+ | users | participant2 | participant2-displayname |
+ And user "participant3" gets the following collaborator suggestions in room "room" for "participant2" with 200
+ | source | id | label |
+ | users | participant2 | participant2-displayname |
+ And user "guest" joins room "room" with 200 (v4)
+ And user "guest" gets the following collaborator suggestions in room "room" for "participant2" with 401
+ And user "participant1" adds user "participant2" to room "room" with 200 (v4)
+ And user "participant1" gets the following collaborator suggestions in room "room" for "participant2" with 200
+ And user "participant3" gets the following collaborator suggestions in room "room" for "participant2" with 200
+ | source | id | label |
+ | users | participant2 | participant2-displayname |
+ And user "guest" gets the following collaborator suggestions in room "room" for "participant2" with 401