refactor: remove duplicated methods in chatModel and use profileModel
This commit is contained in:
parent
0c0baf29e8
commit
fd93650b23
|
@ -513,15 +513,6 @@ QtObject:
|
||||||
proc renameGroup*(self: ChatsView, newName: string) {.slot.} =
|
proc renameGroup*(self: ChatsView, newName: string) {.slot.} =
|
||||||
self.status.chat.renameGroup(self.activeChannel.id, newName)
|
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.} =
|
proc createGroup*(self: ChatsView, groupName: string, pubKeys: string) {.slot.} =
|
||||||
let pubKeysSeq = map(parseJson(pubKeys).getElems(), proc(x:JsonNode):string = x.getStr)
|
let pubKeysSeq = map(parseJson(pubKeys).getElems(), proc(x:JsonNode):string = x.getStr)
|
||||||
self.status.chat.createGroup(groupName, pubKeysSeq)
|
self.status.chat.createGroup(groupName, pubKeysSeq)
|
||||||
|
|
|
@ -277,8 +277,8 @@ QtObject:
|
||||||
)
|
)
|
||||||
self.contactToAddChanged()
|
self.contactToAddChanged()
|
||||||
|
|
||||||
proc addContact*(self: ProfileView, pk: string) {.slot.} =
|
proc addContact*(self: ProfileView, pk: string): string {.slot.} =
|
||||||
discard self.status.contacts.addContact(pk)
|
return self.status.contacts.addContact(pk)
|
||||||
|
|
||||||
proc changeContactNickname*(self: ProfileView, publicKey: string, nickname: string) {.slot.} =
|
proc changeContactNickname*(self: ProfileView, publicKey: string, nickname: string) {.slot.} =
|
||||||
discard self.status.contacts.addContact(publicKey, nickname)
|
discard self.status.contacts.addContact(publicKey, nickname)
|
||||||
|
@ -286,8 +286,8 @@ QtObject:
|
||||||
proc unblockContact*(self: ProfileView, id: string) {.slot.} =
|
proc unblockContact*(self: ProfileView, id: string) {.slot.} =
|
||||||
discard self.status.contacts.unblockContact(id)
|
discard self.status.contacts.unblockContact(id)
|
||||||
|
|
||||||
proc blockContact*(self: ProfileView, id: string) {.slot.} =
|
proc blockContact*(self: ProfileView, id: string): string {.slot.} =
|
||||||
discard self.status.contacts.blockContact(id)
|
return self.status.contacts.blockContact(id)
|
||||||
|
|
||||||
proc removeContact*(self: ProfileView, id: string) {.slot.} =
|
proc removeContact*(self: ProfileView, id: string) {.slot.} =
|
||||||
self.status.contacts.removeContact(id)
|
self.status.contacts.removeContact(id)
|
||||||
|
|
|
@ -140,7 +140,7 @@ StackLayout {
|
||||||
BlockContactConfirmationDialog {
|
BlockContactConfirmationDialog {
|
||||||
id: blockContactConfirmationDialog
|
id: blockContactConfirmationDialog
|
||||||
onBlockButtonClicked: {
|
onBlockButtonClicked: {
|
||||||
chatsModel.blockContact(blockContactConfirmationDialog.contactAddress)
|
profileModel.blockContact(blockContactConfirmationDialog.contactAddress)
|
||||||
blockContactConfirmationDialog.close()
|
blockContactConfirmationDialog.close()
|
||||||
profilePopup.close()
|
profilePopup.close()
|
||||||
}
|
}
|
||||||
|
|
|
@ -356,7 +356,7 @@ ModalPopup {
|
||||||
if (profileModel.isAdded(fromAuthor)) {
|
if (profileModel.isAdded(fromAuthor)) {
|
||||||
popup.removeButtonClicked(fromAuthor)
|
popup.removeButtonClicked(fromAuthor)
|
||||||
} else {
|
} else {
|
||||||
chatsModel.addContact(fromAuthor)
|
profileModel.addContact(fromAuthor)
|
||||||
}
|
}
|
||||||
profilePopup.close()
|
profilePopup.close()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue