🐛 Trying to fix chat response missing sender
This commit is contained in:
parent
7dee2a15e7
commit
02ae634690
@ -50,6 +50,8 @@ public class ChatService(
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
message.Sender = sender;
|
||||||
|
message.ChatRoom = room;
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,6 +62,9 @@ public class ChatService(
|
|||||||
string type = WebSocketPacketType.MessageNew
|
string type = WebSocketPacketType.MessageNew
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
message.Sender = sender;
|
||||||
|
message.ChatRoom = room;
|
||||||
|
|
||||||
using var scope = scopeFactory.CreateScope();
|
using var scope = scopeFactory.CreateScope();
|
||||||
var scopedWs = scope.ServiceProvider.GetRequiredService<WebSocketService>();
|
var scopedWs = scope.ServiceProvider.GetRequiredService<WebSocketService>();
|
||||||
var scopedNty = scope.ServiceProvider.GetRequiredService<NotificationService>();
|
var scopedNty = scope.ServiceProvider.GetRequiredService<NotificationService>();
|
||||||
@ -101,15 +106,14 @@ public class ChatService(
|
|||||||
List<Account.Account> accountsToNotify = [];
|
List<Account.Account> accountsToNotify = [];
|
||||||
foreach (var member in members)
|
foreach (var member in members)
|
||||||
{
|
{
|
||||||
// Send WebSocket packet
|
if (member.Account.Id == sender.AccountId) continue;
|
||||||
|
|
||||||
scopedWs.SendPacketToAccount(member.AccountId, new WebSocketPacket
|
scopedWs.SendPacketToAccount(member.AccountId, new WebSocketPacket
|
||||||
{
|
{
|
||||||
Type = type,
|
Type = type,
|
||||||
Data = message
|
Data = message
|
||||||
});
|
});
|
||||||
|
|
||||||
// Only add accounts that aren't null
|
|
||||||
if (member.Account.Id != sender.AccountId)
|
|
||||||
accountsToNotify.Add(member.Account);
|
accountsToNotify.Add(member.Account);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user