fix(@chat): react to on left chat

fixes #4528
This commit is contained in:
Anthony Laibe 2022-01-25 13:09:27 +01:00 committed by Sale Djenic
parent ba49b2ec20
commit a8f2a3cb08
11 changed files with 19 additions and 23 deletions

View File

@ -71,7 +71,7 @@ method init*(self: Controller) =
self.events.on(chat_service.SIGNAL_CHAT_LEFT) do(e: Args):
let args = chat_service.ChatArgs(e)
self.delegate.removeChat(args.chatId)
self.delegate.onCommunityChannelDeletedOrChatLeft(args.chatId)
self.events.on(SIGNAL_CONTACT_ADDED) do(e: Args):
var args = ContactArgs(e)
@ -105,7 +105,7 @@ method init*(self: Controller) =
self.events.on(SIGNAL_COMMUNITY_CHANNEL_DELETED) do(e:Args):
let args = CommunityChatIdArgs(e)
if (args.communityId == self.sectionId):
self.delegate.onCommunityChannelDeleted(args.chatId)
self.delegate.onCommunityChannelDeletedOrChatLeft(args.chatId)
self.events.on(SIGNAL_COMMUNITY_CHANNEL_EDITED) do(e:Args):
let args = CommunityChatArgs(e)
@ -171,12 +171,8 @@ method setActiveItemSubItem*(self: Controller, itemId: string, subItemId: string
self.delegate.activeItemSubItemSet(self.activeItemId, self.activeSubItemId)
method removeChat*(self: Controller, itemId: string) =
if self.isCommunitySection:
self.communityService.deleteCommunityChat(self.getMySectionId(), itemId)
# else:
# not implemented
# self.chatService.deleteChatById(itemId)
method removeCommunityChat*(self: Controller, itemId: string) =
self.communityService.deleteCommunityChat(self.getMySectionId(), itemId)
method getOneToOneChatNameAndImage*(self: Controller, chatId: string):
tuple[name: string, image: string, isIdenticon: bool] =

View File

@ -42,7 +42,7 @@ method getChatDetailsForChatTypes*(self: AccessInterface, types: seq[ChatType]):
method setActiveItemSubItem*(self: AccessInterface, itemId: string, subItemId: string) {.base.} =
raise newException(ValueError, "No implementation available")
method removeChat*(self: AccessInterface, itemId: string) {.base.} =
method removeCommunityChat*(self: AccessInterface, itemId: string) {.base.} =
raise newException(ValueError, "No implementation available")
method getOneToOneChatNameAndImage*(self: AccessInterface, chatId: string):

View File

@ -356,13 +356,13 @@ method addNewChat*(
# make new added chat active one
self.setActiveItemSubItem(item.id, "")
method removeChat*(self: Module, chatId: string) =
method removeCommunityChat*(self: Module, chatId: string) =
if(not self.chatContentModules.contains(chatId)):
return
self.controller.removeChat(chatId)
self.controller.removeCommunityChat(chatId)
method onCommunityChannelDeleted*(self: Module, chatId: string) =
method onCommunityChannelDeletedOrChatLeft*(self: Module, chatId: string) =
if(not self.chatContentModules.contains(chatId)):
return
self.view.chatsModel().removeItemById(chatId)

View File

@ -32,7 +32,7 @@ method onContactBlocked*(self: AccessInterface, publicKey: string) {.base.} =
method onContactDetailsUpdated*(self: AccessInterface, contactId: string) {.base.} =
raise newException(ValueError, "No implementation available")
method onCommunityChannelDeleted*(self: AccessInterface, chatId: string) {.base.} =
method onCommunityChannelDeletedOrChatLeft*(self: AccessInterface, chatId: string) {.base.} =
raise newException(ValueError, "No implementation available")
method onChatRenamed*(self: AccessInterface, chatId: string, newName: string) {.base.} =

View File

@ -21,7 +21,7 @@ method createOneToOneChat*(self: AccessInterface, chatId: string, ensName: strin
method leaveChat*(self: AccessInterface, chatId: string) {.base.} =
raise newException(ValueError, "No implementation available")
method removeChat*(self: AccessInterface, chatId: string) {.base.} =
method removeCommunityChat*(self: AccessInterface, chatId: string) {.base.} =
raise newException(ValueError, "No implementation available")
method getActiveChatId*(self: AccessInterface): string {.base.} =

View File

@ -157,8 +157,8 @@ QtObject:
proc blockContact*(self: View, publicKey: string) {.slot.} =
self.delegate.blockContact(publicKey)
proc removeChat*(self: View, chatId: string) {.slot} =
self.delegate.removeChat(chatId)
proc removeCommunityChat*(self: View, chatId: string) {.slot} =
self.delegate.removeCommunityChat(chatId)
proc addGroupMembers*(self: View, chatId: string, pubKeys: string) {.slot.} =
self.delegate.addGroupMembers(chatId, pubKeys)

View File

@ -193,7 +193,7 @@ QtObject {
return globalUtils.plainText(text)
}
function removeChat(chatId) {
chatCommunitySectionModule.removeChat(chatId)
function removeCommunityChat(chatId) {
chatCommunitySectionModule.removeCommunityChat(chatId)
}
}

View File

@ -202,7 +202,7 @@ ColumnLayout {
chatContentModule.leaveChat()
}
onDeleteChat: root.rootStore.removeChat(chatId)
onDeleteCommunityChat: root.rootStore.removeCommunityChat(chatId)
onDownloadMessages: {
// Not Refactored Yet

View File

@ -31,7 +31,7 @@ StatusPopupMenu {
signal markAllMessagesRead(string chatId)
signal clearChatHistory(string chatId)
signal downloadMessages(string file)
signal deleteChat(string chatId)
signal deleteCommunityChat(string chatId)
signal leaveChat(string chatId)
signal openPinnedMessagesList(string chatId)
@ -222,7 +222,7 @@ StatusPopupMenu {
}
onConfirmButtonClicked: {
if(root.isCommunityChat)
root.deleteChat(root.chatId)
root.deleteCommunityChat(root.chatId)
else
root.leaveChat(root.chatId)

View File

@ -302,7 +302,7 @@ Item {
root.communitySectionModule.leaveChat(chatId)
}
onDeleteChat: root.store.removeChat(chatId)
onDeleteCommunityChat: root.store.removeCommunityChat(chatId)
onDownloadMessages: {
// Not Refactored Yet

View File

@ -281,7 +281,7 @@ Item {
root.chatSectionModule.leaveChat(chatId)
}
onDeleteChat: {
onDeleteCommunityChat: {
// Not Refactored Yet
}