Skip to content
Closed
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
19 changes: 19 additions & 0 deletions lib/Search/CurrentMessageSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
use OCA\Talk\Exceptions\ParticipantNotFoundException;
use OCA\Talk\Exceptions\RoomNotFoundException;
use OCA\Talk\Exceptions\UnauthorizedException;
use OCA\Talk\Model\Attendee;
use OCA\Talk\Webinary;
use OCP\IUser;
use OCP\Search\ISearchQuery;
use OCP\Search\SearchResult;
Expand Down Expand Up @@ -87,6 +89,23 @@ public function search(IUser $user, ISearchQuery $query): SearchResult {
);
}

try {
$participant = $room->getParticipant($user->getUID(), false);
} catch (ParticipantNotFoundException $e) {
return SearchResult::complete(
$this->l->t('Messages'),
[]
);
}

if ($room->getLobbyState() !== Webinary::LOBBY_NONE &&
!($participant->getPermissions() & Attendee::PERMISSIONS_LOBBY_IGNORE)) {
return SearchResult::complete(
$this->l->t('Messages'),
[]
);
}

$offset = (int) $query->getCursor();
$comments = $this->chatManager->searchForObjects(
$query->getTerm(),
Expand Down
8 changes: 8 additions & 0 deletions lib/Search/MessageSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
use OCA\Talk\Manager as RoomManager;
use OCA\Talk\Model\Attendee;
use OCA\Talk\Room;
use OCA\Talk\Webinary;
use OCP\Comments\IComment;
use OCP\IL10N;
use OCP\IURLGenerator;
Expand Down Expand Up @@ -120,6 +121,13 @@ public function search(IUser $user, ISearchQuery $query): SearchResult {
continue;
}

if ($room->getLobbyState() !== Webinary::LOBBY_NONE) {
$participant = $room->getParticipant($user->getUID(), false);
if (!($participant->getPermissions() & Attendee::PERMISSIONS_LOBBY_IGNORE)) {
continue;
}
}

$roomMap[(string) $room->getId()] = $room;
}

Expand Down