fix(@desktop/community): add member verified model value

Fixes #7378
This commit is contained in:
PavelS 2022-09-19 14:32:03 +03:00 committed by PavelS
parent a51a980635
commit cee8af5869
8 changed files with 23 additions and 4 deletions

View File

@ -83,6 +83,7 @@ method onNewMessagesLoaded*(self: Module, messages: seq[MessageDto]) =
colorId = contactDetails.colorId, colorId = contactDetails.colorId,
onlineStatus = status, onlineStatus = status,
isContact = contactDetails.details.isContact, isContact = contactDetails.details.isContact,
isVerified = contactDetails.details.isContactVerified(),
isUntrustworthy = contactDetails.details.trustStatus == TrustStatus.Untrustworthy, isUntrustworthy = contactDetails.details.trustStatus == TrustStatus.Untrustworthy,
) )
) )
@ -111,6 +112,7 @@ method contactUpdated*(self: Module, publicKey: string) =
alias = contactDetails.details.alias, alias = contactDetails.details.alias,
icon = contactDetails.icon, icon = contactDetails.icon,
isContact = contactDetails.details.isContact, isContact = contactDetails.details.isContact,
isVerified = contactDetails.details.isContactVerified(),
isUntrustworthy = contactDetails.details.trustStatus == TrustStatus.Untrustworthy, isUntrustworthy = contactDetails.details.trustStatus == TrustStatus.Untrustworthy,
) )
@ -150,6 +152,7 @@ method addChatMember*(self: Module, member: ChatMember) =
colorId = contactDetails.colorId, colorId = contactDetails.colorId,
onlineStatus = status, onlineStatus = status,
isContact = contactDetails.details.isContact, isContact = contactDetails.details.isContact,
isVerified = contactDetails.details.isContactVerified(),
isAdmin = member.admin, isAdmin = member.admin,
joined = member.joined, joined = member.joined,
isUntrustworthy = contactDetails.details.trustStatus == TrustStatus.Untrustworthy isUntrustworthy = contactDetails.details.trustStatus == TrustStatus.Untrustworthy
@ -197,6 +200,7 @@ method onChatMemberUpdated*(self: Module, publicKey: string, admin: bool, joined
alias = contactDetails.details.alias, alias = contactDetails.details.alias,
icon = contactDetails.icon, icon = contactDetails.icon,
isContact = contactDetails.details.isContact, isContact = contactDetails.details.isContact,
isVerified = contactDetails.details.isContactVerified(),
isAdmin = admin, isAdmin = admin,
joined = joined, joined = joined,
isUntrustworthy = contactDetails.details.trustStatus == TrustStatus.Untrustworthy, isUntrustworthy = contactDetails.details.trustStatus == TrustStatus.Untrustworthy,

View File

@ -65,6 +65,7 @@ QtObject:
alias = "", alias = "",
icon = "", icon = "",
colorId = 0, colorId = 0,
isVerified = false,
) )
self.temporaryModel.addItem(userItem) self.temporaryModel.addItem(userItem)

View File

@ -91,6 +91,7 @@ proc createMemberItem(self: Module, memberId, requestId: string): MemberItem =
colorId = contactDetails.colorId, colorId = contactDetails.colorId,
onlineStatus = toOnlineStatus(self.controller.getStatusForContactWithId(memberId).statusType), onlineStatus = toOnlineStatus(self.controller.getStatusForContactWithId(memberId).statusType),
isContact = contactDetails.details.isContact, isContact = contactDetails.details.isContact,
isVerified = contactDetails.details.isContactVerified(),
requestToJoinId = requestId) requestToJoinId = requestId)
method getCommunityItem(self: Module, c: CommunityDto): SectionItem = method getCommunityItem(self: Module, c: CommunityDto): SectionItem =

View File

