🐛 Fix notification missing websocket
This commit is contained in:
@@ -111,7 +111,7 @@ public class PushService
|
|||||||
return subscription;
|
return subscription;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task SendNotification(Account account,
|
public void SendNotification(Account account,
|
||||||
string topic,
|
string topic,
|
||||||
string? title = null,
|
string? title = null,
|
||||||
string? subtitle = null,
|
string? subtitle = null,
|
||||||
@@ -153,6 +153,12 @@ public class PushService
|
|||||||
notification.Meta
|
notification.Meta
|
||||||
);
|
);
|
||||||
|
|
||||||
|
_ws.SendPacketToAccount(notification.AccountId.ToString(), new Connection.WebSocketPacket
|
||||||
|
{
|
||||||
|
Type = "notifications.new",
|
||||||
|
Data = notification
|
||||||
|
});
|
||||||
|
|
||||||
// Pushing the notification
|
// Pushing the notification
|
||||||
var subscribers = await _db.PushSubscriptions
|
var subscribers = await _db.PushSubscriptions
|
||||||
.Where(s => s.AccountId == notification.AccountId)
|
.Where(s => s.AccountId == notification.AccountId)
|
||||||
@@ -206,6 +212,16 @@ public class PushService
|
|||||||
notification.Meta
|
notification.Meta
|
||||||
);
|
);
|
||||||
|
|
||||||
|
foreach (var account in accounts)
|
||||||
|
{
|
||||||
|
notification.AccountId = account;
|
||||||
|
_ws.SendPacketToAccount(account.ToString(), new Connection.WebSocketPacket
|
||||||
|
{
|
||||||
|
Type = "notifications.new",
|
||||||
|
Data = notification
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
var subscribers = await _db.PushSubscriptions
|
var subscribers = await _db.PushSubscriptions
|
||||||
.Where(s => accounts.Contains(s.AccountId))
|
.Where(s => accounts.Contains(s.AccountId))
|
||||||
.AsNoTracking()
|
.AsNoTracking()
|
||||||
|
Reference in New Issue
Block a user