fix(backend): ignore proxied messages if the original is ignored

This commit is contained in:
sam 2025-03-14 20:29:01 +01:00
parent cb43ac1a50
commit 84c3b42874
Signed by: sam
GPG key ID: 5F3C3C1B3166639D
2 changed files with 29 additions and 6 deletions

View file

@ -144,6 +144,19 @@ public partial class PkMessageHandler(ILogger logger, IServiceProvider services)
await using var messageRepository =
scope.ServiceProvider.GetRequiredService<MessageRepository>();
if (await messageRepository.IsMessageIgnoredAsync(originalId))
{
_logger.Debug(
"Proxied message {MessageId} should be ignored as trigger {OriginalId} is already ignored",
msgId,
originalId
);
await messageRepository.IgnoreMessageAsync(originalId);
await messageRepository.IgnoreMessageAsync(msgId);
return;
}
_logger.Debug(
"Setting proxy data for {MessageId} and ignoring {OriginalId}",
msgId,
@ -195,6 +208,19 @@ public partial class PkMessageHandler(ILogger logger, IServiceProvider services)
pkMessage.Original
);
if (await messageRepository.IsMessageIgnoredAsync(pkMessage.Original))
{
_logger.Debug(
"Proxied message {MessageId} should be ignored as trigger {OriginalId} is already ignored",
pkMessage.Id,
pkMessage.Original
);
await messageRepository.IgnoreMessageAsync(pkMessage.Original);
await messageRepository.IgnoreMessageAsync(msgId);
return;
}
await messageRepository.SetProxiedMessageDataAsync(
msgId,
pkMessage.Original,