refactor(@chat): clear chat history
This commit is contained in:
parent
8ddda242d8
commit
6c76974985
|
@ -134,4 +134,7 @@ method unmuteChat*(self: Controller, chatId: string) =
|
|||
self.chatService.unmuteChat(chatId)
|
||||
|
||||
method markAllMessagesRead*(self: Controller, chatId: string) =
|
||||
self.messageService.markAllMessagesRead(chatId)
|
||||
self.messageService.markAllMessagesRead(chatId)
|
||||
|
||||
method clearChatHistory*(self: Controller, chatId: string) =
|
||||
self.chatService.clearChatHistory(chatId)
|
|
@ -61,4 +61,7 @@ method unmuteChat*(self: AccessInterface, chatId: string) {.base.} =
|
|||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method markAllMessagesRead*(self: AccessInterface, chatId: string) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method clearChatHistory*(self: AccessInterface, chatId: string) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
|
@ -295,4 +295,7 @@ method onMarkAllMessagesRead*(self: Module, chatId: string) =
|
|||
self.view.model().setHasUnreadMessage(chatId, value=false)
|
||||
|
||||
method markAllMessagesRead*(self: Module, chatId: string) =
|
||||
self.controller.markAllMessagesRead(chatId)
|
||||
self.controller.markAllMessagesRead(chatId)
|
||||
|
||||
method clearChatHistory*(self: Module, chatId: string) =
|
||||
self.controller.clearChatHistory(chatId)
|
|
@ -34,4 +34,7 @@ method unmuteChat*(self: AccessInterface, chatId: string) {.base.} =
|
|||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method markAllMessagesRead*(self: AccessInterface, chatId: string) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method clearChatHistory*(self: AccessInterface, chatId: string) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
|
@ -106,4 +106,7 @@ QtObject:
|
|||
self.delegate.unmuteChat(chatId)
|
||||
|
||||
proc markAllMessagesRead*(self: View, chatId: string) {.slot.} =
|
||||
self.delegate.markAllMessagesRead(chatId)
|
||||
self.delegate.markAllMessagesRead(chatId)
|
||||
|
||||
proc clearChatHistory*(self: View, chatId: string) {.slot.} =
|
||||
self.delegate.clearChatHistory(chatId)
|
|
@ -58,6 +58,7 @@ const SIGNAL_SENDING_SUCCESS* = "messageSendingSuccess_new"
|
|||
const SIGNAL_MESSAGE_DELETED* = "messageDeleted_new"
|
||||
const SIGNAL_CHAT_MUTED* = "new-chatMuted"
|
||||
const SIGNAL_CHAT_UNMUTED* = "new-chatUnmuted"
|
||||
const SIGNAL_CHAT_HISTORY_CLEARED* = "new-chatHistoryCleared"
|
||||
|
||||
QtObject:
|
||||
type Service* = ref object of QObject
|
||||
|
@ -320,4 +321,18 @@ QtObject:
|
|||
except Exception as e:
|
||||
let errDesription = e.msg
|
||||
error "error: ", errDesription
|
||||
return
|
||||
return
|
||||
|
||||
method clearChatHistory*(self: Service, chatId: string) =
|
||||
try:
|
||||
let response = status_chat.deleteMessagesByChatId(chatId)
|
||||
if(not response.error.isNil):
|
||||
let msg = response.error.message & " chatId=" & chatId
|
||||
error "error while clearing chat history ", msg
|
||||
return
|
||||
|
||||
self.events.emit(SIGNAL_CHAT_HISTORY_CLEARED, ChatArgs(chatId: chatId))
|
||||
except Exception as e:
|
||||
let errDesription = e.msg
|
||||
error "error: ", errDesription
|
||||
return
|
||||
|
|
|
@ -288,6 +288,10 @@ Item {
|
|||
onMarkAllMessagesRead: {
|
||||
root.communitySectionModule.markAllMessagesRead(id)
|
||||
}
|
||||
|
||||
onClearChatHistory: {
|
||||
root.communitySectionModule.clearChatHistory(id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -287,6 +287,10 @@ Item {
|
|||
onMarkAllMessagesRead: {
|
||||
root.chatSectionModule.markAllMessagesRead(id)
|
||||
}
|
||||
|
||||
onClearChatHistory: {
|
||||
root.chatSectionModule.clearChatHistory(id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue