Exemple #1
0
        public async Task MarkAsReadAsync(int mailId)
        {
            var activeUserId = GetActiveUserId();
            var mail         = await _mailRepository.GetByIdAsync(mailId);

            if (mail.ToUserId == activeUserId)
            {
                await _mailRepository.MarkAsReadAsync(mailId);

                _cache.Remove(UnreadMailCacheKey(mail.SiteId, activeUserId));
                return;
            }
            _logger.LogError($"User {activeUserId} doesn't have permission mark mail {mailId} as read.");
            throw new GraException("Permission denied.");
        }