diff --git a/src/app/modules/main/chat_section/controller.nim b/src/app/modules/main/chat_section/controller.nim index f1d573ca81..a0dd5090b7 100644 --- a/src/app/modules/main/chat_section/controller.nim +++ b/src/app/modules/main/chat_section/controller.nim @@ -370,6 +370,9 @@ proc leaveCommunity*(self: Controller) = proc removeUserFromCommunity*(self: Controller, pubKey: string) = self.communityService.removeUserFromCommunity(self.sectionId, pubKey) +proc banUserFromCommunity*(self: Controller, pubKey: string) = + self.communityService.banUserFromCommunity(self.sectionId, pubKey) + proc editCommunity*( self: Controller, name: string, diff --git a/src/app/modules/main/chat_section/io_interface.nim b/src/app/modules/main/chat_section/io_interface.nim index 8f7e40f7c4..a134dc6f17 100644 --- a/src/app/modules/main/chat_section/io_interface.nim +++ b/src/app/modules/main/chat_section/io_interface.nim @@ -238,6 +238,9 @@ method leaveCommunity*(self: AccessInterface) {.base.} = method removeUserFromCommunity*(self: AccessInterface, pubKey: string) {.base.} = raise newException(ValueError, "No implementation available") +method banUserFromCommunity*(self: AccessInterface, pubKey: string) {.base.} = + raise newException(ValueError, "No implementation available") + method editCommunity*(self: AccessInterface, name: string, description: string, access: int, ensOnly: bool, color: string, imagePath: string, aX: int, aY: int, bX: int, bY: int) {.base.} = raise newException(ValueError, "No implementation available") diff --git a/src/app/modules/main/chat_section/module.nim b/src/app/modules/main/chat_section/module.nim index 965d188397..3af4cabbbb 100644 --- a/src/app/modules/main/chat_section/module.nim +++ b/src/app/modules/main/chat_section/module.nim @@ -724,6 +724,9 @@ method leaveCommunity*(self: Module) = method removeUserFromCommunity*(self: Module, pubKey: string) = self.controller.removeUserFromCommunity(pubKey) +method banUserFromCommunity*(self: Module, pubKey: string) = + self.controller.banUserFromCommunity(pubkey) + method editCommunity*(self: Module, name: string, description: string, access: int, ensOnly: bool, color: string, imagePath: string, diff --git a/src/app/modules/main/chat_section/view.nim b/src/app/modules/main/chat_section/view.nim index b20480a1d4..84ec176887 100644 --- a/src/app/modules/main/chat_section/view.nim +++ b/src/app/modules/main/chat_section/view.nim @@ -241,6 +241,9 @@ QtObject: proc removeUserFromCommunity*(self: View, pubKey: string) {.slot.} = self.delegate.removeUserFromCommunity(pubKey) + proc banUserFromCommunity*(self: View, pubKey: string) {.slot.} = + self.delegate.banUserFromCommunity(pubKey) + proc editCommunity*(self: View, name: string, description: string, access: int, ensOnly: bool, color: string, imagePath: string, aX: int, aY: int, bX: int, bY: int) {.slot.} = self.delegate.editCommunity(name, description, access, ensOnly, color, imagePath, aX, aY, bX, bY) diff --git a/src/app/modules/main/communities/controller.nim b/src/app/modules/main/communities/controller.nim index 2b7cb34e1b..c049bb0322 100644 --- a/src/app/modules/main/communities/controller.nim +++ b/src/app/modules/main/communities/controller.nim @@ -110,9 +110,6 @@ proc requestCommunityInfo*(self: Controller, communityId: string) = proc importCommunity*(self: Controller, communityKey: string) = self.communityService.importCommunity(communityKey) -proc banUserFromCommunity*(self: Controller, communityId: string, pubKey: string) = - self.communityService.removeUserFromCommunity(communityId, pubKey) - proc setCommunityMuted*(self: Controller, communityId: string, muted: bool) = self.communityService.setCommunityMuted(communityId, muted) diff --git a/src/app/modules/main/communities/io_interface.nim b/src/app/modules/main/communities/io_interface.nim index f9b0dd3179..09add8c086 100644 --- a/src/app/modules/main/communities/io_interface.nim +++ b/src/app/modules/main/communities/io_interface.nim @@ -34,9 +34,6 @@ method reorderCommunityCategories*(self: AccessInterface, communityId: string, c method reorderCommunityChannel*(self: AccessInterface, communityId: string, categoryId: string, chatId: string, position: int) {.base} = raise newException(ValueError, "No implementation available") -method banUserFromCommunity*(self: AccessInterface, pubKey: string, communityId: string) {.base.} = - raise newException(ValueError, "No implementation available") - method isUserMemberOfCommunity*(self: AccessInterface, communityId: string): bool {.base.} = raise newException(ValueError, "No implementation available") diff --git a/src/app/modules/main/communities/module.nim b/src/app/modules/main/communities/module.nim index 58f62589a5..0aca22866d 100644 --- a/src/app/modules/main/communities/module.nim +++ b/src/app/modules/main/communities/module.nim @@ -157,9 +157,6 @@ method reorderCommunityCategories*(self: Module, communityId: string, categoryId # self.controller.reorderCommunityCategories(communityId, categoryId, position) discard -method banUserFromCommunity*(self: Module, pubKey: string, communityId: string) = - self.controller.banUserFromCommunity(communityId, pubkey) - method requestToJoinCommunity*(self: Module, communityId: string, ensName: string) = self.controller.requestToJoinCommunity(communityId, ensName) diff --git a/src/app/modules/main/communities/view.nim b/src/app/modules/main/communities/view.nim index 9ac9cf6f37..1510a0d598 100644 --- a/src/app/modules/main/communities/view.nim +++ b/src/app/modules/main/communities/view.nim @@ -80,9 +80,6 @@ QtObject: proc reorderCommunityChannel*(self: View, communityId: string, categoryId: string, chatId: string, position: int): string {.slot} = self.delegate.reorderCommunityChannel(communityId, categoryId, chatId, position) - proc banUserFromCommunity*(self: View, pubKey: string, communityId: string) {.slot.} = - self.delegate.banUserFromCommunity(communityId, pubKey) - proc requestToJoinCommunity*(self: View, communityId: string, ensName: string) {.slot.} = self.delegate.requestToJoinCommunity(communityId, ensName) diff --git a/ui/app/AppLayouts/Chat/panels/communities/CommunityProfilePopupMembersListPanel.qml b/ui/app/AppLayouts/Chat/panels/communities/CommunityProfilePopupMembersListPanel.qml index 8fe2346109..41a838a51a 100644 --- a/ui/app/AppLayouts/Chat/panels/communities/CommunityProfilePopupMembersListPanel.qml +++ b/ui/app/AppLayouts/Chat/panels/communities/CommunityProfilePopupMembersListPanel.qml @@ -192,8 +192,7 @@ Item { icon.name: "cancel" type: StatusMenuItem.Type.Danger enabled: root.community.amISectionAdmin - // Not Refactored Yet -// onTriggered: chatsModel.communities.banUserFromCommunity(model.pubKey, root.community.id) + onTriggered: root.store.banUserFromCommunity(model.id) } } } diff --git a/ui/app/AppLayouts/Chat/stores/RootStore.qml b/ui/app/AppLayouts/Chat/stores/RootStore.qml index c5fc731af1..942335ecab 100644 --- a/ui/app/AppLayouts/Chat/stores/RootStore.qml +++ b/ui/app/AppLayouts/Chat/stores/RootStore.qml @@ -238,6 +238,10 @@ QtObject { chatCommunitySectionModule.removeUserFromCommunity(pubKey); } + function banUserFromCommunity(pubKey) { + chatCommunitySectionModule.banUserFromCommunity(pubKey); + } + function createCommunityChannel(channelName, channelDescription, channelEmoji, channelColor, categoryId) { chatCommunitySectionModule.createCommunityChannel(channelName, channelDescription, diff --git a/ui/app/AppLayouts/Chat/views/CommunitySettingsView.qml b/ui/app/AppLayouts/Chat/views/CommunitySettingsView.qml index 24e552d693..d7c09cd7eb 100644 --- a/ui/app/AppLayouts/Chat/views/CommunitySettingsView.qml +++ b/ui/app/AppLayouts/Chat/views/CommunitySettingsView.qml @@ -143,7 +143,7 @@ StatusAppTwoPanelLayout { onUserProfileClicked: Global.openProfilePopup(id) onKickUserClicked: root.rootStore.removeUserFromCommunity(id) - onBanUserClicked: console.debug("NOT IMPLEMENTED") // TODO: implement me + onBanUserClicked: root.rootStore.banUserFromCommunity(id) onMembershipRequestsClicked: Global.openPopup(membershipRequestPopup, { communitySectionModule: root.chatCommunitySectionModule })