fix: read missing functions

This commit is contained in:
Richard Ramos 2020-06-23 10:23:52 -04:00 committed by Iuri Matias
parent 578277452a
commit acecafbf83
4 changed files with 22 additions and 2 deletions

View File

@ -167,3 +167,9 @@ QtObject:
proc addGroupMembers*(self: ChatsView, chatId: string, pubKeys: string) {.slot.} =
let pubKeysSeq = map(parseJson(pubKeys).getElems(), proc(x:JsonNode):string = x.getStr)
self.status.chat.addGroupMembers(chatId, pubKeysSeq)
proc kickGroupMember*(self: ChatsView, chatId: string, pubKey: string) {.slot.} =
self.status.chat.kickGroupMember(chatId, pubKey)
proc makeAdmin*(self: ChatsView, chatId: string, pubKey: string) {.slot.} =
self.status.chat.makeAdmin(chatId, pubKey)

View File

@ -179,3 +179,11 @@ proc createGroup*(self: ChatModel, groupName: string, pubKeys: seq[string]) =
proc addGroupMembers*(self: ChatModel, chatId: string, pubKeys: seq[string]) =
var response = status_chat.addGroupMembers(chatId, pubKeys)
self.emitUpdate(response)
proc kickGroupMember*(self: ChatModel, chatId: string, pubKey: string) =
var response = status_chat.kickGroupMember(chatId, pubKey)
self.emitUpdate(response)
proc makeAdmin*(self: ChatModel, chatId: string, pubKey: string) =
var response = status_chat.makeAdmin(chatId, pubKey)
self.emitUpdate(response)

View File

@ -102,3 +102,9 @@ proc createGroup*(groupName: string, pubKeys: seq[string]): string =
proc addGroupMembers*(chatId: string, pubKeys: seq[string]): string =
callPrivateRPC("addMembersToGroupChat".prefix, %* [nil, chatId, pubKeys])
proc kickGroupMember*(chatId: string, pubKey: string): string =
callPrivateRPC("removeMemberFromGroupChat".prefix, %* [nil, chatId, pubKey])
proc makeAdmin*(chatId: string, pubKey: string): string =
callPrivateRPC("addAdminsToGroupChat".prefix, %* [nil, chatId, [pubKey]])

View File

@ -293,13 +293,13 @@ ModalPopup {
Action {
icon.source: "../../../img/make-admin.svg"
text: qsTr("Make Admin")
onTriggered: chatsModel.leaveActiveChat()
onTriggered: chatsModel.makeAdmin(chatsModel.activeChannel.id, model.pubKey)
}
Action {
icon.source: "../../../img/remove-from-group.svg"
icon.color: Theme.red
text: qsTr("Remove From Group")
onTriggered: chatsModel.leaveActiveChat()
onTriggered: chatsModel.kickGroupMember(chatsModel.activeChannel.id, model.pubKey)
}
}
}