From c3f47c5fa13026f24a4c2e9747882fba4e7a0772 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20Kaan=20K=C3=B6se?= Date: Sat, 26 Apr 2025 11:02:41 +0200 Subject: [PATCH] Check account notification preferences after the synchronization. (#647) --- Wino.Core.Domain/Interfaces/IAccountService.cs | 8 ++++++++ .../MessageHandlers/MailSynchronizationRequestHandler.cs | 7 ++++++- Wino.Services/AccountService.cs | 7 +++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Wino.Core.Domain/Interfaces/IAccountService.cs b/Wino.Core.Domain/Interfaces/IAccountService.cs index 96c38315..63aba714 100644 --- a/Wino.Core.Domain/Interfaces/IAccountService.cs +++ b/Wino.Core.Domain/Interfaces/IAccountService.cs @@ -162,4 +162,12 @@ public interface IAccountService /// Identifies the account for which the synchronization identifier is being updated. /// Represents the new synchronization identifier to be set for the specified account. Task UpdateSyncIdentifierRawAsync(Guid accountId, string syncIdentifier); + + + /// + /// Gets whether the notifications are enabled for the given account id. + /// + /// Account id. + /// Whether the notifications should be created after sync or not. + Task IsNotificationsEnabled(Guid accountId); } diff --git a/Wino.Server/MessageHandlers/MailSynchronizationRequestHandler.cs b/Wino.Server/MessageHandlers/MailSynchronizationRequestHandler.cs index 47134a09..e888c3fe 100644 --- a/Wino.Server/MessageHandlers/MailSynchronizationRequestHandler.cs +++ b/Wino.Server/MessageHandlers/MailSynchronizationRequestHandler.cs @@ -23,14 +23,17 @@ public class MailSynchronizationRequestHandler : ServerMessageHandler IsNotificationsEnabled(Guid accountId) + { + var account = await GetAccountAsync(accountId); + + return account?.Preferences?.IsNotificationsEnabled ?? false; + } }