Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2022-09-30 16:33:01 +0300
committerJoas Schilling <coding@schilljs.com>2022-10-07 11:42:46 +0300
commit28342cc10447b4acca0ef6984eece0efdf919e17 (patch)
tree574781605e5a23b5dc1c8ccb0fefa11dfe372ddd /lib
parent8f3bd7993bc811f8e87512dc4d186dd8d035a88f (diff)
Don't search in lobbied conversations
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/Search/CurrentMessageSearch.php19
-rw-r--r--lib/Search/MessageSearch.php8
2 files changed, 27 insertions, 0 deletions
diff --git a/lib/Search/CurrentMessageSearch.php b/lib/Search/CurrentMessageSearch.php
index 685a2a9f4..126099aa5 100644
--- a/lib/Search/CurrentMessageSearch.php
+++ b/lib/Search/CurrentMessageSearch.php
@@ -27,6 +27,8 @@ use OCA\Talk\Chat\ChatManager;
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;
@@ -87,6 +89,23 @@ class CurrentMessageSearch extends MessageSearch {
);
}
+ 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(),
diff --git a/lib/Search/MessageSearch.php b/lib/Search/MessageSearch.php
index 93d057399..6ac0dfc3f 100644
--- a/lib/Search/MessageSearch.php
+++ b/lib/Search/MessageSearch.php
@@ -31,6 +31,7 @@ use OCA\Talk\Exceptions\UnauthorizedException;
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;
@@ -120,6 +121,13 @@ class MessageSearch implements IProvider {
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;
}