mirror of
https://github.com/Govor-team/Govor.git
synced 2026-11-17 21:09:00 +00:00
Add reactions, reliable push & session checks
Implements message reactions and reaction packs (domain models, services, admin HTTP API, media processing via ImageSharp and limits) and adds reliable push delivery (ChatPushNotification, ChatPushDispatcher, ChatPushWorker, improved ChatNotificationService). Enhances message reading (ReadChat API, unread counts, concurrency-safe receipts) and tightens session security (access-token session validation in JWT, hub filter, SessionAuthorization). Improves SignalR behavior (session groups, reaction/channel events, hub/error mappings). Adds EF migrations, many controller fixes (Forbid handling, password API), tests (Govor.Server.Tests), docs, CI and tooling updates (Dockerfile → .NET 10, GH Actions matrix for sqlite/postgres, Govor.Server.slnx, global.json), and small infra changes (AutoMapper bump, NullPushProvider, storage/token handling).
This commit is contained in:
@@ -40,6 +40,21 @@ public class FirebasePushProvider : IPushNotificationProvider
|
||||
{
|
||||
if (tokens.Count == 0)
|
||||
return new SendPushResult(0, 0, []);
|
||||
|
||||
if (tokens.Count > 500)
|
||||
{
|
||||
var success = 0;
|
||||
var failure = 0;
|
||||
var invalid = new List<string>();
|
||||
foreach (var batch in tokens.Distinct().Chunk(500))
|
||||
{
|
||||
var result = await SendMulticastAsync(batch, message);
|
||||
success += result.SuccessCount;
|
||||
failure += result.FailureCount;
|
||||
invalid.AddRange(result.FailedTokens);
|
||||
}
|
||||
return new SendPushResult(success, failure, invalid);
|
||||
}
|
||||
|
||||
var multicastMsg = new MulticastMessage
|
||||
{
|
||||
@@ -89,7 +104,7 @@ public class FirebasePushProvider : IPushNotificationProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "FCM multicast failed");
|
||||
return new SendPushResult(0, tokens.Count, tokens.ToList());
|
||||
throw; // A provider outage does not invalidate device tokens.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,8 +139,6 @@ public class FirebasePushProvider : IPushNotificationProvider
|
||||
|
||||
private static bool IsInvalidTokenError(FirebaseMessagingException ex)
|
||||
{
|
||||
return ex.MessagingErrorCode is MessagingErrorCode.Unregistered
|
||||
or MessagingErrorCode.InvalidArgument
|
||||
or MessagingErrorCode.SenderIdMismatch;
|
||||
return ex.MessagingErrorCode is MessagingErrorCode.Unregistered;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user