@ -259,6 +259,7 @@ proc createChannelGroupItem[T](self: Module[T], c: ChannelGroupDto): SectionItem
colorId = contactDetails.colorId, colorId = contactDetails.colorId,
onlineStatus = toOnlineStatus(self.controller.getStatusForContactWithId(member.id).statusType), onlineStatus = toOnlineStatus(self.controller.getStatusForContactWithId(member.id).statusType),
isContact = contactDetails.details.isContact, isContact = contactDetails.details.isContact,
isVerified = contactDetails.details.isContactVerified(),
isAdmin = member.admin isAdmin = member.admin
)), )),
if (isCommunity): communityDetails.pendingRequestsToJoin.map(x => pending_request_item.initItem( if (isCommunity): communityDetails.pendingRequestsToJoin.map(x => pending_request_item.initItem(
@ -282,7 +283,8 @@ proc createChannelGroupItem[T](self: Module[T], c: ChannelGroupDto): SectionItem
icon = contactDetails.icon, icon = contactDetails.icon,
colorId = contactDetails.colorId, colorId = contactDetails.colorId,
onlineStatus = toOnlineStatus(self.controller.getStatusForContactWithId(bannedMemberId).statusType), onlineStatus = toOnlineStatus(self.controller.getStatusForContactWithId(bannedMemberId).statusType),
isContact = contactDetails.details.isContact isContact = contactDetails.details.isContact,
isVerified = contactDetails.details.isContactVerified()
) )
), ),
if (isCommunity): communityDetails.pendingRequestsToJoin.map(proc(requestDto: CommunityMembershipRequestDto): MemberItem = if (isCommunity): communityDetails.pendingRequestsToJoin.map(proc(requestDto: CommunityMembershipRequestDto): MemberItem =
@ -297,6 +299,7 @@ proc createChannelGroupItem[T](self: Module[T], c: ChannelGroupDto): SectionItem
colorId = contactDetails.colorId, colorId = contactDetails.colorId,
onlineStatus = toOnlineStatus(self.controller.getStatusForContactWithId(requestDto.publicKey).statusType), onlineStatus = toOnlineStatus(self.controller.getStatusForContactWithId(requestDto.publicKey).statusType),
isContact = contactDetails.details.isContact, isContact = contactDetails.details.isContact,
isVerified = contactDetails.details.isContactVerified(),
requestToJoinId = requestDto.id requestToJoinId = requestDto.id
) )
) else: @[], ) else: @[],
@ -312,6 +315,7 @@ proc createChannelGroupItem[T](self: Module[T], c: ChannelGroupDto): SectionItem
colorId = contactDetails.colorId, colorId = contactDetails.colorId,
onlineStatus = toOnlineStatus(self.controller.getStatusForContactWithId(requestDto.publicKey).statusType), onlineStatus = toOnlineStatus(self.controller.getStatusForContactWithId(requestDto.publicKey).statusType),
isContact = contactDetails.details.isContact, isContact = contactDetails.details.isContact,
isVerified = contactDetails.details.isContactVerified(),
requestToJoinId = requestDto.id requestToJoinId = requestDto.id
) )
) else: @[] ) else: @[]
@ -826,6 +830,7 @@ method contactUpdated*[T](self: Module[T], publicKey: string) =
contactDetails.details.alias, contactDetails.details.alias,
contactDetails.icon, contactDetails.icon,
isContact = contactDetails.details.isContact, isContact = contactDetails.details.isContact,
isVerified = contactDetails.details.isContactVerified(),
isUntrustworthy = contactDetails.details.isContactUntrustworthy(), isUntrustworthy = contactDetails.details.isContactUntrustworthy(),
) )

View File

@ -228,9 +228,10 @@ QtObject:
alias: string, alias: string,
image: string, image: string,
isContact: bool, isContact: bool,
isVerified: bool,
isUntrustworthy: bool) = isUntrustworthy: bool) =
self.item.updateMember(pubkey, name, ensName, localNickname, alias, image, isContact, self.item.updateMember(pubkey, name, ensName, localNickname, alias, image, isContact,
isUntrustworthy) isVerified, isUntrustworthy)
proc pendingRequestsToJoin(self: ActiveSection): QVariant {.slot.} = proc pendingRequestsToJoin(self: ActiveSection): QVariant {.slot.} =
if (self.item.id == ""): if (self.item.id == ""):

