Skip to content

Commit fb3cab7

Browse files
committed
Filter out empty chats.
1 parent c1e1ac1 commit fb3cab7

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Sources/App/Services/ChatService.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ actor ChatService: ChatServiceProtocol {
9898
}
9999

100100
func chats(with userId: UserID, fullInfo: Bool) async throws -> [ChatInfo] {
101-
try await repo.all(with: userId, fullInfo: fullInfo).map {
102-
ChatInfo(from: $0, fullInfo: fullInfo)
101+
try await repo.all(with: userId, fullInfo: fullInfo).compactMap {
102+
$0.chat.lastMessage == nil ? nil : ChatInfo(from: $0, fullInfo: fullInfo)
103103
}
104104
}
105105

0 commit comments

Comments
 (0)