summaryrefslogtreecommitdiffstats
path: root/lib/BackgroundJob/RemoveEmptyRooms.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/BackgroundJob/RemoveEmptyRooms.php')
-rw-r--r--lib/BackgroundJob/RemoveEmptyRooms.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/BackgroundJob/RemoveEmptyRooms.php b/lib/BackgroundJob/RemoveEmptyRooms.php
index af9738809..3c620c171 100644
--- a/lib/BackgroundJob/RemoveEmptyRooms.php
+++ b/lib/BackgroundJob/RemoveEmptyRooms.php
@@ -23,6 +23,7 @@ declare(strict_types=1);
namespace OCA\Talk\BackgroundJob;
+use OCA\Talk\Federation\FederationManager;
use OCA\Talk\Service\ParticipantService;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\TimedJob;
@@ -46,6 +47,9 @@ class RemoveEmptyRooms extends TimedJob {
/** @var LoggerInterface */
protected $logger;
+ /** @var FederationManager */
+ protected $federationManager;
+
protected $numDeletedRooms = 0;
public function __construct(ITimeFactory $timeFactory,
@@ -77,7 +81,7 @@ class RemoveEmptyRooms extends TimedJob {
return;
}
- if ($this->participantService->getNumberOfActors($room) === 0 && $room->getObjectType() !== 'file') {
+ if ($this->participantService->getNumberOfActors($room) === 0 && $room->getObjectType() !== 'file' && $this->federationManager->getNumberOfInvitations($room) === 0) {
$room->deleteRoom();
$this->numDeletedRooms++;
}