diff --git a/src/app/chat/view.nim b/src/app/chat/view.nim index 8c81776ae2..b46cab8a1f 100644 --- a/src/app/chat/view.nim +++ b/src/app/chat/view.nim @@ -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) diff --git a/src/status/chat.nim b/src/status/chat.nim index 4ca6c48266..55df43318a 100644 --- a/src/status/chat.nim +++ b/src/status/chat.nim @@ -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) diff --git a/src/status/libstatus/chat.nim b/src/status/libstatus/chat.nim index cfe20c373d..900ff95852 100644 --- a/src/status/libstatus/chat.nim +++ b/src/status/libstatus/chat.nim @@ -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]]) diff --git a/ui/app/AppLayouts/Chat/components/GroupInfoPopup.qml b/ui/app/AppLayouts/Chat/components/GroupInfoPopup.qml index c8f76b3dd7..ecafa34655 100644 --- a/ui/app/AppLayouts/Chat/components/GroupInfoPopup.qml +++ b/ui/app/AppLayouts/Chat/components/GroupInfoPopup.qml @@ -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) } } }