Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions lib/Chat/AutoComplete/SearchPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,18 @@ public function setContext(array $context) {
* @since 13.0.0
*/
public function search($search, $limit, $offset, ISearchResult $searchResult) {

// FIXME Handle guests
$this->searchUsers($search, $this->room->getParticipantUserIds(), $searchResult);

if ($this->room->getObjectType() === 'file') {
$usersWithFileAccess = $this->util->getUsersWithAccessFile($this->room->getObjectId());
if (!empty($usersWithFileAccess)) {
$this->searchUsers($search, $usersWithFileAccess, $searchResult);
}

return false;
}

// FIXME Handle guests
$this->searchUsers($search, $this->room->getParticipantUserIds(), $searchResult);

return false;
}

Expand Down
63 changes: 63 additions & 0 deletions tests/integration/features/chat/mentions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,66 @@ Feature: chat/mentions
And user "guest" joins room "public room" with 200
Then user "participant4" gets the following candidate mentions in room "public room" for "" with 404
And user "guest2" gets the following candidate mentions in room "public room" for "" with 404



Scenario: get mentions in a file room with no other joined participant
Given user "participant1" shares "welcome.txt" with user "participant2" with OCS 100
When user "participant1" gets the room for path "welcome.txt" with 200
And user "participant1" is participant of room "file welcome.txt room"
And user "participant2" is not participant of room "file welcome.txt room"
Then user "participant1" gets the following candidate mentions in room "file welcome.txt room" for "" with 200
| id | label | source |
| participant2 | participant2-displayname | users |
And user "participant2" gets the following candidate mentions in room "file welcome.txt room" for "" with 404

Scenario: get mentions in a file room
Given user "participant1" shares "welcome.txt" with user "participant2" with OCS 100
When user "participant1" gets the room for path "welcome.txt" with 200
And user "participant2" gets the room for path "welcome (2).txt" with 200
And user "participant1" is participant of room "file welcome (2).txt room"
And user "participant2" is participant of room "file welcome (2).txt room"
Then user "participant1" gets the following candidate mentions in room "file welcome (2).txt room" for "" with 200
| id | label | source |
| participant2 | participant2-displayname | users |
And user "participant2" gets the following candidate mentions in room "file welcome (2).txt room" for "" with 200
| id | label | source |
| participant1 | participant1-displayname | users |

Scenario: get matched mentions in a file room
Given user "participant1" shares "welcome.txt" with user "participant2" with OCS 100
When user "participant1" gets the room for path "welcome.txt" with 200
And user "participant2" gets the room for path "welcome (2).txt" with 200
And user "participant1" is participant of room "file welcome (2).txt room"
And user "participant2" is participant of room "file welcome (2).txt room"
Then user "participant1" gets the following candidate mentions in room "file welcome (2).txt room" for "part" with 200
| id | label | source |
| participant2 | participant2-displayname | users |
And user "participant2" gets the following candidate mentions in room "file welcome (2).txt room" for "part" with 200
| id | label | source |
| participant1 | participant1-displayname | users |

Scenario: get unmatched mentions in a file room
Given user "participant1" shares "welcome.txt" with user "participant2" with OCS 100
When user "participant1" gets the room for path "welcome.txt" with 200
And user "participant2" gets the room for path "welcome (2).txt" with 200
And user "participant1" is participant of room "file welcome (2).txt room"
And user "participant2" is participant of room "file welcome (2).txt room"
Then user "participant1" gets the following candidate mentions in room "file welcome (2).txt room" for "unknown" with 200
And user "participant2" gets the following candidate mentions in room "file welcome (2).txt room" for "unknown" with 200

Scenario: get mentions in a file room with a participant without access to the file
Given user "participant1" shares "welcome.txt" with user "participant2" with OCS 100
When user "participant1" gets the room for path "welcome.txt" with 200
And user "participant2" gets the room for path "welcome (2).txt" with 200
And user "participant1" is participant of room "file welcome (2).txt room"
And user "participant2" is participant of room "file welcome (2).txt room"
Then user "participant3" gets the following candidate mentions in room "file welcome (2).txt room" for "" with 404

Scenario: mention a participant with access to the file but not joined in a file room
Given user "participant1" shares "welcome.txt" with user "participant2" with OCS 100
And user "participant1" gets the room for path "welcome.txt" with 200
And user "participant1" is participant of room "file welcome.txt room"
And user "participant2" is not participant of room "file welcome.txt room"
When user "participant1" sends message "hi @participant2" to room "file welcome.txt room" with 201
Then user "participant2" is not participant of room "file welcome.txt room"