diff --git a/lib/BackgroundJob/RemoveEmptyRooms.php b/lib/BackgroundJob/RemoveEmptyRooms.php
index 09e0646aa98..7696a61dbb7 100644
--- a/lib/BackgroundJob/RemoveEmptyRooms.php
+++ b/lib/BackgroundJob/RemoveEmptyRooms.php
@@ -91,7 +91,7 @@ private function deleteIfIsEmpty(Room $room): bool {
return false;
}
- if ($room->getRemoteServer() && $room->getRemoteToken()
+ if ($room->isFederatedConversation()
&& $this->federationManager->getNumberOfInvitations($room) !== 0) {
return false;
}
diff --git a/lib/Chat/ChatManager.php b/lib/Chat/ChatManager.php
index bc2b5d81ac1..93479d68d7c 100644
--- a/lib/Chat/ChatManager.php
+++ b/lib/Chat/ChatManager.php
@@ -136,7 +136,7 @@ public function addSystemMessage(
bool $shouldSkipLastMessageUpdate = false,
bool $silent = false,
): IComment {
- if ($chat->getRemoteServer() !== '') {
+ if ($chat->isFederatedConversation()) {
$e = new MessagingNotAllowedException();
$this->logger->error('Attempt to post system message into proxy conversation', ['exception' => $e]);
throw $e;
@@ -286,7 +286,7 @@ public function addChangelogMessage(Room $chat, string $message): IComment {
* @throws MessagingNotAllowedException
*/
public function sendMessage(Room $chat, ?Participant $participant, string $actorType, string $actorId, string $message, \DateTime $creationDateTime, ?IComment $replyTo = null, string $referenceId = '', bool $silent = false, bool $rateLimitGuestMentions = true): IComment {
- if ($chat->getRemoteServer() !== '') {
+ if ($chat->isFederatedConversation()) {
$e = new MessagingNotAllowedException();
$this->logger->error('Attempt to post system message into proxy conversation', ['exception' => $e]);
throw $e;
diff --git a/lib/Chat/SystemMessage/Listener.php b/lib/Chat/SystemMessage/Listener.php
index 8f0ff6839ad..3564de06a23 100644
--- a/lib/Chat/SystemMessage/Listener.php
+++ b/lib/Chat/SystemMessage/Listener.php
@@ -165,7 +165,7 @@ protected function sendSystemMessageAboutCallLeft(ParticipantModifiedEvent $even
}
protected function sendSystemMessageAboutConversationCreated(RoomCreatedEvent $event): void {
- if ($event->getRoom()->getRemoteServer() !== '') {
+ if ($event->getRoom()->isFederatedConversation()) {
return;
}
@@ -182,7 +182,7 @@ protected function sendSystemMessageAboutConversationRenamed(RoomModifiedEvent $
return;
}
- if ($event->getRoom()->getRemoteServer() !== '') {
+ if ($event->getRoom()->isFederatedConversation()) {
return;
}
@@ -194,7 +194,7 @@ protected function sendSystemMessageAboutConversationRenamed(RoomModifiedEvent $
}
protected function sendSystemMessageAboutRoomDescriptionChanges(RoomModifiedEvent $event): void {
- if ($event->getRoom()->getRemoteServer() !== '') {
+ if ($event->getRoom()->isFederatedConversation()) {
return;
}
@@ -212,7 +212,7 @@ protected function sendSystemMessageAboutRoomDescriptionChanges(RoomModifiedEven
}
protected function sendSystemMessageAboutRoomPassword(RoomModifiedEvent $event): void {
- if ($event->getRoom()->getRemoteServer() !== '') {
+ if ($event->getRoom()->isFederatedConversation()) {
return;
}
@@ -242,7 +242,7 @@ protected function sendSystemReadOnlyMessage(RoomModifiedEvent $event): void {
return;
}
- if ($room->getRemoteServer() !== '') {
+ if ($room->isFederatedConversation()) {
return;
}
@@ -294,7 +294,7 @@ protected function addSystemMessageUserAdded(AttendeesAddedEvent $event, Attende
return;
}
- if ($room->getRemoteServer() !== '') {
+ if ($room->isFederatedConversation()) {
return;
}
@@ -331,7 +331,7 @@ protected function sendSystemMessageUserRemoved(AttendeeRemovedEvent $event): vo
return;
}
- if ($room->getRemoteServer() !== '') {
+ if ($room->isFederatedConversation()) {
return;
}
@@ -352,7 +352,7 @@ public function sendSystemMessageAboutPromoteOrDemoteModerator(ParticipantModifi
return;
}
- if ($event->getRoom()->getRemoteServer() !== '') {
+ if ($event->getRoom()->isFederatedConversation()) {
return;
}
@@ -401,8 +401,7 @@ protected function fixMimeTypeOfVoiceMessage(ShareCreatedEvent|BeforeDuplicateSh
return;
}
$room = $this->manager->getRoomByToken($share->getSharedWith());
- if ($room->getRemoteServer() !== '') {
- // FIXME this should be blocked up front
+ if ($room->isFederatedConversation()) {
return;
}
@@ -436,7 +435,7 @@ protected function fixMimeTypeOfVoiceMessage(ShareCreatedEvent|BeforeDuplicateSh
}
protected function attendeesAddedEvent(AttendeesAddedEvent $event): void {
- if ($event->getRoom()->getRemoteServer() !== '') {
+ if ($event->getRoom()->isFederatedConversation()) {
return;
}
@@ -456,7 +455,7 @@ protected function attendeesAddedEvent(AttendeesAddedEvent $event): void {
}
protected function attendeesRemovedEvent(AttendeesRemovedEvent $event): void {
- if ($event->getRoom()->getRemoteServer() !== '') {
+ if ($event->getRoom()->isFederatedConversation()) {
return;
}
diff --git a/lib/Collaboration/Collaborators/Listener.php b/lib/Collaboration/Collaborators/Listener.php
index a24898e58ec..2ae4ee8c448 100644
--- a/lib/Collaboration/Collaborators/Listener.php
+++ b/lib/Collaboration/Collaborators/Listener.php
@@ -134,7 +134,7 @@ protected function filterExistingParticipants(string $token, array $results): ar
return $results;
}
- if ($this->room->getRemoteServer() !== '') {
+ if ($this->room->isFederatedConversation()) {
return $results;
}
diff --git a/lib/Collaboration/Collaborators/RoomPlugin.php b/lib/Collaboration/Collaborators/RoomPlugin.php
index 652ced89c91..2bb7f7da9fd 100644
--- a/lib/Collaboration/Collaborators/RoomPlugin.php
+++ b/lib/Collaboration/Collaborators/RoomPlugin.php
@@ -62,7 +62,7 @@ public function search($search, $limit, $offset, ISearchResult $searchResult): b
continue;
}
- if ($room->getRemoteServer() !== '') {
+ if ($room->isFederatedConversation()) {
continue;
}
diff --git a/lib/Command/Bot/Setup.php b/lib/Command/Bot/Setup.php
index 02830365841..a2893f12cc6 100644
--- a/lib/Command/Bot/Setup.php
+++ b/lib/Command/Bot/Setup.php
@@ -81,7 +81,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
try {
$room = $this->roomManager->getRoomByToken($token);
- if ($room->getRemoteServer() !== '') {
+ if ($room->isFederatedConversation()) {
$output->writeln('Federated conversations can not have bots: ' . $token . '');
$returnCode = 2;
}
diff --git a/lib/Controller/AvatarController.php b/lib/Controller/AvatarController.php
index 1d257ba8082..b6ec9521fba 100644
--- a/lib/Controller/AvatarController.php
+++ b/lib/Controller/AvatarController.php
@@ -149,7 +149,7 @@ public function emojiAvatar(string $emoji, ?string $color): DataResponse {
public function getAvatar(bool $darkTheme = false): FileDisplayResponse {
// Cache for 1 day
$cacheDuration = 60 * 60 * 24;
- if ($this->room->getRemoteServer() !== '') {
+ if ($this->room->isFederatedConversation()) {
/** @var \OCA\Talk\Federation\Proxy\TalkV1\Controller\AvatarController $proxy */
$proxy = \OCP\Server::get(\OCA\Talk\Federation\Proxy\TalkV1\Controller\AvatarController::class);
try {
diff --git a/lib/Controller/BotController.php b/lib/Controller/BotController.php
index a12bf0c14ed..8e9d8cfc0bf 100644
--- a/lib/Controller/BotController.php
+++ b/lib/Controller/BotController.php
@@ -353,7 +353,7 @@ public function listBots(): DataResponse {
#[NoAdminRequired]
#[RequireLoggedInModeratorParticipant]
public function enableBot(int $botId): DataResponse {
- if ($this->room->getRemoteServer() !== '') {
+ if ($this->room->isFederatedConversation()) {
return new DataResponse([
'error' => 'room',
], Http::STATUS_BAD_REQUEST);
diff --git a/lib/Controller/ChatController.php b/lib/Controller/ChatController.php
index c1bd4907ada..4edf7791fce 100644
--- a/lib/Controller/ChatController.php
+++ b/lib/Controller/ChatController.php
@@ -214,7 +214,7 @@ protected function parseCommentToResponse(IComment $comment, ?Message $parentMes
#[RequirePermission(permission: RequirePermission::CHAT)]
#[RequireReadWriteConversation]
public function sendMessage(string $message, string $actorDisplayName = '', string $referenceId = '', int $replyTo = 0, bool $silent = false): DataResponse {
- if ($this->room->getRemoteServer()) {
+ if ($this->room->isFederatedConversation()) {
/** @var \OCA\Talk\Federation\Proxy\TalkV1\Controller\ChatController $proxy */
$proxy = \OCP\Server::get(\OCA\Talk\Federation\Proxy\TalkV1\Controller\ChatController::class);
return $proxy->sendMessage($this->room, $this->participant, $message, $referenceId, $replyTo, $silent);
@@ -433,7 +433,7 @@ public function receiveMessages(int $lookIntoFuture,
$limit = min(200, $limit);
$timeout = min(30, $timeout);
- if ($this->room->getRemoteServer() !== '') {
+ if ($this->room->isFederatedConversation()) {
/** @var \OCA\Talk\Federation\Proxy\TalkV1\Controller\ChatController $proxy */
$proxy = \OCP\Server::get(\OCA\Talk\Federation\Proxy\TalkV1\Controller\ChatController::class);
return $proxy->receiveMessages(
@@ -656,7 +656,7 @@ public function getMessageContext(
int $limit = 50): DataResponse {
$limit = min(100, $limit);
- if ($this->room->getRemoteServer() !== '') {
+ if ($this->room->isFederatedConversation()) {
/** @var \OCA\Talk\Federation\Proxy\TalkV1\Controller\ChatController $proxy */
$proxy = \OCP\Server::get(\OCA\Talk\Federation\Proxy\TalkV1\Controller\ChatController::class);
return $proxy->getMessageContext($this->room, $this->participant, $messageId, $limit);
@@ -735,7 +735,7 @@ protected function loadSelfReactions(array $messages, array $commentIdToIndex):
#[RequirePermission(permission: RequirePermission::CHAT)]
#[RequireReadWriteConversation]
public function deleteMessage(int $messageId): DataResponse {
- if ($this->room->getRemoteServer() !== '') {
+ if ($this->room->isFederatedConversation()) {
/** @var \OCA\Talk\Federation\Proxy\TalkV1\Controller\ChatController $proxy */
$proxy = \OCP\Server::get(\OCA\Talk\Federation\Proxy\TalkV1\Controller\ChatController::class);
return $proxy->deleteMessage(
@@ -827,7 +827,7 @@ public function deleteMessage(int $messageId): DataResponse {
#[RequirePermission(permission: RequirePermission::CHAT)]
#[RequireReadWriteConversation]
public function editMessage(int $messageId, string $message): DataResponse {
- if ($this->room->getRemoteServer() !== '') {
+ if ($this->room->isFederatedConversation()) {
/** @var \OCA\Talk\Federation\Proxy\TalkV1\Controller\ChatController $proxy */
$proxy = \OCP\Server::get(\OCA\Talk\Federation\Proxy\TalkV1\Controller\ChatController::class);
return $proxy->editMessage(
@@ -1086,7 +1086,7 @@ public function clearHistory(): DataResponse {
#[PublicPage]
#[RequireAuthenticatedParticipant]
public function setReadMarker(?int $lastReadMessage = null): DataResponse {
- if ($this->room->getRemoteServer() !== '') {
+ if ($this->room->isFederatedConversation()) {
/** @var \OCA\Talk\Federation\Proxy\TalkV1\Controller\ChatController $proxy */
$proxy = \OCP\Server::get(\OCA\Talk\Federation\Proxy\TalkV1\Controller\ChatController::class);
return $proxy->setReadMarker($this->room, $this->participant, $this->getResponseFormat(), $lastReadMessage);
@@ -1121,7 +1121,7 @@ public function setReadMarker(?int $lastReadMessage = null): DataResponse {
#[PublicPage]
#[RequireAuthenticatedParticipant]
public function markUnread(): DataResponse {
- if ($this->room->getRemoteServer() !== '') {
+ if ($this->room->isFederatedConversation()) {
/** @var \OCA\Talk\Federation\Proxy\TalkV1\Controller\ChatController $proxy */
$proxy = \OCP\Server::get(\OCA\Talk\Federation\Proxy\TalkV1\Controller\ChatController::class);
return $proxy->markUnread($this->room, $this->participant, $this->getResponseFormat());
@@ -1280,7 +1280,7 @@ protected function getMessagesForRoom(array $messageIds): array {
#[RequirePermission(permission: RequirePermission::CHAT)]
#[RequireReadWriteConversation]
public function mentions(string $search, int $limit = 20, bool $includeStatus = false): DataResponse {
- if ($this->room->getRemoteServer()) {
+ if ($this->room->isFederatedConversation()) {
/** @var \OCA\Talk\Federation\Proxy\TalkV1\Controller\ChatController $proxy */
$proxy = \OCP\Server::get(\OCA\Talk\Federation\Proxy\TalkV1\Controller\ChatController::class);
return $proxy->mentions($this->room, $this->participant, $search, $limit, $includeStatus);
diff --git a/lib/Controller/PollController.php b/lib/Controller/PollController.php
index ae94b66ae4f..4f7b7b7a5a9 100644
--- a/lib/Controller/PollController.php
+++ b/lib/Controller/PollController.php
@@ -88,7 +88,7 @@ public function __construct(
#[RequirePermission(permission: RequirePermission::CHAT)]
#[RequireReadWriteConversation]
public function createPoll(string $question, array $options, int $resultMode, int $maxVotes): DataResponse {
- if ($this->room->getRemoteServer() !== '') {
+ if ($this->room->isFederatedConversation()) {
/** @var \OCA\Talk\Federation\Proxy\TalkV1\Controller\PollController $proxy */
$proxy = \OCP\Server::get(\OCA\Talk\Federation\Proxy\TalkV1\Controller\PollController::class);
return $proxy->createPoll($this->room, $this->participant, $question, $options, $resultMode, $maxVotes);
@@ -153,7 +153,7 @@ public function createPoll(string $question, array $options, int $resultMode, in
#[RequireModeratorOrNoLobby]
#[RequireParticipant]
public function showPoll(int $pollId): DataResponse {
- if ($this->room->getRemoteServer() !== '') {
+ if ($this->room->isFederatedConversation()) {
/** @var \OCA\Talk\Federation\Proxy\TalkV1\Controller\PollController $proxy */
$proxy = \OCP\Server::get(\OCA\Talk\Federation\Proxy\TalkV1\Controller\PollController::class);
return $proxy->showPoll($this->room, $this->participant, $pollId);
@@ -191,7 +191,7 @@ public function showPoll(int $pollId): DataResponse {
#[RequireModeratorOrNoLobby]
#[RequireParticipant]
public function votePoll(int $pollId, array $optionIds = []): DataResponse {
- if ($this->room->getRemoteServer() !== '') {
+ if ($this->room->isFederatedConversation()) {
/** @var \OCA\Talk\Federation\Proxy\TalkV1\Controller\PollController $proxy */
$proxy = \OCP\Server::get(\OCA\Talk\Federation\Proxy\TalkV1\Controller\PollController::class);
return $proxy->votePoll($this->room, $this->participant, $pollId, $optionIds);
@@ -252,7 +252,7 @@ public function votePoll(int $pollId, array $optionIds = []): DataResponse {
#[RequireModeratorOrNoLobby]
#[RequireParticipant]
public function closePoll(int $pollId): DataResponse {
- if ($this->room->getRemoteServer() !== '') {
+ if ($this->room->isFederatedConversation()) {
/** @var \OCA\Talk\Federation\Proxy\TalkV1\Controller\PollController $proxy */
$proxy = \OCP\Server::get(\OCA\Talk\Federation\Proxy\TalkV1\Controller\PollController::class);
return $proxy->closePoll($this->room, $this->participant, $pollId);
diff --git a/lib/Controller/RoomController.php b/lib/Controller/RoomController.php
index 466478da3d2..c555a5e961d 100644
--- a/lib/Controller/RoomController.php
+++ b/lib/Controller/RoomController.php
@@ -847,7 +847,7 @@ public function deleteRoom(): DataResponse {
#[RequireModeratorOrNoLobby]
#[RequireParticipant]
public function getParticipants(bool $includeStatus = false): DataResponse {
- if ($this->room->getRemoteServer()) {
+ if ($this->room->isFederatedConversation()) {
/** @var \OCA\Talk\Federation\Proxy\TalkV1\Controller\RoomController $proxy */
$proxy = \OCP\Server::get(\OCA\Talk\Federation\Proxy\TalkV1\Controller\RoomController::class);
return $proxy->getParticipants($this->room, $this->participant);
@@ -1268,7 +1268,7 @@ public function removeSelfFromRoom(): DataResponse {
* @return DataResponse, array{}>
*/
protected function removeSelfFromRoomLogic(Room $room, Participant $participant): DataResponse {
- if ($room->getRemoteServer() !== '') {
+ if ($room->isFederatedConversation()) {
$this->federationManager->rejectByRemoveSelf($room, $this->userId);
}
@@ -1538,7 +1538,7 @@ public function joinRoom(string $token, string $password = '', bool $force = tru
}
$headers = [];
- if ($room->getRemoteServer() !== '') {
+ if ($room->isFederatedConversation()) {
$participant = $this->participantService->getParticipant($room, $this->userId);
/** @var \OCA\Talk\Federation\Proxy\TalkV1\Controller\RoomController $proxy */
@@ -2248,7 +2248,7 @@ public function setMessageExpiration(int $seconds): DataResponse {
#[RequireParticipant]
public function getCapabilities(): DataResponse {
$headers = [];
- if ($this->room->getRemoteServer()) {
+ if ($this->room->isFederatedConversation()) {
/** @var \OCA\Talk\Federation\Proxy\TalkV1\Controller\RoomController $proxy */
$proxy = \OCP\Server::get(\OCA\Talk\Federation\Proxy\TalkV1\Controller\RoomController::class);
$response = $proxy->getCapabilities($this->room, $this->participant);
diff --git a/lib/Flow/Operation.php b/lib/Flow/Operation.php
index 2f1b0625ba9..24d529e922d 100644
--- a/lib/Flow/Operation.php
+++ b/lib/Flow/Operation.php
@@ -113,7 +113,7 @@ public function onEvent(string $eventName, Event $event, IRuleMatcher $ruleMatch
continue;
}
- if ($room->getRemoteServer() !== '') {
+ if ($room->isFederatedConversation()) {
// Ignore conversation because it is a proxy conversation
continue;
}
@@ -202,7 +202,7 @@ protected function validateOperationConfig(int $mode, string $token, string $uid
throw new UnexpectedValueException('Room not found', $e->getCode(), $e);
}
- if ($room->getRemoteServer() !== '') {
+ if ($room->isFederatedConversation()) {
throw new UnexpectedValueException('Room is a proxy conversation');
}
diff --git a/lib/Middleware/InjectionMiddleware.php b/lib/Middleware/InjectionMiddleware.php
index d908d912246..2b665fb93fc 100644
--- a/lib/Middleware/InjectionMiddleware.php
+++ b/lib/Middleware/InjectionMiddleware.php
@@ -279,7 +279,7 @@ protected function getRoomByInvite(AEnvironmentAwareController $controller): voi
*/
protected function checkFederationSupport(AEnvironmentAwareController $controller): void {
$room = $controller->getRoom();
- if ($room instanceof Room && $room->getRemoteServer() !== '') {
+ if ($room instanceof Room && $room->isFederatedConversation()) {
throw new FederationUnsupportedFeatureException();
}
}
diff --git a/lib/Room.php b/lib/Room.php
index 4d2d2a3abae..0f2f5cfce43 100644
--- a/lib/Room.php
+++ b/lib/Room.php
@@ -356,7 +356,7 @@ public function setLastMessageId(int $lastMessageId): void {
}
public function getLastMessage(): ?IComment {
- if ($this->lastMessageId && $this->lastMessage === null && $this->getRemoteServer() === '') {
+ if ($this->lastMessageId && $this->lastMessage === null && !$this->isFederatedConversation()) {
$this->lastMessage = $this->manager->loadLastCommentInfo($this->lastMessageId);
if ($this->lastMessage === null) {
$this->lastMessageId = 0;
diff --git a/lib/Search/CurrentMessageSearch.php b/lib/Search/CurrentMessageSearch.php
index cdfe117a67f..90691236948 100644
--- a/lib/Search/CurrentMessageSearch.php
+++ b/lib/Search/CurrentMessageSearch.php
@@ -96,7 +96,7 @@ public function search(IUser $user, ISearchQuery $query): SearchResult {
return SearchResult::complete($title, []);
}
- if ($room->getRemoteServer() !== '') {
+ if ($room->isFederatedConversation()) {
return SearchResult::complete($title, []);
}
diff --git a/lib/Search/MessageSearch.php b/lib/Search/MessageSearch.php
index 8ca3c5f64ac..770b2ecad7c 100644
--- a/lib/Search/MessageSearch.php
+++ b/lib/Search/MessageSearch.php
@@ -170,7 +170,7 @@ public function performSearch(IUser $user, ISearchQuery $query, string $title, a
}
}
- if ($room->getRemoteServer() !== '') {
+ if ($room->isFederatedConversation()) {
continue;
}
diff --git a/lib/Service/AvatarService.php b/lib/Service/AvatarService.php
index 70757074a98..03f5930ecf8 100644
--- a/lib/Service/AvatarService.php
+++ b/lib/Service/AvatarService.php
@@ -309,7 +309,7 @@ private function getAvatarPath(Room $room, bool $darkTheme = false): string {
if ($room->getObjectType() === Room::OBJECT_TYPE_PHONE) {
return __DIR__ . '/../../img/icon-conversation-phone-' . $colorTone . '.svg';
}
- if ($room->getRemoteServer() !== '') {
+ if ($room->isFederatedConversation()) {
return __DIR__ . '/../../img/icon-conversation-federation-' . $colorTone . '.svg';
}
if ($room->getType() === Room::TYPE_PUBLIC) {
diff --git a/lib/Service/RoomFormatter.php b/lib/Service/RoomFormatter.php
index 0b5cc47d38b..90a1c20b16e 100644
--- a/lib/Service/RoomFormatter.php
+++ b/lib/Service/RoomFormatter.php
@@ -344,7 +344,7 @@ public function formatRoomV4(
$roomData['lastReadMessage'] = $attendee->getLastReadMessage();
}
- if ($room->getRemoteServer() && $room->getRemoteToken()) {
+ if ($room->isFederatedConversation()) {
$roomData['remoteServer'] = $room->getRemoteServer();
$roomData['remoteToken'] = $room->getRemoteToken();
}
@@ -379,14 +379,14 @@ public function formatRoomV4(
$roomData['lastMessage'] = [];
$lastMessage = $room->getLastMessage();
- if ($room->getRemoteServer() === '' && $lastMessage instanceof IComment) {
+ if (!$room->isFederatedConversation() && $lastMessage instanceof IComment) {
$roomData['lastMessage'] = $this->formatLastMessage(
$responseFormat,
$room,
$currentParticipant,
$lastMessage,
);
- } elseif ($room->getRemoteServer() !== '') {
+ } elseif ($room->isFederatedConversation()) {
$roomData['lastCommonReadMessage'] = 0;
try {
$cachedMessage = $this->pcmService->findByRemote(
@@ -399,7 +399,7 @@ public function formatRoomV4(
}
}
- if ($room->getRemoteServer() !== '') {
+ if ($room->isFederatedConversation()) {
$roomData['attendeeId'] = (int) $attendee->getRemoteId();
$roomData['canLeaveConversation'] = true;
}
diff --git a/lib/Share/RoomShareProvider.php b/lib/Share/RoomShareProvider.php
index 5de76a61c83..bddd57b4100 100644
--- a/lib/Share/RoomShareProvider.php
+++ b/lib/Share/RoomShareProvider.php
@@ -121,7 +121,7 @@ public function create(IShare $share): IShare {
throw new GenericShareException('Room not found', $this->l->t('Conversation not found'), 404);
}
- if ($room->getRemoteServer() !== '') {
+ if ($room->isFederatedConversation()) {
throw new GenericShareException('Room not found', $this->l->t('Conversation not found'), 404);
}
diff --git a/tests/php/BackgroundJob/RemoveEmptyRoomsTest.php b/tests/php/BackgroundJob/RemoveEmptyRoomsTest.php
index 0a23a09e8e9..52bcb26d706 100644
--- a/tests/php/BackgroundJob/RemoveEmptyRoomsTest.php
+++ b/tests/php/BackgroundJob/RemoveEmptyRoomsTest.php
@@ -139,10 +139,8 @@ public function testDeleteIfIsEmpty(string $objectType, int $actorsCount, int $i
->willReturn(Room::TYPE_GROUP);
$room->method('getObjectType')
->willReturn($objectType);
- $room->method('getRemoteServer')
- ->willReturn($inviteCount ? 'https://remote.example.tld' : '');
- $room->method('getRemoteToken')
- ->willReturn($inviteCount ? 'remote' : '');
+ $room->method('isFederatedConversation')
+ ->willReturn($inviteCount > 0);
$this->federationManager->method('getNumberOfInvitations')
->with($room)