Compare commits
2 Commits
5181897463
...
ea8158cb50
Author | SHA1 | Date | |
---|---|---|---|
|
ea8158cb50 | ||
|
65398c5fec |
@@ -381,8 +381,23 @@ public partial class ChatService(
|
||||
messageSenders = await crs.LoadMemberAccounts(messageSenders);
|
||||
messageSenders = messageSenders.Where(x => x.Account is not null).ToList();
|
||||
|
||||
// Get keys of messages to remove (where sender is not found)
|
||||
var messagesToRemove = messages
|
||||
.Where(m => messageSenders.All(s => s.Id != m.Value.SenderId))
|
||||
.Select(m => m.Key)
|
||||
.ToList();
|
||||
|
||||
// Remove messages with no sender
|
||||
foreach (var key in messagesToRemove)
|
||||
{
|
||||
messages.Remove(key);
|
||||
}
|
||||
|
||||
// Update remaining messages with their senders
|
||||
foreach (var message in messages)
|
||||
{
|
||||
message.Value!.Sender = messageSenders.First(x => x.Id == message.Value.SenderId);
|
||||
}
|
||||
|
||||
return messages;
|
||||
}
|
||||
|
@@ -245,7 +245,6 @@ public class StickerController(AppDatabase db, StickerService st, FileService.Fi
|
||||
return permissionCheck;
|
||||
|
||||
var sticker = await db.Stickers
|
||||
.Include(s => s.Image)
|
||||
.Include(s => s.Pack)
|
||||
.ThenInclude(p => p.Publisher)
|
||||
.FirstOrDefaultAsync(e => e.Id == id && e.Pack.Id == packId);
|
||||
|
Reference in New Issue
Block a user