parent
6c5594b576
commit
a51aee1683
|
@ -93,6 +93,11 @@ method init*(self: Controller) =
|
|||
if (args.communityId == self.sectionId):
|
||||
self.delegate.onChatMembersAdded(@[args.pubKey])
|
||||
|
||||
self.events.on(SIGNAL_COMMUNITY_MEMBER_REMOVED) do(e: Args):
|
||||
let args = CommunityMemberArgs(e)
|
||||
if (args.communityId == self.sectionId):
|
||||
self.delegate.onChatMemberRemoved(args.pubKey)
|
||||
|
||||
method getChat*(self: Controller): ChatDto =
|
||||
return self.chatService.getChatById(self.chatId)
|
||||
|
||||
|
|
|
@ -347,6 +347,9 @@ method deleteCommunityCategory*(self: Controller, categoryId: string) =
|
|||
method leaveCommunity*(self: Controller) =
|
||||
self.communityService.leaveCommunity(self.sectionId)
|
||||
|
||||
method removeUserFromCommunity*(self: Controller, pubKey: string) =
|
||||
self.communityService.removeUserFromCommunity(self.sectionId, pubKey)
|
||||
|
||||
method editCommunity*(
|
||||
self: Controller,
|
||||
name: string,
|
||||
|
|
|
@ -137,6 +137,9 @@ method deleteCommunityCategory*(self: AccessInterface, categoryId: string) {.bas
|
|||
method leaveCommunity*(self: AccessInterface) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method removeUserFromCommunity*(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, imageUrl: string, aX: int, aY: int, bX: int, bY: int) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
|
|
|
@ -703,6 +703,9 @@ method deleteCommunityCategory*(self: Module, categoryId: string) =
|
|||
method leaveCommunity*(self: Module) =
|
||||
self.controller.leaveCommunity()
|
||||
|
||||
method removeUserFromCommunity*(self: Module, pubKey: string) =
|
||||
self.controller.removeUserFromCommunity(pubKey)
|
||||
|
||||
method editCommunity*(self: Module, name: string, description: string,
|
||||
access: int, ensOnly: bool, color: string,
|
||||
imagePath: string,
|
||||
|
|
|
@ -103,6 +103,9 @@ method editCommunityChannel*(self: AccessInterface, channelId, name, description
|
|||
method leaveCommunity*(self: AccessInterface) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method removeUserFromCommunity*(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")
|
||||
|
||||
|
|
|
@ -229,6 +229,9 @@ QtObject:
|
|||
|
||||
proc leaveCommunity*(self: View) {.slot.} =
|
||||
self.delegate.leaveCommunity()
|
||||
|
||||
proc removeUserFromCommunity*(self: View, pubKey: string) {.slot.} =
|
||||
self.delegate.removeUserFromCommunity(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)
|
||||
|
|
|
@ -113,9 +113,6 @@ method requestCommunityInfo*(self: Controller, communityId: string) =
|
|||
method importCommunity*(self: Controller, communityKey: string) =
|
||||
self.communityService.importCommunity(communityKey)
|
||||
|
||||
method removeUserFromCommunity*(self: Controller, communityId: string, pubKeys: string) =
|
||||
self.communityService.removeUserFromCommunity(communityId, pubKeys)
|
||||
|
||||
method banUserFromCommunity*(self: Controller, communityId: string, pubKey: string) =
|
||||
self.communityService.removeUserFromCommunity(communityId, pubKey)
|
||||
|
||||
|
|
|
@ -50,9 +50,6 @@ method isCommunityRequestPending*(self: AccessInterface, communityId: string): b
|
|||
method importCommunity*(self: AccessInterface, communityKey: string) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method removeUserFromCommunity*(self: AccessInterface, communityId: string, pubKeys: string) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method banUserFromCommunity*(self: AccessInterface, communityId: string, pubKey: string) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
|
|
|
@ -157,13 +157,6 @@ method reorderCommunityCategories*(self: Module, communityId: string, categoryId
|
|||
# self.controller.reorderCommunityCategories(communityId, categoryId, position)
|
||||
discard
|
||||
|
||||
method removeUserFromCommunity*(self: Module, communityId: string, categoryId: string, chatId: string, position: int) =
|
||||
# self.controller.reorderCommunityChannel(communityId, categoryId, chatId, position)
|
||||
discard
|
||||
|
||||
method removeUserFromCommunity*(self: Module, communityId: string, pubKey: string) =
|
||||
self.controller.removeUserFromCommunity(communityId, pubKey)
|
||||
|
||||
method banUserFromCommunity*(self: Module, pubKey: string, communityId: string) =
|
||||
self.controller.banUserFromCommunity(communityId, pubkey)
|
||||
|
||||
|
|
|
@ -31,9 +31,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 removeUserFromCommunity*(self: AccessInterface, communityId: string, pubKey: string) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method banUserFromCommunity*(self: AccessInterface, pubKey: string, communityId: string) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
|
|
|
@ -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 removeUserFromCommunity*(self: View, communityId: string, pubKey: string) {.slot.} =
|
||||
self.delegate.removeUserFromCommunity(communityId, pubKey)
|
||||
|
||||
proc banUserFromCommunity*(self: View, pubKey: string, communityId: string) {.slot.} =
|
||||
self.delegate.banUserFromCommunity(communityId, pubKey)
|
||||
|
||||
|
|
|
@ -15,8 +15,13 @@ QtObject:
|
|||
new(result, delete)
|
||||
result.setup
|
||||
|
||||
proc membersChanged*(self: ActiveSection) {.signal.}
|
||||
proc pendingRequestsToJoinChanged*(self: ActiveSection) {.signal.}
|
||||
|
||||
proc setActiveSectionData*(self: ActiveSection, item: SectionItem) =
|
||||
self.item = item
|
||||
self.membersChanged()
|
||||
self.pendingRequestsToJoinChanged()
|
||||
|
||||
proc getId*(self: ActiveSection): string {.slot.} =
|
||||
return self.item.id
|
||||
|
@ -128,6 +133,7 @@ QtObject:
|
|||
|
||||
QtProperty[QVariant] members:
|
||||
read = members
|
||||
notify = membersChanged
|
||||
|
||||
proc hasMember(self: ActiveSection, pubkey: string): bool {.slot.} =
|
||||
return self.item.hasMember(pubkey)
|
||||
|
@ -151,3 +157,4 @@ QtObject:
|
|||
|
||||
QtProperty[QVariant] pendingRequestsToJoin:
|
||||
read = pendingRequestsToJoin
|
||||
notify = pendingRequestsToJoinChanged
|
||||
|
|
|
@ -81,6 +81,7 @@ const SIGNAL_COMMUNITY_CATEGORY_NAME_EDITED* = "communityCategoryNameEdited"
|
|||
const SIGNAL_COMMUNITY_CATEGORY_DELETED* = "communityCategoryDeleted"
|
||||
const SIGNAL_COMMUNITY_CATEGORY_REORDERED* = "communityCategoryReordered"
|
||||
const SIGNAL_COMMUNITY_MEMBER_APPROVED* = "communityMemberApproved"
|
||||
const SIGNAL_COMMUNITY_MEMBER_REMOVED* = "communityMemberRemoved"
|
||||
const SIGNAL_NEW_REQUEST_TO_JOIN_COMMUNITY* = "newRequestToJoinCommunity"
|
||||
|
||||
QtObject:
|
||||
|
@ -927,9 +928,12 @@ QtObject:
|
|||
error "Error inviting to community", msg = e.msg
|
||||
result = "Error exporting community: " & e.msg
|
||||
|
||||
proc removeUserFromCommunity*(self: Service, communityId: string, pubKeys: string) =
|
||||
proc removeUserFromCommunity*(self: Service, communityId: string, pubKey: string) =
|
||||
try:
|
||||
discard status_go.removeUserFromCommunity(communityId, pubKeys)
|
||||
discard status_go.removeUserFromCommunity(communityId, pubKey)
|
||||
|
||||
self.events.emit(SIGNAL_COMMUNITY_MEMBER_REMOVED,
|
||||
CommunityMemberArgs(communityId: communityId, pubKey: pubKey))
|
||||
except Exception as e:
|
||||
error "Error removing user from community", msg = e.msg
|
||||
|
||||
|
|
|
@ -184,8 +184,7 @@ Item {
|
|||
iconRotation: 180
|
||||
type: StatusMenuItem.Type.Danger
|
||||
enabled: root.community.amISectionAdmin
|
||||
// Not Refactored Yet
|
||||
// onTriggered: chatsModel.communities.removeUserFromCommunity(model.pubKey)
|
||||
onTriggered: root.store.removeUserFromCommunity(model.id)
|
||||
}
|
||||
|
||||
StatusMenuItem {
|
||||
|
|
|
@ -174,6 +174,10 @@ QtObject {
|
|||
chatCommunitySectionModule.leaveCommunity();
|
||||
}
|
||||
|
||||
function removeUserFromCommunity(pubKey) {
|
||||
chatCommunitySectionModule.removeUserFromCommunity(pubKey);
|
||||
}
|
||||
|
||||
function createCommunityChannel(channelName, channelDescription, categoryId) {
|
||||
chatCommunitySectionModule.createCommunityChannel(channelName, channelDescription, categoryId);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue