Revert "refactor(members): unify members models into one (#16508)"
This reverts commit f7823cd0b7
.
This commit is contained in:
parent
c47f42eb39
commit
9b1fa46b17
|
@ -206,8 +206,8 @@ method onChatMemberUpdated*(self: Module, publicKey: string, memberRole: MemberR
|
|||
icon = contactDetails.icon,
|
||||
isContact = contactDetails.dto.isContact,
|
||||
isVerified = not isMe and contactDetails.dto.isContactVerified(),
|
||||
memberRole,
|
||||
joined,
|
||||
memberRole = memberRole,
|
||||
joined = joined,
|
||||
isUntrustworthy = contactDetails.dto.trustStatus == TrustStatus.Untrustworthy,
|
||||
)
|
||||
|
||||
|
|
|
@ -198,61 +198,54 @@ proc createMemberItem(self: Module, memberId, requestId: string, status: Members
|
|||
membershipRequestState = status,
|
||||
)
|
||||
|
||||
method getCommunityItem(self: Module, community: CommunityDto): SectionItem =
|
||||
var memberItems: seq[MemberItem] = @[]
|
||||
for member in community.members:
|
||||
var communityMemberState = MembershipRequestState.Accepted
|
||||
if community.pendingAndBannedMembers.hasKey(member.id):
|
||||
let memberState = community.pendingAndBannedMembers[member.id].toMembershipRequestState()
|
||||
if memberState == MembershipRequestState.BannedPending or memberState == MembershipRequestState.KickedPending:
|
||||
communityMemberState = memberState
|
||||
memberItems.add(self.createMemberItem(member.id, "", communityMemberState))
|
||||
method getCommunityItem(self: Module, c: CommunityDto): SectionItem =
|
||||
# TODO: unite bannedMembers, pendingMemberRequests and declinedMemberRequests
|
||||
var members: seq[MemberItem] = @[]
|
||||
for member in c.members:
|
||||
if c.pendingAndBannedMembers.hasKey(member.id):
|
||||
let communityMemberState = c.pendingAndBannedMembers[member.id]
|
||||
members.add(self.createMemberItem(member.id, "", toMembershipRequestState(communityMemberState)))
|
||||
|
||||
var bannedMembers: seq[MemberItem] = @[]
|
||||
for memberId, communityMemberState in community.pendingAndBannedMembers:
|
||||
for memberId, communityMemberState in c.pendingAndBannedMembers:
|
||||
bannedMembers.add(self.createMemberItem(memberId, "", toMembershipRequestState(communityMemberState)))
|
||||
|
||||
let pendingMembers = community.pendingRequestsToJoin.map(proc(requestDto: CommunityMembershipRequestDto): MemberItem =
|
||||
result = self.createMemberItem(requestDto.publicKey, requestDto.id, MembershipRequestState(requestDto.state))
|
||||
)
|
||||
let declinedMemberItems = community.declinedRequestsToJoin.map(proc(requestDto: CommunityMembershipRequestDto): MemberItem =
|
||||
result = self.createMemberItem(requestDto.publicKey, requestDto.id, MembershipRequestState(requestDto.state))
|
||||
)
|
||||
|
||||
memberItems = concat(memberItems, pendingMembers, declinedMemberItems, bannedMembers)
|
||||
|
||||
return initItem(
|
||||
community.id,
|
||||
c.id,
|
||||
SectionType.Community,
|
||||
community.name,
|
||||
community.memberRole,
|
||||
community.isControlNode,
|
||||
community.description,
|
||||
community.introMessage,
|
||||
community.outroMessage,
|
||||
community.images.thumbnail,
|
||||
community.images.banner,
|
||||
c.name,
|
||||
c.memberRole,
|
||||
c.isControlNode,
|
||||
c.description,
|
||||
c.introMessage,
|
||||
c.outroMessage,
|
||||
c.images.thumbnail,
|
||||
c.images.banner,
|
||||
icon = "",
|
||||
community.color,
|
||||
community.tags,
|
||||
c.color,
|
||||
c.tags,
|
||||
hasNotification = false,
|
||||
notificationsCount = 0,
|
||||
active = false,
|
||||
enabled = true,
|
||||
community.joined,
|
||||
community.canJoin,
|
||||
community.spectated,
|
||||
community.canManageUsers,
|
||||
community.canRequestAccess,
|
||||
community.isMember,
|
||||
community.permissions.access,
|
||||
community.permissions.ensOnly,
|
||||
community.muted,
|
||||
members = memberItems,
|
||||
historyArchiveSupportEnabled = community.settings.historyArchiveSupportEnabled,
|
||||
encrypted = community.encrypted,
|
||||
communityTokens = @[],
|
||||
activeMembersCount = int(community.activeMembersCount),
|
||||
c.joined,
|
||||
c.canJoin,
|
||||
c.spectated,
|
||||
c.canManageUsers,
|
||||
c.canRequestAccess,
|
||||
c.isMember,
|
||||
c.permissions.access,
|
||||
c.permissions.ensOnly,
|
||||
c.muted,
|
||||
members = members,
|
||||
historyArchiveSupportEnabled = c.settings.historyArchiveSupportEnabled,
|
||||
bannedMembers = bannedMembers,
|
||||
pendingMemberRequests = c.pendingRequestsToJoin.map(proc(requestDto: CommunityMembershipRequestDto): MemberItem =
|
||||
result = self.createMemberItem(requestDto.publicKey, requestDto.id, MembershipRequestState(requestDto.state))),
|
||||
declinedMemberRequests = c.declinedRequestsToJoin.map(proc(requestDto: CommunityMembershipRequestDto): MemberItem =
|
||||
result = self.createMemberItem(requestDto.publicKey, requestDto.id, MembershipRequestState(requestDto.state))),
|
||||
encrypted = c.encrypted,
|
||||
communityTokens = @[]
|
||||
)
|
||||
|
||||
proc getCuratedCommunityItem(self: Module, community: CommunityDto): CuratedCommunityItem =
|
||||
|
@ -309,10 +302,8 @@ method setCommunityTags*(self: Module, communityTags: string) =
|
|||
self.view.setCommunityTags(communityTags)
|
||||
|
||||
method setAllCommunities*(self: Module, communities: seq[CommunityDto]) =
|
||||
var items: seq[SectionItem] = @[]
|
||||
for community in communities:
|
||||
items.add(self.getCommunityItem(community))
|
||||
self.view.model.addItems(items)
|
||||
self.view.addItem(self.getCommunityItem(community))
|
||||
|
||||
method communityAdded*(self: Module, community: CommunityDto) =
|
||||
self.view.addItem(self.getCommunityItem(community))
|
||||
|
|
|
@ -359,36 +359,6 @@ proc createCommunitySectionItem[T](self: Module[T], communityDetails: CommunityD
|
|||
else:
|
||||
discard
|
||||
|
||||
var memberItems = members.map(proc(member: ChatMember): MemberItem =
|
||||
var state = MembershipRequestState.Accepted
|
||||
if member.id in communityDetails.pendingAndBannedMembers:
|
||||
let memberState = communityDetails.pendingAndBannedMembers[member.id].toMembershipRequestState()
|
||||
if memberState == MembershipRequestState.BannedPending or memberState == MembershipRequestState.KickedPending:
|
||||
state = memberState
|
||||
elif not member.joined:
|
||||
state = MembershipRequestState.AwaitingAddress
|
||||
var airdropAddress = ""
|
||||
if not existingCommunity.isEmpty() and not existingCommunity.communityTokens.isNil:
|
||||
airdropAddress = existingCommunity.members.getAirdropAddressForMember(member.id)
|
||||
result = self.createMemberItem(
|
||||
member.id,
|
||||
requestId = "",
|
||||
state,
|
||||
member.role,
|
||||
airdropAddress,
|
||||
)
|
||||
)
|
||||
|
||||
let pendingMembers = communityDetails.pendingRequestsToJoin.map(proc(requestDto: CommunityMembershipRequestDto): MemberItem =
|
||||
result = self.createMemberItem(requestDto.publicKey, requestDto.id, MembershipRequestState(requestDto.state), MemberRole.None)
|
||||
)
|
||||
|
||||
let declinedMemberItems = communityDetails.declinedRequestsToJoin.map(proc(requestDto: CommunityMembershipRequestDto): MemberItem =
|
||||
result = self.createMemberItem(requestDto.publicKey, requestDto.id, MembershipRequestState(requestDto.state), MemberRole.None)
|
||||
)
|
||||
|
||||
memberItems = concat(memberItems, pendingMembers, declinedMemberItems, bannedMembers)
|
||||
|
||||
result = initItem(
|
||||
communityDetails.id,
|
||||
sectionType = SectionType.Community,
|
||||
|
@ -416,15 +386,42 @@ proc createCommunitySectionItem[T](self: Module[T], communityDetails: CommunityD
|
|||
communityDetails.permissions.access,
|
||||
communityDetails.permissions.ensOnly,
|
||||
communityDetails.muted,
|
||||
memberItems,
|
||||
# members
|
||||
members.map(proc(member: ChatMember): MemberItem =
|
||||
var state = MembershipRequestState.Accepted
|
||||
if member.id in communityDetails.pendingAndBannedMembers:
|
||||
let memberState = communityDetails.pendingAndBannedMembers[member.id].toMembershipRequestState()
|
||||
if memberState == MembershipRequestState.BannedPending or memberState == MembershipRequestState.KickedPending:
|
||||
state = memberState
|
||||
elif not member.joined:
|
||||
state = MembershipRequestState.AwaitingAddress
|
||||
var airdropAddress = ""
|
||||
if not existingCommunity.isEmpty() and not existingCommunity.communityTokens.isNil:
|
||||
airdropAddress = existingCommunity.members.getAirdropAddressForMember(member.id)
|
||||
result = self.createMemberItem(
|
||||
member.id,
|
||||
requestId = "",
|
||||
state,
|
||||
member.role,
|
||||
airdropAddress,
|
||||
)
|
||||
),
|
||||
communityDetails.settings.historyArchiveSupportEnabled,
|
||||
communityDetails.adminSettings.pinMessageAllMembersEnabled,
|
||||
bannedMembers,
|
||||
# pendingMemberRequests
|
||||
communityDetails.pendingRequestsToJoin.map(proc(requestDto: CommunityMembershipRequestDto): MemberItem =
|
||||
result = self.createMemberItem(requestDto.publicKey, requestDto.id, MembershipRequestState(requestDto.state), MemberRole.None)
|
||||
),
|
||||
# declinedMemberRequests
|
||||
communityDetails.declinedRequestsToJoin.map(proc(requestDto: CommunityMembershipRequestDto): MemberItem =
|
||||
result = self.createMemberItem(requestDto.publicKey, requestDto.id, MembershipRequestState(requestDto.state), MemberRole.None)
|
||||
),
|
||||
communityDetails.encrypted,
|
||||
communityTokensItems,
|
||||
communityDetails.pubsubTopic,
|
||||
communityDetails.pubsubTopicKey,
|
||||
communityDetails.shard.index,
|
||||
activeMembersCount = int(communityDetails.activeMembersCount),
|
||||
)
|
||||
|
||||
proc connectForNotificationsOnly[T](self: Module[T]) =
|
||||
|
@ -1361,7 +1358,7 @@ method newCommunityMembershipRequestReceived*[T](self: Module[T], membershipRequ
|
|||
singletonInstance.globalEvents.newCommunityMembershipRequestNotification("New membership request",
|
||||
fmt "{contactName} asks to join {community.name}", community.id)
|
||||
|
||||
self.view.model().addMember(membershipRequest.communityId, self.createMemberItem(
|
||||
self.view.model().addPendingMember(membershipRequest.communityId, self.createMemberItem(
|
||||
membershipRequest.publicKey,
|
||||
membershipRequest.id,
|
||||
MembershipRequestState(membershipRequest.state),
|
||||
|
@ -1369,7 +1366,7 @@ method newCommunityMembershipRequestReceived*[T](self: Module[T], membershipRequ
|
|||
))
|
||||
|
||||
method communityMembershipRequestCanceled*[T](self: Module[T], communityId: string, requestId: string, pubKey: string) =
|
||||
self.view.model().removeMember(communityId, pubKey)
|
||||
self.view.model().removePendingMember(communityId, pubKey)
|
||||
|
||||
method meMentionedCountChanged*[T](self: Module[T], allMentions: int) =
|
||||
singletonInstance.globalEvents.meMentionedIconBadgeNotification(allMentions)
|
||||
|
|
|
@ -174,17 +174,13 @@ QtObject:
|
|||
self.endInsertRows()
|
||||
self.countChanged()
|
||||
|
||||
proc findIndexForMember*(self: Model, pubKey: string): int =
|
||||
proc findIndexForMember(self: Model, pubKey: string): int =
|
||||
for i in 0 ..< self.items.len:
|
||||
if self.items[i].pubKey == pubKey:
|
||||
if(self.items[i].pubKey == pubKey):
|
||||
return i
|
||||
|
||||
return -1
|
||||
|
||||
proc getMemberItemByIndex*(self: Model, ind: int): MemberItem =
|
||||
if ind >= 0 and ind < self.items.len:
|
||||
return self.items[ind]
|
||||
|
||||
proc getMemberItem*(self: Model, pubKey: string): MemberItem =
|
||||
let ind = self.findIndexForMember(pubKey)
|
||||
if ind != -1:
|
||||
|
@ -287,7 +283,6 @@ QtObject:
|
|||
memberRole: MemberRole,
|
||||
joined: bool,
|
||||
isUntrustworthy: bool,
|
||||
membershipRequestState: MembershipRequestState = MembershipRequestState.None,
|
||||
callDataChanged: bool = true,
|
||||
): seq[int] =
|
||||
let ind = self.findIndexForMember(pubKey)
|
||||
|
@ -312,12 +307,6 @@ QtObject:
|
|||
updateRole(joined, Joined)
|
||||
updateRole(isUntrustworthy, IsUntrustworthy)
|
||||
|
||||
var updatedMembershipRequestState = membershipRequestState
|
||||
if updatedMembershipRequestState == MembershipRequestState.None:
|
||||
updatedMembershipRequestState = self.items[ind].membershipRequestState
|
||||
|
||||
updateRoleWithValue(membershipRequestState, MembershipRequestState, updatedMembershipRequestState)
|
||||
|
||||
if preferredDisplayNameChanged:
|
||||
roles.add(ModelRole.PreferredDisplayName.int)
|
||||
|
||||
|
@ -352,7 +341,6 @@ QtObject:
|
|||
item.memberRole,
|
||||
item.joined,
|
||||
item.isUntrustworthy,
|
||||
item.membershipRequestState,
|
||||
callDataChanged = false,
|
||||
)
|
||||
|
||||
|
@ -439,7 +427,6 @@ QtObject:
|
|||
memberRole = self.items[ind].memberRole,
|
||||
joined = self.items[ind].joined,
|
||||
isUntrustworthy,
|
||||
self.items[ind].membershipRequestState,
|
||||
)
|
||||
|
||||
proc setOnlineStatus*(self: Model, pubKey: string, onlineStatus: OnlineStatus) =
|
||||
|
@ -522,9 +509,3 @@ QtObject:
|
|||
break
|
||||
if not found:
|
||||
result.add(pubkey)
|
||||
|
||||
proc isUserBanned*(self: Model, pubkey: string): bool =
|
||||
let ind = self.findIndexForMember(pubkey)
|
||||
if ind == -1:
|
||||
return false
|
||||
return self.getMemberItemByIndex(ind).membershipRequestState == MembershipRequestState.Banned
|
||||
|
|
|
@ -49,13 +49,15 @@ type
|
|||
membersModel: member_model.Model
|
||||
historyArchiveSupportEnabled: bool
|
||||
pinMessageAllMembersEnabled: bool
|
||||
bannedMembersModel: member_model.Model
|
||||
pendingMemberRequestsModel*: member_model.Model
|
||||
declinedMemberRequestsModel: member_model.Model
|
||||
encrypted: bool
|
||||
communityTokensModel: community_tokens_model.TokenModel
|
||||
pubsubTopic: string
|
||||
pubsubTopicKey: string
|
||||
shardIndex: int
|
||||
isPendingOwnershipRequest: bool
|
||||
activeMembersCount: int
|
||||
|
||||
proc initItem*(
|
||||
id: string,
|
||||
|
@ -87,13 +89,15 @@ proc initItem*(
|
|||
members: seq[MemberItem] = @[],
|
||||
historyArchiveSupportEnabled = false,
|
||||
pinMessageAllMembersEnabled = false,
|
||||
bannedMembers: seq[MemberItem] = @[],
|
||||
pendingMemberRequests: seq[MemberItem] = @[],
|
||||
declinedMemberRequests: seq[MemberItem] = @[],
|
||||
encrypted: bool = false,
|
||||
communityTokens: seq[TokenItem] = @[],
|
||||
pubsubTopic = "",
|
||||
pubsubTopicKey = "",
|
||||
shardIndex = -1,
|
||||
isPendingOwnershipRequest: bool = false,
|
||||
activeMembersCount: int = 0,
|
||||
isPendingOwnershipRequest: bool = false
|
||||
): SectionItem =
|
||||
result.id = id
|
||||
result.sectionType = sectionType
|
||||
|
@ -125,6 +129,12 @@ proc initItem*(
|
|||
result.membersModel.setItems(members)
|
||||
result.historyArchiveSupportEnabled = historyArchiveSupportEnabled
|
||||
result.pinMessageAllMembersEnabled = pinMessageAllMembersEnabled
|
||||
result.bannedMembersModel = newModel()
|
||||
result.bannedMembersModel.setItems(bannedMembers)
|
||||
result.pendingMemberRequestsModel = newModel()
|
||||
result.pendingMemberRequestsModel.setItems(pendingMemberRequests)
|
||||
result.declinedMemberRequestsModel = newModel()
|
||||
result.declinedMemberRequestsModel.setItems(declinedMemberRequests)
|
||||
result.encrypted = encrypted
|
||||
result.communityTokensModel = newTokenModel()
|
||||
result.communityTokensModel.setItems(communityTokens)
|
||||
|
@ -132,7 +142,6 @@ proc initItem*(
|
|||
result.pubsubTopicKey = pubsubTopicKey
|
||||
result.shardIndex = shardIndex
|
||||
result.isPendingOwnershipRequest = isPendingOwnershipRequest
|
||||
result.activeMembersCount = activeMembersCount
|
||||
|
||||
proc isEmpty*(self: SectionItem): bool =
|
||||
return self.id.len == 0
|
||||
|
@ -168,6 +177,9 @@ proc `$`*(self: SectionItem): string =
|
|||
members:{self.membersModel},
|
||||
historyArchiveSupportEnabled:{self.historyArchiveSupportEnabled},
|
||||
pinMessageAllMembersEnabled:{self.pinMessageAllMembersEnabled},
|
||||
bannedMembers:{self.bannedMembersModel},
|
||||
pendingMemberRequests:{self.pendingMemberRequestsModel},
|
||||
declinedMemberRequests:{self.declinedMemberRequestsModel},
|
||||
encrypted:{self.encrypted},
|
||||
communityTokensModel:{self.communityTokensModel},
|
||||
isPendingOwnershipRequest:{self.isPendingOwnershipRequest}
|
||||
|
@ -353,8 +365,17 @@ proc updateMember*(
|
|||
self.membersModel.updateItem(pubkey, name, ensName, isEnsVerified, nickname, alias, image, isContact,
|
||||
isVerified, isUntrustworthy)
|
||||
|
||||
proc bannedMembers*(self: SectionItem): member_model.Model {.inline.} =
|
||||
self.bannedMembersModel
|
||||
|
||||
proc amIBanned*(self: SectionItem): bool {.inline.} =
|
||||
return self.membersModel.isUserBanned(singletonInstance.userProfile.getPubKey())
|
||||
self.bannedMembersModel.isContactWithIdAdded(singletonInstance.userProfile.getPubKey())
|
||||
|
||||
proc pendingMemberRequests*(self: SectionItem): member_model.Model {.inline.} =
|
||||
self.pendingMemberRequestsModel
|
||||
|
||||
proc declinedMemberRequests*(self: SectionItem): member_model.Model {.inline.} =
|
||||
self.declinedMemberRequestsModel
|
||||
|
||||
proc isPendingOwnershipRequest*(self: SectionItem): bool {.inline.} =
|
||||
self.isPendingOwnershipRequest
|
||||
|
@ -417,9 +438,13 @@ proc communityTokens*(self: SectionItem): community_tokens_model.TokenModel {.in
|
|||
self.communityTokensModel
|
||||
|
||||
proc updatePendingRequestLoadingState*(self: SectionItem, memberKey: string, loading: bool) {.inline.} =
|
||||
self.membersModel.updateLoadingState(memberKey, loading)
|
||||
self.pendingMemberRequestsModel.updateLoadingState(memberKey, loading)
|
||||
|
||||
proc updateMembershipStatus*(self: SectionItem, memberKey: string, state: MembershipRequestState) {.inline.} =
|
||||
case state:
|
||||
of MembershipRequestState.Banned, MembershipRequestState.BannedWithAllMessagesDelete, MembershipRequestState.UnbannedPending:
|
||||
self.bannedMembersModel.updateMembershipStatus(memberKey, state)
|
||||
else:
|
||||
self.membersModel.updateMembershipStatus(memberKey, state)
|
||||
|
||||
proc pubsubTopic*(self: SectionItem): string {.inline.} =
|
||||
|
@ -439,9 +464,3 @@ proc shardIndex*(self: SectionItem): int {.inline.} =
|
|||
|
||||
proc `shardIndex=`*(self: var SectionItem, value: int) {.inline.} =
|
||||
self.shardIndex = value
|
||||
|
||||
proc activeMembersCount*(self: SectionItem): int {.inline.} =
|
||||
self.activeMembersCount
|
||||
|
||||
proc `activeMembersCount=`*(self: var SectionItem, value: int) {.inline.} =
|
||||
self.activeMembersCount = value
|
||||
|
|
|
@ -37,14 +37,16 @@ type
|
|||
MembersModel
|
||||
HistoryArchiveSupportEnabled
|
||||
PinMessageAllMembersEnabled
|
||||
BannedMembersModel
|
||||
Encrypted
|
||||
CommunityTokensModel
|
||||
PendingMemberRequestsModel
|
||||
DeclinedMemberRequestsModel
|
||||
AmIBanned
|
||||
PubsubTopic
|
||||
PubsubTopicKey
|
||||
ShardIndex
|
||||
IsPendingOwnershipRequest
|
||||
ActiveMembersCount
|
||||
|
||||
QtObject:
|
||||
type
|
||||
|
@ -108,17 +110,19 @@ QtObject:
|
|||
ModelRole.Access.int:"access",
|
||||
ModelRole.EnsOnly.int:"ensOnly",
|
||||
ModelRole.Muted.int:"muted",
|
||||
ModelRole.MembersModel.int:"allMembers",
|
||||
ModelRole.MembersModel.int:"members",
|
||||
ModelRole.HistoryArchiveSupportEnabled.int:"historyArchiveSupportEnabled",
|
||||
ModelRole.PinMessageAllMembersEnabled.int:"pinMessageAllMembersEnabled",
|
||||
ModelRole.BannedMembersModel.int:"bannedMembers",
|
||||
ModelRole.Encrypted.int:"encrypted",
|
||||
ModelRole.CommunityTokensModel.int:"communityTokens",
|
||||
ModelRole.PendingMemberRequestsModel.int:"pendingMemberRequests",
|
||||
ModelRole.DeclinedMemberRequestsModel.int:"declinedMemberRequests",
|
||||
ModelRole.AmIBanned.int:"amIBanned",
|
||||
ModelRole.PubsubTopic.int:"pubsubTopic",
|
||||
ModelRole.PubsubTopicKey.int:"pubsubTopicKey",
|
||||
ModelRole.ShardIndex.int:"shardIndex",
|
||||
ModelRole.IsPendingOwnershipRequest.int:"isPendingOwnershipRequest",
|
||||
ModelRole.ActiveMembersCount.int:"activeMembersCount",
|
||||
}.toTable
|
||||
|
||||
method data(self: SectionModel, index: QModelIndex, role: int): QVariant =
|
||||
|
@ -190,10 +194,16 @@ QtObject:
|
|||
result = newQVariant(item.historyArchiveSupportEnabled)
|
||||
of ModelRole.PinMessageAllMembersEnabled:
|
||||
result = newQVariant(item.pinMessageAllMembersEnabled)
|
||||
of ModelRole.BannedMembersModel:
|
||||
result = newQVariant(item.bannedMembers)
|
||||
of ModelRole.Encrypted:
|
||||
result = newQVariant(item.encrypted)
|
||||
of ModelRole.CommunityTokensModel:
|
||||
result = newQVariant(item.communityTokens)
|
||||
of ModelRole.PendingMemberRequestsModel:
|
||||
result = newQVariant(item.pendingMemberRequests)
|
||||
of ModelRole.DeclinedMemberRequestsModel:
|
||||
result = newQVariant(item.declinedMemberRequests)
|
||||
of ModelRole.AmIBanned:
|
||||
result = newQVariant(item.amIBanned)
|
||||
of ModelRole.PubsubTopic:
|
||||
|
@ -204,8 +214,6 @@ QtObject:
|
|||
result = newQVariant(item.shardIndex)
|
||||
of ModelRole.IsPendingOwnershipRequest:
|
||||
result = newQVariant(item.isPendingOwnershipRequest)
|
||||
of ModelRole.ActiveMembersCount:
|
||||
result = newQVariant(item.activeMembersCount)
|
||||
|
||||
proc itemExists*(self: SectionModel, id: string): bool =
|
||||
for it in self.items:
|
||||
|
@ -322,9 +330,11 @@ QtObject:
|
|||
updateRoleWithValue(pubsubTopicKey, PubsubTopicKey, item.pubsubTopicKey)
|
||||
updateRoleWithValue(shardIndex, ShardIndex, item.shardIndex)
|
||||
updateRoleWithValue(isPendingOwnershipRequest, IsPendingOwnershipRequest, item.isPendingOwnershipRequest)
|
||||
updateRoleWithValue(activeMembersCount, ActiveMembersCount, item.activeMembersCount)
|
||||
|
||||
self.items[ind].members.updateToTheseItems(item.members.getItems())
|
||||
self.items[ind].bannedMembers.updateToTheseItems(item.bannedMembers.getItems())
|
||||
self.items[ind].pendingMemberRequests.updateToTheseItems(item.pendingMemberRequests.getItems())
|
||||
self.items[ind].declinedMemberRequests.updateToTheseItems(item.declinedMemberRequests.getItems())
|
||||
|
||||
if roles.len == 0:
|
||||
return
|
||||
|
@ -347,6 +357,7 @@ QtObject:
|
|||
isUntrustworthy: bool,
|
||||
) =
|
||||
for item in self.items:
|
||||
# TODO refactor to use only one model https://github.com/status-im/status-desktop/issues/16433
|
||||
item.members.updateItem(
|
||||
pubKey,
|
||||
displayName,
|
||||
|
@ -359,6 +370,42 @@ QtObject:
|
|||
isVerified,
|
||||
isUntrustworthy,
|
||||
)
|
||||
item.bannedMembers.updateItem(
|
||||
pubKey,
|
||||
displayName,
|
||||
ensName,
|
||||
isEnsVerified,
|
||||
localNickname,
|
||||
alias,
|
||||
icon,
|
||||
isContact,
|
||||
isVerified,
|
||||
isUntrustworthy,
|
||||
)
|
||||
item.pendingMemberRequests.updateItem(
|
||||
pubKey,
|
||||
displayName,
|
||||
ensName,
|
||||
isEnsVerified,
|
||||
localNickname,
|
||||
alias,
|
||||
icon,
|
||||
isContact,
|
||||
isVerified,
|
||||
isUntrustworthy,
|
||||
)
|
||||
item.declinedMemberRequests.updateItem(
|
||||
pubKey,
|
||||
displayName,
|
||||
ensName,
|
||||
isEnsVerified,
|
||||
localNickname,
|
||||
alias,
|
||||
icon,
|
||||
isContact,
|
||||
isVerified,
|
||||
isUntrustworthy,
|
||||
)
|
||||
|
||||
proc getNthEnabledItem*(self: SectionModel, nth: int): SectionItem =
|
||||
if nth >= 0 and nth < self.items.len:
|
||||
|
@ -551,16 +598,16 @@ QtObject:
|
|||
|
||||
self.items[index].communityTokens.setItems(communityTokensItems)
|
||||
|
||||
proc addMember*(self: SectionModel, communityId: string, memberItem: MemberItem) =
|
||||
proc addPendingMember*(self: SectionModel, communityId: string, memberItem: MemberItem) =
|
||||
let i = self.getItemIndex(communityId)
|
||||
if i == -1:
|
||||
return
|
||||
|
||||
self.items[i].members.addItem(memberItem)
|
||||
self.items[i].pendingMemberRequests.addItem(memberItem)
|
||||
|
||||
proc removeMember*(self: SectionModel, communityId: string, memberId: string) =
|
||||
proc removePendingMember*(self: SectionModel, communityId: string, memberId: string) =
|
||||
let i = self.getItemIndex(communityId)
|
||||
if i == -1:
|
||||
return
|
||||
|
||||
self.items[i].members.removeItemById(memberId)
|
||||
self.items[i].pendingMemberRequests.removeItemById(memberId)
|
||||
|
|
|
@ -61,19 +61,18 @@ type MemberRole* {.pure} = enum
|
|||
type MembershipRequestState* {.pure} = enum
|
||||
None = 0,
|
||||
Pending = 1,
|
||||
Declined = 2,
|
||||
Accepted = 3
|
||||
Canceled = 4,
|
||||
AcceptedPending = 5,
|
||||
DeclinedPending = 6,
|
||||
AwaitingAddress = 7,
|
||||
Banned = 8,
|
||||
Kicked = 9,
|
||||
BannedPending = 10,
|
||||
UnbannedPending = 11,
|
||||
KickedPending = 12,
|
||||
Unbanned = 13,
|
||||
BannedWithAllMessagesDelete = 14
|
||||
Accepted = 2,
|
||||
Declined = 3,
|
||||
AcceptedPending = 4,
|
||||
DeclinedPending = 5,
|
||||
Banned = 6,
|
||||
Kicked = 7,
|
||||
BannedPending = 8,
|
||||
UnbannedPending = 9,
|
||||
KickedPending = 10,
|
||||
AwaitingAddress = 11,
|
||||
Unbanned = 12,
|
||||
BannedWithAllMessagesDelete = 13
|
||||
|
||||
type
|
||||
ContractTransactionStatus* {.pure.} = enum
|
||||
|
|
|
@ -57,7 +57,7 @@ Item {
|
|||
sourceComponent: ProfilePopupInviteFriendsPanel {
|
||||
id: panel
|
||||
|
||||
communityId: "communityId"
|
||||
community: ({ id: "communityId" })
|
||||
|
||||
rootStore: AppLayoutStores.RootStore {
|
||||
function communityHasMember(communityId, pubKey) {
|
||||
|
|
|
@ -18,9 +18,7 @@ import AppLayouts.Chat.stores 1.0 as ChatStores
|
|||
import AppLayouts.Profile.stores 1.0 as ProfileStores
|
||||
import AppLayouts.Wallet.stores 1.0 as WalletStore
|
||||
|
||||
import StatusQ 0.1
|
||||
import StatusQ.Core.Utils 0.1
|
||||
import SortFilterProxyModel 0.2
|
||||
|
||||
StackLayout {
|
||||
id: root
|
||||
|
@ -37,12 +35,6 @@ StackLayout {
|
|||
required property SharedStores.CurrenciesStore currencyStore
|
||||
|
||||
property var sectionItemModel
|
||||
|
||||
MembersModelAdaptor {
|
||||
id: membersModelAdaptor
|
||||
allMembers: !!sectionItemModel ? sectionItemModel.allMembers : null
|
||||
}
|
||||
|
||||
property var sendModalPopup
|
||||
|
||||
readonly property bool isOwner: sectionItemModel.memberRole === Constants.memberRole.owner
|
||||
|
@ -104,22 +96,23 @@ StackLayout {
|
|||
id: joinCommunityViewComponent
|
||||
JoinCommunityView {
|
||||
id: joinCommunityView
|
||||
readonly property string communityId: sectionItemModel.id
|
||||
name: sectionItemModel.name
|
||||
introMessage: sectionItemModel.introMessage
|
||||
communityDesc: sectionItemModel.description
|
||||
color: sectionItemModel.color
|
||||
image: sectionItemModel.image
|
||||
membersCount: membersModelAdaptor.joinedMembers.ModelCount.count
|
||||
readonly property var communityData: sectionItemModel
|
||||
readonly property string communityId: communityData.id
|
||||
name: communityData.name
|
||||
introMessage: communityData.introMessage
|
||||
communityDesc: communityData.description
|
||||
color: communityData.color
|
||||
image: communityData.image
|
||||
membersCount: communityData.members.count
|
||||
accessType: mainViewLoader.accessType
|
||||
joinCommunity: true
|
||||
amISectionAdmin: sectionItemModel.memberRole === Constants.memberRole.owner ||
|
||||
sectionItemModel.memberRole === Constants.memberRole.admin ||
|
||||
sectionItemModel.memberRole === Constants.memberRole.tokenMaster
|
||||
amISectionAdmin: communityData.memberRole === Constants.memberRole.owner ||
|
||||
communityData.memberRole === Constants.memberRole.admin ||
|
||||
communityData.memberRole === Constants.memberRole.tokenMaster
|
||||
communityItemsModel: root.rootStore.communityItemsModel
|
||||
requirementsMet: root.permissionsStore.allTokenRequirementsMet
|
||||
requirementsCheckPending: root.rootStore.permissionsCheckOngoing
|
||||
requiresRequest: !sectionItemModel.amIMember
|
||||
requiresRequest: !communityData.amIMember
|
||||
communityHoldingsModel: root.permissionsStore.becomeMemberPermissionsModel
|
||||
viewOnlyHoldingsModel: root.permissionsStore.viewOnlyPermissionsModel
|
||||
viewAndPostHoldingsModel: root.permissionsStore.viewAndPostPermissionsModel
|
||||
|
@ -132,13 +125,13 @@ StackLayout {
|
|||
onNotificationButtonClicked: Global.openActivityCenterPopup()
|
||||
onAdHocChatButtonClicked: rootStore.openCloseCreateChatView()
|
||||
onRequestToJoinClicked: {
|
||||
Global.communityIntroPopupRequested(joinCommunityView.communityId, sectionItemModel.name,
|
||||
sectionItemModel.introMessage, sectionItemModel.image,
|
||||
Global.communityIntroPopupRequested(joinCommunityView.communityId, communityData.name,
|
||||
communityData.introMessage, communityData.image,
|
||||
root.isInvitationPending)
|
||||
}
|
||||
onInvitationPendingClicked: {
|
||||
Global.communityIntroPopupRequested(joinCommunityView.communityId, sectionItemModel.name, sectionItemModel.introMessage,
|
||||
sectionItemModel.image, root.isInvitationPending)
|
||||
Global.communityIntroPopupRequested(joinCommunityView.communityId, communityData.name, communityData.introMessage,
|
||||
communityData.image, root.isInvitationPending)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -164,7 +157,6 @@ StackLayout {
|
|||
currencyStore: root.currencyStore
|
||||
sendModalPopup: root.sendModalPopup
|
||||
sectionItemModel: root.sectionItemModel
|
||||
joinedMembersCount: membersModelAdaptor.joinedMembers.ModelCount.count
|
||||
amIMember: sectionItem.amIMember
|
||||
amISectionAdmin: root.sectionItemModel.memberRole === Constants.memberRole.owner ||
|
||||
root.sectionItemModel.memberRole === Constants.memberRole.admin ||
|
||||
|
@ -258,11 +250,7 @@ StackLayout {
|
|||
isPendingOwnershipRequest: root.isPendingOwnershipRequest
|
||||
|
||||
chatCommunitySectionModule: root.rootStore.chatCommunitySectionModule
|
||||
community: root.sectionItemModel
|
||||
joinedMembers: membersModelAdaptor.joinedMembers
|
||||
bannedMembers: membersModelAdaptor.bannedMembers
|
||||
pendingMembers: membersModelAdaptor.pendingMembers
|
||||
declinedMembers: membersModelAdaptor.declinedMembers
|
||||
community: sectionItemModel
|
||||
communitySettingsDisabled: root.communitySettingsDisabled
|
||||
onCommunitySettingsDisabledChanged: if (communitySettingsDisabled) goTo(Constants.CommunitySettingsSections.Overview)
|
||||
|
||||
|
@ -275,11 +263,12 @@ StackLayout {
|
|||
id: controlNodeOfflineComponent
|
||||
ControlNodeOfflineCommunityView {
|
||||
id: controlNodeOfflineView
|
||||
name: root.sectionItemModel.name
|
||||
communityDesc: root.sectionItemModel.description
|
||||
color: root.sectionItemModel.color
|
||||
image: root.sectionItemModel.image
|
||||
membersCount: membersModelAdaptor.joinedMembers.ModelCount.count
|
||||
readonly property var communityData: sectionItemModel
|
||||
name: communityData.name
|
||||
communityDesc: communityData.description
|
||||
color: communityData.color
|
||||
image: communityData.image
|
||||
membersCount: communityData.members.count
|
||||
communityItemsModel: root.rootStore.communityItemsModel
|
||||
notificationCount: activityCenterStore.unreadNotificationsCount
|
||||
hasUnseenNotifications: activityCenterStore.hasUnseenNotifications
|
||||
|
@ -293,11 +282,11 @@ StackLayout {
|
|||
BannedMemberCommunityView {
|
||||
id: communityBanView
|
||||
readonly property var communityData: sectionItemModel
|
||||
name: root.sectionItemModel.name
|
||||
communityDesc: root.sectionItemModel.description
|
||||
color: root.sectionItemModel.color
|
||||
image: root.sectionItemModel.image
|
||||
membersCount: membersModelAdaptor.joinedMembers.count
|
||||
name: communityData.name
|
||||
communityDesc: communityData.description
|
||||
color: communityData.color
|
||||
image: communityData.image
|
||||
membersCount: communityData.members.count
|
||||
communityItemsModel: root.rootStore.communityItemsModel
|
||||
notificationCount: activityCenterStore.unreadNotificationsCount
|
||||
hasUnseenNotifications: activityCenterStore.hasUnseenNotifications
|
||||
|
|
|
@ -50,7 +50,6 @@ StatusSectionLayout {
|
|||
required property SharedStores.CurrenciesStore currencyStore
|
||||
required property var sendModalPopup
|
||||
property var sectionItemModel
|
||||
property int joinedMembersCount
|
||||
|
||||
property var emojiPopup
|
||||
property var stickersPopup
|
||||
|
@ -301,8 +300,7 @@ StatusSectionLayout {
|
|||
id: communtiyColumnComponent
|
||||
CommunityColumnView {
|
||||
communitySectionModule: root.rootStore.chatCommunitySectionModule
|
||||
communityData: root.sectionItemModel
|
||||
joinedMembersCount: root.joinedMembersCount
|
||||
communityData: sectionItemModel
|
||||
store: root.rootStore
|
||||
communitiesStore: root.communitiesStore
|
||||
walletAssetsStore: root.walletAssetsStore
|
||||
|
|
|
@ -1,113 +0,0 @@
|
|||
import QtQml 2.15
|
||||
|
||||
import StatusQ 0.1
|
||||
import StatusQ.Models 0.1
|
||||
import StatusQ.Core.Utils 0.1
|
||||
|
||||
import utils 1.0
|
||||
|
||||
import SortFilterProxyModel 0.2
|
||||
|
||||
QObject {
|
||||
id: root
|
||||
|
||||
/**
|
||||
Expected model structure:
|
||||
|
||||
pubKey [string] - unique identifier of a member, e.g "0x3234235"
|
||||
displayName [string] - member's chosen name
|
||||
preferredDisplayName [string] - calculated member name according to priorities (eg: nickname has higher priority)
|
||||
ensName [string] - member's ENS name
|
||||
isEnsVerified [bool] - whether the ENS name was verified on chain
|
||||
localNickname [string] - local nickname set by the current user
|
||||
alias [string] - generated 3 word name
|
||||
icon [string] - thumbnail image of the user
|
||||
colorId [string] - generated color ID for the user's profile
|
||||
colorHash [string] - generated color hash for the user's profile
|
||||
onlineStatus [int] - the online status of the member
|
||||
isContact [bool] - whether the user is a mutual contact or not
|
||||
isVerified [bool] - wheter the user has been marked as verified or not
|
||||
isUntrustworthy [bool] - wheter the user has been marked as untrustworthy or not
|
||||
isBlocked [bool] - whether the user has been blocked or not
|
||||
contactRequest [int] - state of the contact request that was sent
|
||||
incomingVerificationStatus [int] - state of the verification request that was received
|
||||
outgoingVerificationStatus [int] - state of the verification request that was send
|
||||
memberRole [int] - role of the member in the community
|
||||
joined [bool] - whether the user has joined the community
|
||||
requestToJoinId [string] - the user's request to join ID
|
||||
requestToJoinLoading [bool] - whether the request is being processed after an admin made an action (loading state)
|
||||
airdropAddress [string] - the member's airdrop address (only available to TMs and owners)
|
||||
membershipRequestState [int] - the user's membership state (pending, joined, etc.)
|
||||
**/
|
||||
property var allMembers
|
||||
|
||||
readonly property var joinedMembers: SortFilterProxyModel {
|
||||
sourceModel: root.allMembers ?? null
|
||||
|
||||
filters: AnyOf {
|
||||
ValueFilter {
|
||||
roleName: "membershipRequestState"
|
||||
value: Constants.CommunityMembershipRequestState.Accepted
|
||||
}
|
||||
ValueFilter {
|
||||
roleName: "membershipRequestState"
|
||||
value: Constants.CommunityMembershipRequestState.KickedPending
|
||||
}
|
||||
ValueFilter {
|
||||
roleName: "membershipRequestState"
|
||||
value: Constants.CommunityMembershipRequestState.BannedPending
|
||||
}
|
||||
ValueFilter {
|
||||
roleName: "membershipRequestState"
|
||||
value: Constants.CommunityMembershipRequestState.AwaitingAddress
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
readonly property var bannedMembers: SortFilterProxyModel {
|
||||
sourceModel: root.allMembers ?? null
|
||||
|
||||
filters: AnyOf {
|
||||
ValueFilter {
|
||||
roleName: "membershipRequestState"
|
||||
value: Constants.CommunityMembershipRequestState.Banned
|
||||
}
|
||||
ValueFilter {
|
||||
roleName: "membershipRequestState"
|
||||
value: Constants.CommunityMembershipRequestState.UnbannedPending
|
||||
}
|
||||
ValueFilter {
|
||||
roleName: "membershipRequestState"
|
||||
value: Constants.CommunityMembershipRequestState.BannedWithAllMessagesDelete
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
readonly property var pendingMembers: SortFilterProxyModel {
|
||||
sourceModel: root.allMembers ?? null
|
||||
|
||||
filters: AnyOf {
|
||||
ValueFilter {
|
||||
roleName: "membershipRequestState"
|
||||
value: Constants.CommunityMembershipRequestState.Pending
|
||||
}
|
||||
ValueFilter {
|
||||
roleName: "membershipRequestState"
|
||||
value: Constants.CommunityMembershipRequestState.AcceptedPending
|
||||
}
|
||||
ValueFilter {
|
||||
roleName: "membershipRequestState"
|
||||
value: Constants.CommunityMembershipRequestState.RejectedPending
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
readonly property var declinedMembers: SortFilterProxyModel {
|
||||
sourceModel: root.allMembers ?? null
|
||||
|
||||
filters: ValueFilter {
|
||||
roleName: "membershipRequestState"
|
||||
value: Constants.CommunityMembershipRequestState.Rejected
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
import QtQuick 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
|
||||
import StatusQ 0.1
|
||||
import StatusQ.Controls 0.1
|
||||
import utils 1.0
|
||||
|
||||
|
@ -15,8 +14,8 @@ SettingsPage {
|
|||
property RootStore rootStore
|
||||
property var membersModel
|
||||
property var bannedMembersModel
|
||||
property var pendingMembersModel
|
||||
property var declinedMembersModel
|
||||
property var pendingMemberRequestsModel
|
||||
property var declinedMemberRequestsModel
|
||||
property string communityName
|
||||
|
||||
property int memberRole
|
||||
|
@ -80,7 +79,7 @@ SettingsPage {
|
|||
objectName: "pendingRequestsButton"
|
||||
width: implicitWidth
|
||||
text: qsTr("Pending Requests")
|
||||
enabled: pendingMembersModel.ModelCount.count > 0
|
||||
enabled: pendingMemberRequestsModel.count > 0
|
||||
}
|
||||
|
||||
StatusTabButton {
|
||||
|
@ -88,14 +87,14 @@ SettingsPage {
|
|||
objectName: "declinedRequestsButton"
|
||||
width: implicitWidth
|
||||
text: qsTr("Rejected")
|
||||
enabled: declinedMembersModel.ModelCount.count > 0
|
||||
enabled: declinedMemberRequestsModel.count > 0
|
||||
}
|
||||
|
||||
StatusTabButton {
|
||||
id: bannedBtn
|
||||
objectName: "bannedButton"
|
||||
width: implicitWidth
|
||||
enabled: bannedMembersModel.ModelCount.count > 0
|
||||
enabled: bannedMembersModel.count > 0
|
||||
text: qsTr("Banned")
|
||||
}
|
||||
}
|
||||
|
@ -111,10 +110,10 @@ SettingsPage {
|
|||
rootStore: root.rootStore
|
||||
memberRole: root.memberRole
|
||||
placeholderText: {
|
||||
if (root.membersModel.ModelCount.count === 0)
|
||||
if (root.membersModel.count === 0)
|
||||
return qsTr("No members to search")
|
||||
|
||||
return qsTr("Search %1's %n member(s)", "", root.membersModel ? root.membersModel.ModelCount.count : 0).arg(root.communityName)
|
||||
return qsTr("Search %1's %n member(s)", "", root.membersModel ? root.membersModel.count : 0).arg(root.communityName)
|
||||
}
|
||||
panelType: MembersTabPanel.TabType.AllMembers
|
||||
|
||||
|
@ -139,14 +138,14 @@ SettingsPage {
|
|||
}
|
||||
|
||||
MembersTabPanel {
|
||||
model: root.pendingMembersModel
|
||||
model: root.pendingMemberRequestsModel
|
||||
rootStore: root.rootStore
|
||||
memberRole: root.memberRole
|
||||
placeholderText: {
|
||||
if (root.pendingMembersModel.ModelCount.count === 0)
|
||||
if (root.pendingMemberRequestsModel.count === 0)
|
||||
return qsTr("No pending requests to search")
|
||||
|
||||
return qsTr("Search %1's %n pending request(s)", "", root.pendingMembersModel.ModelCount.count).arg(root.communityName)
|
||||
return qsTr("Search %1's %n pending request(s)", "", root.pendingMemberRequestsModel.count).arg(root.communityName)
|
||||
}
|
||||
panelType: MembersTabPanel.TabType.PendingRequests
|
||||
|
||||
|
@ -158,14 +157,14 @@ SettingsPage {
|
|||
}
|
||||
|
||||
MembersTabPanel {
|
||||
model: root.declinedMembersModel
|
||||
model: root.declinedMemberRequestsModel
|
||||
rootStore: root.rootStore
|
||||
memberRole: root.memberRole
|
||||
placeholderText: {
|
||||
if (root.declinedMembersModel.ModelCount.count === 0)
|
||||
if (root.declinedMemberRequestsModel.count === 0)
|
||||
return qsTr("No rejected members to search")
|
||||
|
||||
return qsTr("Search %1's %n rejected member(s)", "", root.declinedMembersModel.ModelCount.count).arg(root.communityName)
|
||||
return qsTr("Search %1's %n rejected member(s)", "", root.declinedMemberRequestsModel.count).arg(root.communityName)
|
||||
}
|
||||
panelType: MembersTabPanel.TabType.DeclinedRequests
|
||||
|
||||
|
@ -180,10 +179,10 @@ SettingsPage {
|
|||
rootStore: root.rootStore
|
||||
memberRole: root.memberRole
|
||||
placeholderText: {
|
||||
if (root.bannedMembersModel.ModelCount.count === 0)
|
||||
if (root.bannedMembersModel.count === 0)
|
||||
return qsTr("No banned members to search")
|
||||
|
||||
return qsTr("Search %1's %n banned member(s)", "", root.bannedMembersModel.ModelCount.count).arg(root.communityName)
|
||||
return qsTr("Search %1's %n banned member(s)", "", root.bannedMembersModel.count).arg(root.communityName)
|
||||
}
|
||||
panelType: MembersTabPanel.TabType.BannedMembers
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ ColumnLayout {
|
|||
|
||||
property AppLayoutStores.RootStore rootStore
|
||||
property ProfileStores.ContactsStore contactsStore
|
||||
property string communityId
|
||||
property var community
|
||||
|
||||
property var pubKeys: ([])
|
||||
|
||||
|
@ -58,7 +58,7 @@ ColumnLayout {
|
|||
|
||||
rootStore: root.rootStore
|
||||
contactsStore: root.contactsStore
|
||||
communityId: root.communityId
|
||||
communityId: root.community.id
|
||||
|
||||
hideCommunityMembers: true
|
||||
showCheckbox: true
|
||||
|
@ -90,11 +90,11 @@ ColumnLayout {
|
|||
StatusDescriptionListItem {
|
||||
Layout.fillWidth: true
|
||||
title: qsTr("Share community")
|
||||
subTitle: Utils.getCommunityShareLink(root.communityId)
|
||||
subTitle: Utils.getCommunityShareLink(root.community.id)
|
||||
tooltip.text: qsTr("Copied!")
|
||||
asset.name: "copy"
|
||||
iconButton.onClicked: {
|
||||
let link = Utils.getCommunityShareLink(root.communityId)
|
||||
let link = Utils.getCommunityShareLink(root.community.id)
|
||||
ClipboardUtils.setText(link)
|
||||
tooltip.visible = !tooltip.visible
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ StatusDialog {
|
|||
|
||||
required property var community
|
||||
|
||||
signal importControlNode(string communityId)
|
||||
signal importControlNode(var community)
|
||||
|
||||
width: 640
|
||||
|
||||
|
@ -76,7 +76,7 @@ StatusDialog {
|
|||
text: qsTr("Make this device the control node for %1").arg(root.community.name)
|
||||
enabled: agreementCheckBox.checked && agreementCheckBox2.checked
|
||||
onClicked: {
|
||||
root.importControlNode(root.community.id)
|
||||
root.importControlNode(root.community)
|
||||
root.close()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ StatusStackModal {
|
|||
ProfilePopupInviteFriendsPanel {
|
||||
rootStore: root.rootStore
|
||||
contactsStore: root.contactsStore
|
||||
communityId: root.communityId
|
||||
community: root.community
|
||||
onPubKeysChanged: root.pubKeys = pubKeys
|
||||
},
|
||||
|
||||
|
|
|
@ -44,7 +44,6 @@ Item {
|
|||
required property CurrenciesStore currencyStore
|
||||
property bool hasAddedContacts: false
|
||||
property var communityData
|
||||
property int joinedMembersCount
|
||||
property alias createChannelPopup: createChannelPopup
|
||||
|
||||
property int requestToJoinState: Constants.RequestToJoinState.None
|
||||
|
@ -80,7 +79,7 @@ Item {
|
|||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
name: communityData.name
|
||||
membersCount: root.joinedMembersCount
|
||||
membersCount: communityData.members.count
|
||||
image: communityData.image
|
||||
color: communityData.color
|
||||
amISectionAdmin: root.isSectionAdmin
|
||||
|
|
|
@ -38,11 +38,7 @@ StatusSectionLayout {
|
|||
property ChatStores.RootStore rootStore
|
||||
property var chatCommunitySectionModule
|
||||
required property TokensStore tokensStore
|
||||
required property var community
|
||||
required property var joinedMembers
|
||||
required property var bannedMembers
|
||||
required property var pendingMembers
|
||||
required property var declinedMembers
|
||||
property var community
|
||||
required property TransactionStore transactionStore
|
||||
property bool communitySettingsDisabled
|
||||
property var sendModalPopup
|
||||
|
@ -113,7 +109,7 @@ StatusSectionLayout {
|
|||
id: communityHeader
|
||||
|
||||
title: community.name
|
||||
subTitle: qsTr("%n member(s)", "", root.joinedMembers.ModelCount.count || 0)
|
||||
subTitle: qsTr("%n member(s)", "", community.members.count || 0)
|
||||
asset.name: community.image
|
||||
asset.color: community.color
|
||||
asset.isImage: true
|
||||
|
@ -295,10 +291,10 @@ StatusSectionLayout {
|
|||
|
||||
sourceComponent: MembersSettingsPanel {
|
||||
rootStore: root.rootStore
|
||||
membersModel: root.joinedMembers
|
||||
bannedMembersModel: root.bannedMembers
|
||||
pendingMembersModel: root.pendingMembers
|
||||
declinedMembersModel: root.declinedMembers
|
||||
membersModel: root.community.members
|
||||
bannedMembersModel: root.community.bannedMembers
|
||||
pendingMemberRequestsModel: root.community.pendingMemberRequests
|
||||
declinedMemberRequestsModel: root.community.declinedMemberRequests
|
||||
editable: root.isAdmin || root.isOwner || root.isTokenMasterOwner
|
||||
memberRole: community.memberRole
|
||||
communityName: root.community.name
|
||||
|
@ -396,7 +392,7 @@ StatusSectionLayout {
|
|||
|
||||
// Models
|
||||
tokensModel: root.community.communityTokens
|
||||
membersModel: root.joinedMembers
|
||||
membersModel: root.community.members
|
||||
flatNetworks: communityTokensStore.filteredFlatModel
|
||||
accounts: root.walletAccountsModel
|
||||
referenceAssetsBySymbolModel: root.tokensStore.assetsBySymbolModel
|
||||
|
@ -563,7 +559,7 @@ StatusSectionLayout {
|
|||
}
|
||||
}
|
||||
|
||||
membersModel: root.joinedMembers
|
||||
membersModel: community.members
|
||||
enabledChainIds: root.enabledChainIds
|
||||
onEnableNetwork: root.enableNetwork(chainId)
|
||||
|
||||
|
|
|
@ -57,12 +57,15 @@ QObject {
|
|||
},
|
||||
FastExpressionRole {
|
||||
name: "membersCount"
|
||||
expression: model.allMembers.rowCount()
|
||||
expectedRoles: ["allMembers"]
|
||||
expression: model.members.count
|
||||
expectedRoles: ["members"]
|
||||
},
|
||||
ConstantRole {
|
||||
FastExpressionRole {
|
||||
name: "showcaseVisibility"
|
||||
value: Constants.ShowcaseVisibility.Everyone
|
||||
expression: getShowcaseVisibility()
|
||||
function getShowcaseVisibility() {
|
||||
return Constants.ShowcaseVisibility.Everyone
|
||||
}
|
||||
},
|
||||
FastExpressionRole {
|
||||
name: "isShowcaseLoading"
|
||||
|
|
|
@ -55,12 +55,12 @@ QObject {
|
|||
},
|
||||
FastExpressionRole {
|
||||
name: "membersCount"
|
||||
expression: model.allMembers.rowCount()
|
||||
expectedRoles: ["allMembers"]
|
||||
expression: model.members.count
|
||||
expectedRoles: ["members"]
|
||||
},
|
||||
ConstantRole {
|
||||
FastExpressionRole {
|
||||
name: "isShowcaseLoading"
|
||||
value: false
|
||||
expression: false
|
||||
}
|
||||
]
|
||||
filters: ValueFilter {
|
||||
|
|
|
@ -79,7 +79,7 @@ QtObject {
|
|||
|
||||
property var communitiesModuleInst: Global.appIsReady? communitiesModule : null
|
||||
|
||||
readonly property var communitiesList: SortFilterProxyModel {
|
||||
property var communitiesList: SortFilterProxyModel {
|
||||
sourceModel: root.mainModuleInst.sectionsModel
|
||||
filters: ValueFilter {
|
||||
roleName: "sectionType"
|
||||
|
|
|
@ -963,7 +963,7 @@ QtObject {
|
|||
id: importControlNodePopup
|
||||
ImportControlNodePopup {
|
||||
onClosed: destroy()
|
||||
onImportControlNode: root.rootStore.promoteSelfToControlNode(communityId)
|
||||
onImportControlNode: root.rootStore.promoteSelfToControlNode(community.id)
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -63,8 +63,6 @@ Item {
|
|||
asset.height: 32
|
||||
name: model.name ?? ""
|
||||
memberCountVisible: model.joined || !model.encrypted
|
||||
members: model.membersCount
|
||||
activeUsers: model.activeMembersCount
|
||||
banner: model.bannerImageData ?? ""
|
||||
descriptionFontSize: 12
|
||||
descriptionFontColor: Theme.palette.baseColor1
|
||||
|
@ -110,7 +108,7 @@ Item {
|
|||
StatusBaseText {
|
||||
font.pixelSize: Theme.tertiaryTextFontSize
|
||||
color: Theme.palette.successColor1
|
||||
text: qsTr("You're there too")
|
||||
text: qsTr("You’re there too")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1322,17 +1322,16 @@ QtObject {
|
|||
enum CommunityMembershipRequestState {
|
||||
None = 0,
|
||||
Pending,
|
||||
Rejected,
|
||||
Accepted,
|
||||
Canceled,
|
||||
Rejected,
|
||||
AcceptedPending,
|
||||
RejectedPending,
|
||||
AwaitingAddress,
|
||||
Banned,
|
||||
Kicked,
|
||||
BannedPending,
|
||||
UnbannedPending,
|
||||
KickedPending,
|
||||
AwaitingAddress,
|
||||
Unbanned,
|
||||
BannedWithAllMessagesDelete
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue