summaryrefslogtreecommitdiffstats
path: root/lib/Federation/CloudFederationProviderTalk.php
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2024-05-10 16:42:20 +0200
committerJoas Schilling <coding@schilljs.com>2024-05-13 15:53:19 +0200
commit9b2a09c6e4c0bf1ecbc41851f3cc951d147fec51 (patch)
tree01b8b0b6e43152e5ba147c104795c2fe57c44ae2 /lib/Federation/CloudFederationProviderTalk.php
parent133a7ca0287059e92ba6dfd8d79ccee3d2299bf7 (diff)
fix(federation): Don't send notifications for most system messages in federation
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Federation/CloudFederationProviderTalk.php')
-rw-r--r--lib/Federation/CloudFederationProviderTalk.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Federation/CloudFederationProviderTalk.php b/lib/Federation/CloudFederationProviderTalk.php
index 2ab2e71c2..c49a64c20 100644
--- a/lib/Federation/CloudFederationProviderTalk.php
+++ b/lib/Federation/CloudFederationProviderTalk.php
@@ -36,6 +36,7 @@ use OCA\Talk\Service\RoomService;
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Http;
use OCP\AppFramework\Services\IAppConfig;
+use OCP\AppFramework\Utility\ITimeFactory;
use OCP\DB\Exception as DBException;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Federation\Exceptions\ActionNotSupportedException;
@@ -79,6 +80,7 @@ class CloudFederationProviderTalk implements ICloudFederationProvider {
private ProxyCacheMessageService $pcmService,
private FederationChatNotifier $federationChatNotifier,
private UserConverter $userConverter,
+ private ITimeFactory $timeFactory,
ICacheFactory $cacheFactory,
) {
$this->proxyCacheMessages = $cacheFactory->isAvailable() ? $cacheFactory->createDistributed(CachePrefix::FEDERATED_PCM) : null;
@@ -385,7 +387,11 @@ class CloudFederationProviderTalk implements ICloudFederationProvider {
if ($notification['messageData']['remoteMessageId'] > $lastMessageId) {
$lastMessageId = (int) $notification['messageData']['remoteMessageId'];
}
- $this->roomService->setLastMessageInfo($room, $lastMessageId, new \DateTime());
+
+ if ($notification['messageData']['systemMessage'] !== 'message_edited'
+ && $notification['messageData']['systemMessage'] !== 'message_deleted') {
+ $this->roomService->setLastMessageInfo($room, $lastMessageId, $this->timeFactory->getDateTime());
+ }
if ($this->proxyCacheMessages instanceof ICache) {
$cacheKey = sha1(json_encode([$notification['remoteServerUrl'], $notification['remoteToken']]));