refactor: remove duplicated methods in chatModel and use profileModel

This commit is contained in:
Jonathan Rainville 2020-09-17 10:32:58 -04:00 committed by Iuri Matias
parent 0c0baf29e8
commit fd93650b23
4 changed files with 7 additions and 16 deletions

View File

@ -513,15 +513,6 @@ QtObject:
proc renameGroup*(self: ChatsView, newName: string) {.slot.} =
self.status.chat.renameGroup(self.activeChannel.id, newName)
proc blockContact*(self: ChatsView, id: string): string {.slot.} =
return self.status.contacts.blockContact(id)
proc addContact*(self: ChatsView, id: string): string {.slot.} =
return self.status.contacts.addContact(id)
proc removeContact*(self: ChatsView, id: string) {.slot.} =
self.status.contacts.removeContact(id)
proc createGroup*(self: ChatsView, groupName: string, pubKeys: string) {.slot.} =
let pubKeysSeq = map(parseJson(pubKeys).getElems(), proc(x:JsonNode):string = x.getStr)
self.status.chat.createGroup(groupName, pubKeysSeq)

View File

@ -276,9 +276,9 @@ QtObject:
ensVerified: false
)
self.contactToAddChanged()
proc addContact*(self: ProfileView, pk: string) {.slot.} =
discard self.status.contacts.addContact(pk)
proc addContact*(self: ProfileView, pk: string): string {.slot.} =
return self.status.contacts.addContact(pk)
proc changeContactNickname*(self: ProfileView, publicKey: string, nickname: string) {.slot.} =
discard self.status.contacts.addContact(publicKey, nickname)
@ -286,8 +286,8 @@ QtObject:
proc unblockContact*(self: ProfileView, id: string) {.slot.} =
discard self.status.contacts.unblockContact(id)
proc blockContact*(self: ProfileView, id: string) {.slot.} =
discard self.status.contacts.blockContact(id)
proc blockContact*(self: ProfileView, id: string): string {.slot.} =
return self.status.contacts.blockContact(id)
proc removeContact*(self: ProfileView, id: string) {.slot.} =
self.status.contacts.removeContact(id)

View File

@ -140,7 +140,7 @@ StackLayout {
BlockContactConfirmationDialog {
id: blockContactConfirmationDialog
onBlockButtonClicked: {
chatsModel.blockContact(blockContactConfirmationDialog.contactAddress)
profileModel.blockContact(blockContactConfirmationDialog.contactAddress)
blockContactConfirmationDialog.close()
profilePopup.close()
}

View File

@ -356,7 +356,7 @@ ModalPopup {
if (profileModel.isAdded(fromAuthor)) {
popup.removeButtonClicked(fromAuthor)
} else {
chatsModel.addContact(fromAuthor)
profileModel.addContact(fromAuthor)
}
profilePopup.close()
}