View File

@ -23,7 +23,7 @@ proc initMemberItem*(
colorHash: string = "", colorHash: string = "",
onlineStatus: OnlineStatus = OnlineStatus.Inactive, onlineStatus: OnlineStatus = OnlineStatus.Inactive,
isContact: bool = false, isContact: bool = false,
isVerified: bool = false, isVerified: bool,
isUntrustworthy: bool = false, isUntrustworthy: bool = false,
isBlocked: bool = false, isBlocked: bool = false,
contactRequest: ContactRequest = ContactRequest.None, contactRequest: ContactRequest = ContactRequest.None,

View File

@ -205,6 +205,7 @@ QtObject:
alias: string, alias: string,
icon: string, icon: string,
isContact: bool, isContact: bool,
isVerified: bool,
isAdmin: bool, isAdmin: bool,
joined: bool, joined: bool,
isUntrustworthy: bool, isUntrustworthy: bool,
@ -219,6 +220,7 @@ QtObject:
self.items[ind].alias = alias self.items[ind].alias = alias
self.items[ind].icon = icon self.items[ind].icon = icon
self.items[ind].isContact = isContact self.items[ind].isContact = isContact
self.items[ind].isVerified = isVerified
self.items[ind].isAdmin = isAdmin self.items[ind].isAdmin = isAdmin
self.items[ind].joined = joined self.items[ind].joined = joined
self.items[ind].isUntrustworthy = isUntrustworthy self.items[ind].isUntrustworthy = isUntrustworthy
@ -231,6 +233,7 @@ QtObject:
ModelRole.Alias.int, ModelRole.Alias.int,
ModelRole.Icon.int, ModelRole.Icon.int,
ModelRole.IsContact.int, ModelRole.IsContact.int,
ModelRole.IsVerified.int,
ModelRole.IsAdmin.int, ModelRole.IsAdmin.int,
ModelRole.Joined.int, ModelRole.Joined.int,
ModelRole.IsUntrustworthy.int, ModelRole.IsUntrustworthy.int,
@ -245,6 +248,7 @@ QtObject:
alias: string, alias: string,
icon: string, icon: string,
isContact: bool, isContact: bool,
isVerified: bool,
isUntrustworthy: bool, isUntrustworthy: bool,
) = ) =
let ind = self.findIndexForMember(pubKey) let ind = self.findIndexForMember(pubKey)
@ -257,6 +261,7 @@ QtObject:
self.items[ind].alias = alias self.items[ind].alias = alias
self.items[ind].icon = icon self.items[ind].icon = icon
self.items[ind].isContact = isContact self.items[ind].isContact = isContact
self.items[ind].isVerified = isVerified
self.items[ind].isUntrustworthy = isUntrustworthy self.items[ind].isUntrustworthy = isUntrustworthy
let index = self.createIndex(ind, 0, nil) let index = self.createIndex(ind, 0, nil)
@ -267,6 +272,7 @@ QtObject:
ModelRole.Alias.int, ModelRole.Alias.int,
ModelRole.Icon.int, ModelRole.Icon.int,
ModelRole.IsContact.int, ModelRole.IsContact.int,
ModelRole.IsVerified.int,
ModelRole.IsUntrustworthy.int, ModelRole.IsUntrustworthy.int,
]) ])

View File

@ -261,9 +261,10 @@ proc updateMember*(
alias: string, alias: string,
image: string, image: string,
isContact: bool, isContact: bool,
isVerified: bool,
isUntrustworthy: bool) = isUntrustworthy: bool) =
self.membersModel.updateItem(pubkey, name, ensName, nickname, alias, image, isContact, self.membersModel.updateItem(pubkey, name, ensName, nickname, alias, image, isContact,
isUntrustworthy) isVerified, isUntrustworthy)
proc bannedMembers*(self: SectionItem): member_model.Model {.inline.} = proc bannedMembers*(self: SectionItem): member_model.Model {.inline.} =
self.bannedMembersModel self.bannedMembersModel