🐛 Fixes in notification
This commit is contained in:
@@ -142,8 +142,15 @@ public class PushService
|
||||
if (!isSilent) _ = DeliveryNotification(notification);
|
||||
}
|
||||
|
||||
public async Task DeliveryNotification(Notification notification)
|
||||
private async Task DeliveryNotification(Notification notification)
|
||||
{
|
||||
_logger.LogInformation(
|
||||
"Delivering notification: {NotificationTopic} #{NotificationId} with meta {NotificationMeta}",
|
||||
notification.Topic,
|
||||
notification.Id,
|
||||
notification.Meta
|
||||
);
|
||||
|
||||
// Pushing the notification
|
||||
var subscribers = await _db.PushSubscriptions
|
||||
.Where(s => s.AccountId == notification.AccountId)
|
||||
@@ -184,6 +191,13 @@ public class PushService
|
||||
}).ToList();
|
||||
await _db.BulkInsertAsync(notifications);
|
||||
}
|
||||
|
||||
_logger.LogInformation(
|
||||
"Delivering notification in batch: {NotificationTopic} #{NotificationId} with meta {NotificationMeta}",
|
||||
notification.Topic,
|
||||
notification.Id,
|
||||
notification.Meta
|
||||
);
|
||||
|
||||
var subscribers = await _db.PushSubscriptions
|
||||
.Where(s => accounts.Contains(s.AccountId))
|
||||
|
@@ -91,7 +91,9 @@ public class PusherServiceGrpc(
|
||||
request.Notification.Title,
|
||||
request.Notification.Subtitle,
|
||||
request.Notification.Body,
|
||||
GrpcTypeHelper.ConvertByteStringToObject<Dictionary<string, object?>>(request.Notification.Meta) ?? [],
|
||||
request.Notification.HasMeta
|
||||
? GrpcTypeHelper.ConvertByteStringToObject<Dictionary<string, object?>>(request.Notification.Meta) ?? []
|
||||
: [],
|
||||
request.Notification.ActionUri,
|
||||
request.Notification.IsSilent,
|
||||
request.Notification.IsSavable
|
||||
@@ -108,8 +110,9 @@ public class PusherServiceGrpc(
|
||||
Title = request.Notification.Title,
|
||||
Subtitle = request.Notification.Subtitle,
|
||||
Content = request.Notification.Body,
|
||||
Meta = GrpcTypeHelper.ConvertByteStringToObject<Dictionary<string, object?>>(request.Notification.Meta) ??
|
||||
[]
|
||||
Meta = request.Notification.HasMeta
|
||||
? GrpcTypeHelper.ConvertByteStringToObject<Dictionary<string, object?>>(request.Notification.Meta) ?? []
|
||||
: [],
|
||||
};
|
||||
if (request.Notification.ActionUri is not null)
|
||||
notification.Meta["action_uri"] = request.Notification.ActionUri;
|
||||
|
@@ -85,7 +85,7 @@ message PushNotification {
|
||||
string title = 2;
|
||||
string subtitle = 3;
|
||||
string body = 4;
|
||||
bytes meta = 5;
|
||||
optional bytes meta = 5;
|
||||
optional string action_uri = 6;
|
||||
bool is_silent = 7;
|
||||
bool is_savable = 8;
|
||||
|
Reference in New Issue
Block a user