refactor(@chat): clear chat history
This commit is contained in:
parent
8ddda242d8
commit
6c76974985
|
@ -135,3 +135,6 @@ method unmuteChat*(self: Controller, chatId: string) =
|
|||
|
||||
method markAllMessagesRead*(self: Controller, chatId: string) =
|
||||
self.messageService.markAllMessagesRead(chatId)
|
||||
|
||||
method clearChatHistory*(self: Controller, chatId: string) =
|
||||
self.chatService.clearChatHistory(chatId)
|
|
@ -62,3 +62,6 @@ method unmuteChat*(self: AccessInterface, chatId: string) {.base.} =
|
|||
|
||||
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")
|
|
@ -296,3 +296,6 @@ method onMarkAllMessagesRead*(self: Module, chatId: string) =
|
|||
|
||||
method markAllMessagesRead*(self: Module, chatId: string) =
|
||||
self.controller.markAllMessagesRead(chatId)
|
||||
|
||||
method clearChatHistory*(self: Module, chatId: string) =
|
||||
self.controller.clearChatHistory(chatId)
|
|
@ -35,3 +35,6 @@ method unmuteChat*(self: AccessInterface, chatId: string) {.base.} =
|
|||
|
||||
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")
|
|
@ -107,3 +107,6 @@ QtObject:
|
|||
|
||||
proc markAllMessagesRead*(self: View, chatId: string) {.slot.} =
|
||||
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
|
||||
|
@ -321,3 +322,17 @@ QtObject:
|
|||
let errDesription = e.msg
|
||||
error "error: ", errDesription
|
||||
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