refactor(community): move membership functions to chat_section
Fixes #4473 and #4485
This commit is contained in:
parent
3e339ea094
commit
e1deafa76b
|
@ -260,3 +260,18 @@ method joinGroupChatFromInvitation*(self: Controller, groupName: string, chatId:
|
||||||
if(response.success):
|
if(response.success):
|
||||||
self.delegate.addNewChat(response.chatDto, false, self.events, self.settingsService, self.contactService, self.chatService,
|
self.delegate.addNewChat(response.chatDto, false, self.events, self.settingsService, self.contactService, self.chatService,
|
||||||
self.communityService, self.messageService, self.gifService)
|
self.communityService, self.messageService, self.gifService)
|
||||||
|
|
||||||
|
method acceptRequestToJoinCommunity*(self: Controller, requestId: string) =
|
||||||
|
self.communityService.acceptRequestToJoinCommunity(self.sectionId, requestId)
|
||||||
|
|
||||||
|
method declineRequestToJoinCommunity*(self: Controller, requestId: string) =
|
||||||
|
self.communityService.declineRequestToJoinCommunity(self.sectionId, requestId)
|
||||||
|
|
||||||
|
method createCommunityChannel*(
|
||||||
|
self: Controller,
|
||||||
|
name: string,
|
||||||
|
description: string) =
|
||||||
|
self.communityService.createCommunityChannel(self.sectionId, name, description)
|
||||||
|
|
||||||
|
method leaveCommunity*(self: Controller) =
|
||||||
|
self.communityService.leaveCommunity(self.sectionId)
|
|
@ -115,3 +115,16 @@ method joinGroup*(self: AccessInterface) {.base.} =
|
||||||
|
|
||||||
method joinGroupChatFromInvitation*(self: AccessInterface, groupName: string, chatId: string, adminPK: string) {.base.} =
|
method joinGroupChatFromInvitation*(self: AccessInterface, groupName: string, chatId: string, adminPK: string) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
|
|
||||||
|
method acceptRequestToJoinCommunity*(self: AccessInterface, requestId: string) {.base.} =
|
||||||
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
|
method declineRequestToJoinCommunity*(self: AccessInterface, requestId: string) {.base.} =
|
||||||
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
|
method createCommunityChannel*(self: AccessInterface, name: string, description: string) {.base.} =
|
||||||
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
|
method leaveCommunity*(self: AccessInterface) {.base.} =
|
||||||
|
raise newException(ValueError, "No implementation available")
|
|
@ -511,3 +511,15 @@ method onChatRenamed*(self: Module, chatId: string, newName: string) =
|
||||||
|
|
||||||
method reorderChannels*(self: Module, chatId, categoryId: string, position: int) =
|
method reorderChannels*(self: Module, chatId, categoryId: string, position: int) =
|
||||||
self.view.chatsModel().reorder(chatId, categoryId, position)
|
self.view.chatsModel().reorder(chatId, categoryId, position)
|
||||||
|
|
||||||
|
method acceptRequestToJoinCommunity*(self: Module, requestId: string) =
|
||||||
|
self.controller.acceptRequestToJoinCommunity(requestId)
|
||||||
|
|
||||||
|
method declineRequestToJoinCommunity*(self: Module, requestId: string) =
|
||||||
|
self.controller.declineRequestToJoinCommunity(requestId)
|
||||||
|
|
||||||
|
method createCommunityChannel*(self: Module, name, description: string,) =
|
||||||
|
self.controller.createCommunityChannel(name, description)
|
||||||
|
|
||||||
|
method leaveCommunity*(self: Module) =
|
||||||
|
self.controller.leaveCommunity()
|
|
@ -83,3 +83,16 @@ method initListOfMyContacts*(self: AccessInterface) {.base.} =
|
||||||
|
|
||||||
method clearListOfMyContacts*(self: AccessInterface) {.base.} =
|
method clearListOfMyContacts*(self: AccessInterface) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
|
|
||||||
|
method acceptRequestToJoinCommunity*(self: AccessInterface, requestId: string) {.base.} =
|
||||||
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
|
method declineRequestToJoinCommunity*(self: AccessInterface, requestId: string) {.base.} =
|
||||||
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
|
method createCommunityChannel*(self: AccessInterface, name: string, description: string) {.base.} =
|
||||||
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
|
method leaveCommunity*(self: AccessInterface) {.base.} =
|
||||||
|
raise newException(ValueError, "No implementation available")
|
|
@ -180,3 +180,16 @@ QtObject:
|
||||||
|
|
||||||
proc joinGroupChatFromInvitation*(self: View, groupName: string, chatId: string, adminPK: string) {.slot.} =
|
proc joinGroupChatFromInvitation*(self: View, groupName: string, chatId: string, adminPK: string) {.slot.} =
|
||||||
self.delegate.joinGroupChatFromInvitation(groupName, chatId, adminPK)
|
self.delegate.joinGroupChatFromInvitation(groupName, chatId, adminPK)
|
||||||
|
|
||||||
|
|
||||||
|
proc acceptRequestToJoinCommunity*(self: View, requestId: string) {.slot.} =
|
||||||
|
self.delegate.acceptRequestToJoinCommunity(requestId)
|
||||||
|
|
||||||
|
proc declineRequestToJoinCommunity*(self: View, requestId: string) {.slot.} =
|
||||||
|
self.delegate.declineRequestToJoinCommunity(requestId)
|
||||||
|
|
||||||
|
proc createCommunityChannel*(self: View, name: string, description: string) {.slot.} =
|
||||||
|
self.delegate.createCommunityChannel(name, description)
|
||||||
|
|
||||||
|
proc leaveCommunity*(self: View) {.slot.} =
|
||||||
|
self.delegate.leaveCommunity()
|
|
@ -69,9 +69,6 @@ method joinCommunity*(self: Controller, communityId: string): string =
|
||||||
method requestToJoinCommunity*(self: Controller, communityId: string, ensName: string) =
|
method requestToJoinCommunity*(self: Controller, communityId: string, ensName: string) =
|
||||||
self.communityService.requestToJoinCommunity(communityId, ensName)
|
self.communityService.requestToJoinCommunity(communityId, ensName)
|
||||||
|
|
||||||
method leaveCommunity*(self: Controller, communityId: string) =
|
|
||||||
self.communityService.leaveCommunity(communityId)
|
|
||||||
|
|
||||||
method createCommunity*(
|
method createCommunity*(
|
||||||
self: Controller,
|
self: Controller,
|
||||||
name: string,
|
name: string,
|
||||||
|
@ -110,13 +107,6 @@ method editCommunity*(
|
||||||
imageUrl,
|
imageUrl,
|
||||||
aX, aY, bX, bY)
|
aX, aY, bX, bY)
|
||||||
|
|
||||||
method createCommunityChannel*(
|
|
||||||
self: Controller,
|
|
||||||
communityId: string,
|
|
||||||
name: string,
|
|
||||||
description: string) =
|
|
||||||
self.communityService.createCommunityChannel(communityId, name, description)
|
|
||||||
|
|
||||||
method editCommunityChannel*(
|
method editCommunityChannel*(
|
||||||
self: Controller,
|
self: Controller,
|
||||||
communityId: string,
|
communityId: string,
|
||||||
|
@ -181,12 +171,6 @@ method importCommunity*(self: Controller, communityKey: string) =
|
||||||
method exportCommunity*(self: Controller, communityId: string): string =
|
method exportCommunity*(self: Controller, communityId: string): string =
|
||||||
self.communityService.exportCommunity(communityId)
|
self.communityService.exportCommunity(communityId)
|
||||||
|
|
||||||
method acceptRequestToJoinCommunity*(self: Controller, communityId: string, requestId: string) =
|
|
||||||
self.communityService.acceptRequestToJoinCommunity(communityId, requestId)
|
|
||||||
|
|
||||||
method declineRequestToJoinCommunity*(self: Controller, communityId: string, requestId: string) =
|
|
||||||
self.communityService.declineRequestToJoinCommunity(communityId, requestId)
|
|
||||||
|
|
||||||
method inviteUsersToCommunityById*(self: Controller, communityId: string, pubKeys: string): string =
|
method inviteUsersToCommunityById*(self: Controller, communityId: string, pubKeys: string): string =
|
||||||
result = self.communityService.inviteUsersToCommunityById(communityId, pubKeys)
|
result = self.communityService.inviteUsersToCommunityById(communityId, pubKeys)
|
||||||
|
|
||||||
|
|
|
@ -16,18 +16,12 @@ method joinCommunity*(self: AccessInterface, communityId: string): string {.base
|
||||||
method requestToJoinCommunity*(self: AccessInterface, communityId: string, ensName: string) {.base.} =
|
method requestToJoinCommunity*(self: AccessInterface, communityId: string, ensName: string) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method leaveCommunity*(self: AccessInterface, communityId: string) {.base.} =
|
|
||||||
raise newException(ValueError, "No implementation available")
|
|
||||||
|
|
||||||
method createCommunity*(self: AccessInterface, name: string, description: string, access: int, ensOnly: bool, color: string, imageUrl: string, aX: int, aY: int, bX: int, bY: int) {.base.} =
|
method createCommunity*(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")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method editCommunity*(self: AccessInterface, id: string, name: string, description: string, access: int, ensOnly: bool, color: string, imageUrl: string, aX: int, aY: int, bX: int, bY: int) {.base.} =
|
method editCommunity*(self: AccessInterface, id: string, 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")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method createCommunityChannel*(self: AccessInterface, communityId: string, name: string, description: string) {.base.} =
|
|
||||||
raise newException(ValueError, "No implementation available")
|
|
||||||
|
|
||||||
method editCommunityChannel*(self: AccessInterface, communityId: string, chatId: string, name: string, description: string, categoryId: string, position: int) {.base.} =
|
method editCommunityChannel*(self: AccessInterface, communityId: string, chatId: string, name: string, description: string, categoryId: string, position: int) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
|
@ -55,12 +49,6 @@ method importCommunity*(self: AccessInterface, communityKey: string) {.base.} =
|
||||||
method exportCommunity*(self: AccessInterface, communityId: string): string {.base.} =
|
method exportCommunity*(self: AccessInterface, communityId: string): string {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method acceptRequestToJoinCommunity*(self: AccessInterface, communityId: string, requestId: string) {.base.} =
|
|
||||||
raise newException(ValueError, "No implementation available")
|
|
||||||
|
|
||||||
method declineRequestToJoinCommunity*(self: AccessInterface, communityId: string, requestId: string) {.base.} =
|
|
||||||
raise newException(ValueError, "No implementation available")
|
|
||||||
|
|
||||||
method inviteUsersToCommunityById*(self: AccessInterface, communityId: string, pubKeys: string): string {.base.} =
|
method inviteUsersToCommunityById*(self: AccessInterface, communityId: string, pubKeys: string): string {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
|
|
|
@ -135,9 +135,6 @@ method editCommunity*(self: Module, id: string, name: string, description: strin
|
||||||
aX: int, aY: int, bX: int, bY: int) =
|
aX: int, aY: int, bX: int, bY: int) =
|
||||||
self.controller.editCommunity(id, name, description, access, ensOnly, color, imagePath, aX, aY, bX, bY)
|
self.controller.editCommunity(id, name, description, access, ensOnly, color, imagePath, aX, aY, bX, bY)
|
||||||
|
|
||||||
method createCommunityChannel*(self: Module, communityId, name, description: string,) =
|
|
||||||
self.controller.createCommunityChannel(communityId, name, description)
|
|
||||||
|
|
||||||
method createCommunityCategory*(self: Module, communityId: string, name: string, channels: string) =
|
method createCommunityCategory*(self: Module, communityId: string, name: string, channels: string) =
|
||||||
let channelsSeq = map(parseJson(channels).getElems(), proc(x:JsonNode):string = x.getStr())
|
let channelsSeq = map(parseJson(channels).getElems(), proc(x:JsonNode):string = x.getStr())
|
||||||
self.controller.createCommunityCategory(communityId, name, channelsSeq)
|
self.controller.createCommunityCategory(communityId, name, channelsSeq)
|
||||||
|
@ -157,9 +154,6 @@ method removeUserFromCommunity*(self: Module, communityId: string, categoryId: s
|
||||||
# self.controller.reorderCommunityChannel(communityId, categoryId, chatId, position)
|
# self.controller.reorderCommunityChannel(communityId, categoryId, chatId, position)
|
||||||
discard
|
discard
|
||||||
|
|
||||||
method leaveCommunity*(self: Module, communityId: string) =
|
|
||||||
self.controller.leaveCommunity(communityId)
|
|
||||||
|
|
||||||
method inviteUsersToCommunityById*(self: Module, communityId: string, pubKeysJSON: string): string =
|
method inviteUsersToCommunityById*(self: Module, communityId: string, pubKeysJSON: string): string =
|
||||||
result = self.controller.inviteUsersToCommunityById(communityId, pubKeysJSON)
|
result = self.controller.inviteUsersToCommunityById(communityId, pubKeysJSON)
|
||||||
|
|
||||||
|
@ -172,12 +166,6 @@ method banUserFromCommunity*(self: Module, pubKey: string, communityId: string)
|
||||||
method requestToJoinCommunity*(self: Module, communityId: string, ensName: string) =
|
method requestToJoinCommunity*(self: Module, communityId: string, ensName: string) =
|
||||||
self.controller.requestToJoinCommunity(communityId, ensName)
|
self.controller.requestToJoinCommunity(communityId, ensName)
|
||||||
|
|
||||||
method acceptRequestToJoinCommunity*(self: Module, communityId: string, requestId: string) =
|
|
||||||
self.controller.acceptRequestToJoinCommunity(communityId, requestId)
|
|
||||||
|
|
||||||
method declineRequestToJoinCommunity*(self: Module, communityId: string, requestId: string) =
|
|
||||||
self.controller.declineRequestToJoinCommunity(communityId, requestId)
|
|
||||||
|
|
||||||
method requestCommunityInfo*(self: Module, communityId: string) =
|
method requestCommunityInfo*(self: Module, communityId: string) =
|
||||||
self.controller.requestCommunityInfo(communityId)
|
self.controller.requestCommunityInfo(communityId)
|
||||||
|
|
||||||
|
|
|
@ -31,9 +31,6 @@ method editCommunity*(self: AccessInterface, id: string, name: string, descripti
|
||||||
method createCommunityCategory*(self: AccessInterface, communityId: string, name: string, channels: string) {.base.} =
|
method createCommunityCategory*(self: AccessInterface, communityId: string, name: string, channels: string) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method createCommunityChannel*(self: AccessInterface, communityId: string, name: string, description: string) {.base.} =
|
|
||||||
raise newException(ValueError, "No implementation available")
|
|
||||||
|
|
||||||
method editCommunityCategory*(self: AccessInterface, communityId: string, categoryId: string, name: string, channels: string) {.base.} =
|
method editCommunityCategory*(self: AccessInterface, communityId: string, categoryId: string, name: string, channels: string) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
|
@ -46,9 +43,6 @@ method reorderCommunityCategories*(self: AccessInterface, communityId: string, c
|
||||||
method reorderCommunityChannel*(self: AccessInterface, communityId: string, categoryId: string, chatId: string, position: int) {.base} =
|
method reorderCommunityChannel*(self: AccessInterface, communityId: string, categoryId: string, chatId: string, position: int) {.base} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method leaveCommunity*(self: AccessInterface, communityId: string) {.base.} =
|
|
||||||
raise newException(ValueError, "No implementation available")
|
|
||||||
|
|
||||||
method inviteUsersToCommunityById*(self: AccessInterface, communityId: string, pubKeysJSON: string): string {.base.} =
|
method inviteUsersToCommunityById*(self: AccessInterface, communityId: string, pubKeysJSON: string): string {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
|
@ -61,12 +55,6 @@ method banUserFromCommunity*(self: AccessInterface, pubKey: string, communityId:
|
||||||
method requestToJoinCommunity*(self: AccessInterface, communityId: string, ensName: string) {.base.} =
|
method requestToJoinCommunity*(self: AccessInterface, communityId: string, ensName: string) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method acceptRequestToJoinCommunity*(self: AccessInterface, communityId: string, requestId: string) {.base.} =
|
|
||||||
raise newException(ValueError, "No implementation available")
|
|
||||||
|
|
||||||
method declineRequestToJoinCommunity*(self: AccessInterface, communityId: string, requestId: string) {.base.} =
|
|
||||||
raise newException(ValueError, "No implementation available")
|
|
||||||
|
|
||||||
method requestCommunityInfo*(self: AccessInterface, communityId: string) {.base.} =
|
method requestCommunityInfo*(self: AccessInterface, communityId: string) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
|
|
|
@ -70,9 +70,6 @@ QtObject:
|
||||||
proc editCommunity*(self: View, id: string, name: string, description: string, access: int, ensOnly: bool, color: string, imagePath: string, aX: int, aY: int, bX: int, bY: int) {.slot.} =
|
proc editCommunity*(self: View, id: string, name: string, description: string, access: int, ensOnly: bool, color: string, imagePath: string, aX: int, aY: int, bX: int, bY: int) {.slot.} =
|
||||||
self.delegate.editCommunity(id, name, description, access, ensOnly, color, imagePath, aX, aY, bX, bY)
|
self.delegate.editCommunity(id, name, description, access, ensOnly, color, imagePath, aX, aY, bX, bY)
|
||||||
|
|
||||||
proc createCommunityChannel*(self: View, communityId: string, name: string, description: string) {.slot.} =
|
|
||||||
self.delegate.createCommunityChannel(communityId, name, description)
|
|
||||||
|
|
||||||
proc createCommunityCategory*(self: View, communityId: string, name: string, channels: string) {.slot.} =
|
proc createCommunityCategory*(self: View, communityId: string, name: string, channels: string) {.slot.} =
|
||||||
self.delegate.createCommunityCategory(communityId, name, channels)
|
self.delegate.createCommunityCategory(communityId, name, channels)
|
||||||
|
|
||||||
|
@ -88,9 +85,6 @@ QtObject:
|
||||||
proc reorderCommunityChannel*(self: View, communityId: string, categoryId: string, chatId: string, position: int): string {.slot} =
|
proc reorderCommunityChannel*(self: View, communityId: string, categoryId: string, chatId: string, position: int): string {.slot} =
|
||||||
self.delegate.reorderCommunityChannel(communityId, categoryId, chatId, position)
|
self.delegate.reorderCommunityChannel(communityId, categoryId, chatId, position)
|
||||||
|
|
||||||
proc leaveCommunity*(self: View, communityId: string) {.slot.} =
|
|
||||||
self.delegate.leaveCommunity(communityId)
|
|
||||||
|
|
||||||
proc inviteUsersToCommunityById*(self: View, communityId: string, pubKeysJSON: string): string {.slot.} =
|
proc inviteUsersToCommunityById*(self: View, communityId: string, pubKeysJSON: string): string {.slot.} =
|
||||||
result = self.delegate.inviteUsersToCommunityById(communityId, pubKeysJSON)
|
result = self.delegate.inviteUsersToCommunityById(communityId, pubKeysJSON)
|
||||||
|
|
||||||
|
@ -103,12 +97,6 @@ QtObject:
|
||||||
proc requestToJoinCommunity*(self: View, communityId: string, ensName: string) {.slot.} =
|
proc requestToJoinCommunity*(self: View, communityId: string, ensName: string) {.slot.} =
|
||||||
self.delegate.requestToJoinCommunity(communityId, ensName)
|
self.delegate.requestToJoinCommunity(communityId, ensName)
|
||||||
|
|
||||||
proc acceptRequestToJoinCommunity*(self: View, communityId: string, requestId: string) {.slot.} =
|
|
||||||
self.delegate.acceptRequestToJoinCommunity(communityId, requestId)
|
|
||||||
|
|
||||||
proc declineRequestToJoinCommunity*(self: View, communityId: string, requestId: string) {.slot.} =
|
|
||||||
self.delegate.declineRequestToJoinCommunity(communityId, requestId)
|
|
||||||
|
|
||||||
proc requestCommunityInfo*(self: View, communityId: string) {.slot.} =
|
proc requestCommunityInfo*(self: View, communityId: string) {.slot.} =
|
||||||
self.delegate.requestCommunityInfo(communityId)
|
self.delegate.requestCommunityInfo(communityId)
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,13 @@ type
|
||||||
Enabled
|
Enabled
|
||||||
Joined
|
Joined
|
||||||
IsMember
|
IsMember
|
||||||
|
CanJoin
|
||||||
|
CanManageUsers
|
||||||
|
CanRequestAccess
|
||||||
|
Access
|
||||||
|
EnsOnly
|
||||||
|
MembersModel
|
||||||
|
PendingRequestsToJoinModel
|
||||||
|
|
||||||
QtObject:
|
QtObject:
|
||||||
type
|
type
|
||||||
|
@ -68,7 +75,14 @@ QtObject:
|
||||||
ModelRole.Active.int:"active",
|
ModelRole.Active.int:"active",
|
||||||
ModelRole.Enabled.int:"enabled",
|
ModelRole.Enabled.int:"enabled",
|
||||||
ModelRole.Joined.int:"joined",
|
ModelRole.Joined.int:"joined",
|
||||||
ModelRole.IsMember.int:"isMember"
|
ModelRole.IsMember.int:"isMember",
|
||||||
|
ModelRole.CanJoin.int:"canJoin",
|
||||||
|
ModelRole.CanManageUsers.int:"canManageUsers",
|
||||||
|
ModelRole.CanRequestAccess.int:"canRequestAccess",
|
||||||
|
ModelRole.Access.int:"access",
|
||||||
|
ModelRole.EnsOnly.int:"ensOnly",
|
||||||
|
ModelRole.MembersModel.int:"members",
|
||||||
|
ModelRole.PendingRequestsToJoinModel.int:"pendingRequestsToJoin",
|
||||||
}.toTable
|
}.toTable
|
||||||
|
|
||||||
method data(self: SectionModel, index: QModelIndex, role: int): QVariant =
|
method data(self: SectionModel, index: QModelIndex, role: int): QVariant =
|
||||||
|
@ -110,6 +124,20 @@ QtObject:
|
||||||
result = newQVariant(item.joined)
|
result = newQVariant(item.joined)
|
||||||
of ModelRole.IsMember:
|
of ModelRole.IsMember:
|
||||||
result = newQVariant(item.isMember)
|
result = newQVariant(item.isMember)
|
||||||
|
of ModelRole.CanJoin:
|
||||||
|
result = newQVariant(item.canJoin)
|
||||||
|
of ModelRole.CanManageUsers:
|
||||||
|
result = newQVariant(item.canManageUsers)
|
||||||
|
of ModelRole.CanRequestAccess:
|
||||||
|
result = newQVariant(item.canRequestAccess)
|
||||||
|
of ModelRole.Access:
|
||||||
|
result = newQVariant(item.access)
|
||||||
|
of ModelRole.EnsOnly:
|
||||||
|
result = newQVariant(item.ensOnly)
|
||||||
|
of ModelRole.MembersModel:
|
||||||
|
result = newQVariant(item.members)
|
||||||
|
of ModelRole.PendingRequestsToJoinModel:
|
||||||
|
result = newQVariant(item.pendingRequestsToJoin)
|
||||||
|
|
||||||
proc addItem*(self: SectionModel, item: SectionItem) =
|
proc addItem*(self: SectionModel, item: SectionItem) =
|
||||||
let parentModelIndex = newQModelIndex()
|
let parentModelIndex = newQModelIndex()
|
||||||
|
@ -155,7 +183,14 @@ QtObject:
|
||||||
ModelRole.Description.int,
|
ModelRole.Description.int,
|
||||||
ModelRole.Image.int,
|
ModelRole.Image.int,
|
||||||
ModelRole.Icon.int,
|
ModelRole.Icon.int,
|
||||||
ModelRole.Color.int
|
ModelRole.Color.int,
|
||||||
|
ModelRole.HasNotification.int,
|
||||||
|
ModelRole.NotificationsCount.int,
|
||||||
|
ModelRole.IsMember.int,
|
||||||
|
ModelRole.CanJoin.int,
|
||||||
|
ModelRole.Joined.int,
|
||||||
|
ModelRole.MembersModel.int,
|
||||||
|
ModelRole.PendingRequestsToJoinModel.int
|
||||||
])
|
])
|
||||||
|
|
||||||
proc getItemById*(self: SectionModel, id: string): SectionItem =
|
proc getItemById*(self: SectionModel, id: string): SectionItem =
|
||||||
|
|
|
@ -26,6 +26,7 @@ Item {
|
||||||
property alias members: memberList.model
|
property alias members: memberList.model
|
||||||
property var community
|
property var community
|
||||||
property var store
|
property var store
|
||||||
|
property var communitySectionModule
|
||||||
|
|
||||||
signal inviteButtonClicked()
|
signal inviteButtonClicked()
|
||||||
|
|
||||||
|
@ -41,7 +42,7 @@ Item {
|
||||||
StatusListItem {
|
StatusListItem {
|
||||||
id: inviteButton
|
id: inviteButton
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
visible: !!(root.community.admin || root.community.isAdmin)
|
visible: root.community.amISectionAdmin
|
||||||
//% "Invite People"
|
//% "Invite People"
|
||||||
title: qsTrId("invite-people")
|
title: qsTrId("invite-people")
|
||||||
icon.name: "share-ios"
|
icon.name: "share-ios"
|
||||||
|
@ -67,7 +68,9 @@ Item {
|
||||||
//% "Membership requests"
|
//% "Membership requests"
|
||||||
title: qsTrId("membership-requests")
|
title: qsTrId("membership-requests")
|
||||||
requestsCount: nbRequests
|
requestsCount: nbRequests
|
||||||
sensor.onClicked: Global.openPopup(membershipRequestPopup)
|
sensor.onClicked: Global.openPopup(membershipRequestPopup, {
|
||||||
|
communitySectionModule: root.communitySectionModule
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusModalDivider {
|
StatusModalDivider {
|
||||||
|
@ -179,7 +182,7 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusMenuSeparator {
|
StatusMenuSeparator {
|
||||||
visible: root.community.admin
|
visible: root.community.amISectionAdmin
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusMenuItem {
|
StatusMenuItem {
|
||||||
|
@ -188,7 +191,7 @@ Item {
|
||||||
icon.name: "arrow-right"
|
icon.name: "arrow-right"
|
||||||
iconRotation: 180
|
iconRotation: 180
|
||||||
type: StatusMenuItem.Type.Danger
|
type: StatusMenuItem.Type.Danger
|
||||||
enabled: root.community.admin
|
enabled: root.community.amISectionAdmin
|
||||||
// Not Refactored Yet
|
// Not Refactored Yet
|
||||||
// onTriggered: chatsModel.communities.removeUserFromCommunity(model.pubKey)
|
// onTriggered: chatsModel.communities.removeUserFromCommunity(model.pubKey)
|
||||||
}
|
}
|
||||||
|
@ -198,7 +201,7 @@ Item {
|
||||||
text: qsTrId("ban")
|
text: qsTrId("ban")
|
||||||
icon.name: "cancel"
|
icon.name: "cancel"
|
||||||
type: StatusMenuItem.Type.Danger
|
type: StatusMenuItem.Type.Danger
|
||||||
enabled: root.community.admin
|
enabled: root.community.amISectionAdmin
|
||||||
// Not Refactored Yet
|
// Not Refactored Yet
|
||||||
// onTriggered: chatsModel.communities.banUserFromCommunity(model.pubKey, root.community.id)
|
// onTriggered: chatsModel.communities.banUserFromCommunity(model.pubKey, root.community.id)
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ Rectangle {
|
||||||
color: Style.current.transparent
|
color: Style.current.transparent
|
||||||
property var activeCommunity
|
property var activeCommunity
|
||||||
property var store
|
property var store
|
||||||
|
property var communitySectionModule
|
||||||
property bool hasAddedContacts
|
property bool hasAddedContacts
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
@ -104,7 +105,8 @@ Rectangle {
|
||||||
anchors.bottomMargin: Style.current.padding
|
anchors.bottomMargin: Style.current.padding
|
||||||
onClicked: Global.openPopup(communityProfilePopup, {
|
onClicked: Global.openPopup(communityProfilePopup, {
|
||||||
store: rootStore,
|
store: rootStore,
|
||||||
community: root.activeCommunity
|
community: root.activeCommunity,
|
||||||
|
communitySectionModule: root.communitySectionModule
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ StatusModal {
|
||||||
|
|
||||||
property var store
|
property var store
|
||||||
property var community
|
property var community
|
||||||
|
property var communitySectionModule
|
||||||
|
|
||||||
onClosed: {
|
onClosed: {
|
||||||
while (contentItem.depth > 1) {
|
while (contentItem.depth > 1) {
|
||||||
|
@ -73,7 +74,7 @@ StatusModal {
|
||||||
store: root.store
|
store: root.store
|
||||||
})
|
})
|
||||||
onLeaveButtonClicked: {
|
onLeaveButtonClicked: {
|
||||||
root.store.leaveCommunity(root.community.id);
|
communitySectionModule.leaveCommunity();
|
||||||
root.close();
|
root.close();
|
||||||
}
|
}
|
||||||
onCopyToClipboard: {
|
onCopyToClipboard: {
|
||||||
|
@ -114,6 +115,7 @@ StatusModal {
|
||||||
headerTitle: qsTrId("members-label")
|
headerTitle: qsTrId("members-label")
|
||||||
headerSubtitle: root.community.members.count.toString()
|
headerSubtitle: root.community.members.count.toString()
|
||||||
community: root.community
|
community: root.community
|
||||||
|
communitySectionModule: root.communitySectionModule
|
||||||
onInviteButtonClicked: root.contentItem.push(inviteFriendsView)
|
onInviteButtonClicked: root.contentItem.push(inviteFriendsView)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ import shared 1.0
|
||||||
StatusModal {
|
StatusModal {
|
||||||
id: popup
|
id: popup
|
||||||
property var store
|
property var store
|
||||||
|
property var communitySectionModule
|
||||||
property var pendingRequestsToJoin
|
property var pendingRequestsToJoin
|
||||||
onOpened: {
|
onOpened: {
|
||||||
contentItem.errorText.text = ""
|
contentItem.errorText.text = ""
|
||||||
|
@ -86,7 +87,7 @@ StatusModal {
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: popup.store.acceptRequestToJoinCommunity(model.communityId, id)
|
onClicked: communitySectionModule.acceptRequestToJoinCommunity(id)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
StatusRoundIcon {
|
StatusRoundIcon {
|
||||||
|
@ -100,7 +101,7 @@ StatusModal {
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: popup.store.declineRequestToJoinCommunity(model.communityId, id)
|
onClicked: communitySectionModule.declineRequestToJoinCommunity(id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -157,8 +157,8 @@ QtObject {
|
||||||
// chatsModelInst.communities.deleteCommunityCategory(chatsModelInst.communities.activeCommunity.id, categoryId);
|
// chatsModelInst.communities.deleteCommunityCategory(chatsModelInst.communities.activeCommunity.id, categoryId);
|
||||||
}
|
}
|
||||||
|
|
||||||
function leaveCommunity(communityId) {
|
function leaveCommunity() {
|
||||||
communitiesModuleInst.leaveCommunity(communityId);
|
chatCommunitySectionModule.leaveCommunity();
|
||||||
}
|
}
|
||||||
|
|
||||||
function setCommunityMuted(communityId, checked) {
|
function setCommunityMuted(communityId, checked) {
|
||||||
|
@ -169,8 +169,8 @@ QtObject {
|
||||||
return communitiesModuleInst.exportCommunity(communityId);
|
return communitiesModuleInst.exportCommunity(communityId);
|
||||||
}
|
}
|
||||||
|
|
||||||
function createCommunityChannel(communityId, channelName, channelDescription) {
|
function createCommunityChannel(channelName, channelDescription) {
|
||||||
communitiesModuleInst.createCommunityChannel(communityId, channelName, channelDescription);
|
chatCommunitySectionModule.createCommunityChannel(channelName, channelDescription);
|
||||||
}
|
}
|
||||||
|
|
||||||
function editCommunityChannel(communityId, channelId, channelName, channelDescription, channelCategoryId, popupPosition) {
|
function editCommunityChannel(communityId, channelId, channelName, channelDescription, channelCategoryId, popupPosition) {
|
||||||
|
@ -181,12 +181,12 @@ QtObject {
|
||||||
// chatsModelInst.editCommunityChannel(communityId, channelId, channelName, channelDescription, channelCategoryId, popupPosition);
|
// chatsModelInst.editCommunityChannel(communityId, channelId, channelName, channelDescription, channelCategoryId, popupPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
function acceptRequestToJoinCommunity(communityId, requestId) {
|
function acceptRequestToJoinCommunity(requestId) {
|
||||||
communitiesModuleInst.acceptRequestToJoinCommunity(communityId, requestId)
|
chatCommunitySectionModule.acceptRequestToJoinCommunity(requestId)
|
||||||
}
|
}
|
||||||
|
|
||||||
function declineRequestToJoinCommunity(communityId, requestId) {
|
function declineRequestToJoinCommunity(requestId) {
|
||||||
communitiesModuleInst.declineRequestToJoinCommunity(communityId, requestId)
|
chatCommunitySectionModule.declineRequestToJoinCommunity(requestId)
|
||||||
}
|
}
|
||||||
|
|
||||||
function userNameOrAlias(pk) {
|
function userNameOrAlias(pk) {
|
||||||
|
|
|
@ -48,10 +48,10 @@ Item {
|
||||||
chatInfoButton.image.source: communityData.image
|
chatInfoButton.image.source: communityData.image
|
||||||
chatInfoButton.icon.color: communityData.color
|
chatInfoButton.icon.color: communityData.color
|
||||||
menuButton.visible: communityData.amISectionAdmin && communityData.canManageUsers
|
menuButton.visible: communityData.amISectionAdmin && communityData.canManageUsers
|
||||||
// TODO remove dynamic scoping of popup component
|
|
||||||
chatInfoButton.onClicked: Global.openPopup(communityProfilePopup, {
|
chatInfoButton.onClicked: Global.openPopup(communityProfilePopup, {
|
||||||
store: root.store,
|
store: root.store,
|
||||||
community: communityData
|
community: communityData,
|
||||||
|
communitySectionModule: root.communitySectionModule
|
||||||
})
|
})
|
||||||
|
|
||||||
popupMenu: StatusPopupMenu {
|
popupMenu: StatusPopupMenu {
|
||||||
|
@ -102,7 +102,9 @@ Item {
|
||||||
//% "Membership requests"
|
//% "Membership requests"
|
||||||
title: qsTrId("membership-requests")
|
title: qsTrId("membership-requests")
|
||||||
requestsCount: membershipRequests.nbRequests
|
requestsCount: membershipRequests.nbRequests
|
||||||
sensor.onClicked: Global.openPopup(membershipRequestPopup)
|
sensor.onClicked: Global.openPopup(membershipRequestPopup, {
|
||||||
|
communitySectionModule: root.communitySectionModule
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -347,6 +349,7 @@ Item {
|
||||||
activeCommunity: communityData
|
activeCommunity: communityData
|
||||||
store: root.store
|
store: root.store
|
||||||
hasAddedContacts: root.hasAddedContacts
|
hasAddedContacts: root.hasAddedContacts
|
||||||
|
communitySectionModule: root.communitySectionModule
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -394,7 +397,7 @@ Item {
|
||||||
CreateChannelPopup {
|
CreateChannelPopup {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
onCreateCommunityChannel: function (chName, chDescription) {
|
onCreateCommunityChannel: function (chName, chDescription) {
|
||||||
root.store.createCommunityChannel(communityData.id, chName, chDescription)
|
root.store.createCommunityChannel(chName, chDescription)
|
||||||
}
|
}
|
||||||
onClosed: {
|
onClosed: {
|
||||||
destroy()
|
destroy()
|
||||||
|
|
|
@ -374,7 +374,7 @@ Item {
|
||||||
// root.store.chatsModelInst.communities.setActiveCommunity(id)
|
// root.store.chatsModelInst.communities.setActiveCommunity(id)
|
||||||
// }
|
// }
|
||||||
onSetObservedCommunity: {
|
onSetObservedCommunity: {
|
||||||
root.store.communitiesModuleInst.setObservedCommunity(id)
|
root.store.setObservedCommunity(id)
|
||||||
}
|
}
|
||||||
onClosed: {
|
onClosed: {
|
||||||
destroy()
|
destroy()
|
||||||
|
|
|
@ -47,10 +47,6 @@ QtObject {
|
||||||
return communitiesModuleInst.exportCommunity(communityId);
|
return communitiesModuleInst.exportCommunity(communityId);
|
||||||
}
|
}
|
||||||
|
|
||||||
function leaveCommunity(communityId) {
|
|
||||||
communitiesModuleInst.leaveCommunity(communityId);
|
|
||||||
}
|
|
||||||
|
|
||||||
function createCommunity(communityName, communityDescription, checkedMembership, ensOnlySwitchChecked, communityColor, communityImage, imageCropperModalaX, imageCropperModalaY, imageCropperModalbX, imageCropperModalbY) {
|
function createCommunity(communityName, communityDescription, checkedMembership, ensOnlySwitchChecked, communityColor, communityImage, imageCropperModalaX, imageCropperModalaY, imageCropperModalbX, imageCropperModalbY) {
|
||||||
communitiesModuleInst.createCommunity(communityName, communityDescription, checkedMembership, ensOnlySwitchChecked, communityColor, communityImage, imageCropperModalaX, imageCropperModalaY, imageCropperModalbX, imageCropperModalbY);
|
communitiesModuleInst.createCommunity(communityName, communityDescription, checkedMembership, ensOnlySwitchChecked, communityColor, communityImage, imageCropperModalaX, imageCropperModalaY, imageCropperModalbX, imageCropperModalbY);
|
||||||
}
|
}
|
||||||
|
@ -66,4 +62,12 @@ QtObject {
|
||||||
function copyToClipboard(text) {
|
function copyToClipboard(text) {
|
||||||
globalUtils.copyToClipboard(text)
|
globalUtils.copyToClipboard(text)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function generateAlias(pk) {
|
||||||
|
return globalUtils.generateAlias(pk);
|
||||||
|
}
|
||||||
|
|
||||||
|
function generateIdenticon(pk) {
|
||||||
|
return globalUtils.generateIdenticon(pk);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -248,17 +248,23 @@ Item {
|
||||||
popupMenu: StatusPopupMenu {
|
popupMenu: StatusPopupMenu {
|
||||||
id: communityContextMenu
|
id: communityContextMenu
|
||||||
|
|
||||||
|
property var chatCommunitySectionModule
|
||||||
|
|
||||||
openHandler: function () {
|
openHandler: function () {
|
||||||
appMain.rootStore.setObservedCommunity(model.id)
|
// // we cannot return QVariant if we pass another parameter in a function call
|
||||||
|
// // that's why we're using it this way
|
||||||
|
mainModule.prepareCommunitySectionModuleForCommunityId(model.id)
|
||||||
|
communityContextMenu.chatCommunitySectionModule = mainModule.getCommunitySectionModule()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusMenuItem {
|
StatusMenuItem {
|
||||||
//% "Invite People"
|
//% "Invite People"
|
||||||
text: qsTrId("invite-people")
|
text: qsTrId("invite-people")
|
||||||
icon.name: "share-ios"
|
icon.name: "share-ios"
|
||||||
enabled: appMain.rootStore.observedCommunity.canManageUsers
|
enabled: model.canManageUsers
|
||||||
onTriggered: Global.openPopup(inviteFriendsToCommunityPopup, {
|
onTriggered: Global.openPopup(inviteFriendsToCommunityPopup, {
|
||||||
community: appMain.rootStore.observedCommunity,
|
community: model,
|
||||||
hasAddedContacts: appMain.rootStore.hasAddedContacts
|
hasAddedContacts: appMain.rootStore.hasAddedContacts
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -269,18 +275,19 @@ Item {
|
||||||
icon.name: "group-chat"
|
icon.name: "group-chat"
|
||||||
onTriggered: Global.openPopup(communityProfilePopup, {
|
onTriggered: Global.openPopup(communityProfilePopup, {
|
||||||
store: appMain.rootStore,
|
store: appMain.rootStore,
|
||||||
community: appMain.rootStore.observedCommunity
|
community: model,
|
||||||
|
communitySectionModule: communityContextMenu.chatCommunitySectionModule
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusMenuItem {
|
StatusMenuItem {
|
||||||
enabled: appMain.rootStore.observedCommunity.amISectionAdmin
|
enabled: model.amISectionAdmin
|
||||||
//% "Edit Community"
|
//% "Edit Community"
|
||||||
text: qsTrId("edit-community")
|
text: qsTrId("edit-community")
|
||||||
icon.name: "edit"
|
icon.name: "edit"
|
||||||
onTriggered: Global.openPopup(editCommunityPopup, {
|
onTriggered: Global.openPopup(editCommunityPopup, {
|
||||||
store: appMain.rootStore,
|
store: appMain.rootStore,
|
||||||
community: appMain.rootStore.observedCommunity
|
community: model
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,7 +300,7 @@ Item {
|
||||||
icon.width: 14
|
icon.width: 14
|
||||||
iconRotation: 180
|
iconRotation: 180
|
||||||
type: StatusMenuItem.Type.Danger
|
type: StatusMenuItem.Type.Danger
|
||||||
onTriggered: appMain.rootStore.leaveCommunity(model.id)
|
onTriggered: communityContextMenu.chatCommunitySectionModule.leaveCommunity()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue