fix(community): re-hook banning users

Fixes #5383
This commit is contained in:
Jonathan Rainville 2022-04-07 10:49:38 -04:00 committed by Iuri Matias
parent 0a7201b3bf
commit 8763238369
11 changed files with 18 additions and 15 deletions

View File

@ -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,

View File

@ -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")

View File

@ -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,

View File

@ -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)

View File

@ -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)

View File

@ -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")

View File

@ -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)

View File

@ -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)

View File

@ -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)
}
}
}

View File

@ -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,

View File

@ -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
})