mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-24 21:25:35 +01:00
remove thread for getTempMessagesForConversation
i'm not yet sure about it and did not have a problem with it, but i guess this change makes sense to ensure temporary messages from a thread are not shown and remain in the main chat. This could theoretically happen when directly leaving a thread after sending a message? Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
8c8bee3fe9
commit
d25e85e3f2
@ -379,7 +379,7 @@ class OfflineFirstChatRepository @Inject constructor(
|
||||
}
|
||||
|
||||
// remove all temp messages from UI
|
||||
val oldTempMessages = chatDao.getTempMessagesForConversation(internalConversationId, threadId)
|
||||
val oldTempMessages = chatDao.getTempMessagesForConversation(internalConversationId)
|
||||
.first()
|
||||
.map(ChatMessageEntity::asModel)
|
||||
oldTempMessages.forEach {
|
||||
@ -403,7 +403,7 @@ class OfflineFirstChatRepository @Inject constructor(
|
||||
)
|
||||
|
||||
// add the remaining temp messages to UI again
|
||||
val remainingTempMessages = chatDao.getTempMessagesForConversation(internalConversationId, threadId)
|
||||
val remainingTempMessages = chatDao.getTempMessagesForConversation(internalConversationId)
|
||||
.first()
|
||||
.sortedBy { it.internalId }
|
||||
.map(ChatMessageEntity::asModel)
|
||||
|
@ -49,11 +49,10 @@ interface ChatMessagesDao {
|
||||
FROM ChatMessages
|
||||
WHERE internalConversationId = :internalConversationId
|
||||
AND isTemporary = 1
|
||||
AND (:threadId IS NULL OR threadId = :threadId)
|
||||
ORDER BY timestamp DESC, id DESC
|
||||
"""
|
||||
)
|
||||
fun getTempMessagesForConversation(internalConversationId: String, threadId: Long?): Flow<List<ChatMessageEntity>>
|
||||
fun getTempMessagesForConversation(internalConversationId: String): Flow<List<ChatMessageEntity>>
|
||||
|
||||
@Query(
|
||||
"""
|
||||
|
@ -31,8 +31,7 @@ class DummyChatMessagesDaoImpl : ChatMessagesDao {
|
||||
override fun getMessagesForConversation(internalConversationId: String): Flow<List<ChatMessageEntity>> = flowOf()
|
||||
|
||||
override fun getTempMessagesForConversation(
|
||||
internalConversationId: String,
|
||||
threadId: Long?
|
||||
internalConversationId: String
|
||||
): Flow<List<ChatMessageEntity>> = flowOf()
|
||||
|
||||
override fun getTempUnsentMessagesForConversation(
|
||||
|
Loading…
Reference in New Issue
Block a user