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,
onlineStatus = status,
isContact = contactDetails.details.isContact,
isVerified = contactDetails.details.isContactVerified(),
isUntrustworthy = contactDetails.details.trustStatus == TrustStatus.Untrustworthy,
)
)
@ -111,6 +112,7 @@ method contactUpdated*(self: Module, publicKey: string) =
alias = contactDetails.details.alias,
icon = contactDetails.icon,
isContact = contactDetails.details.isContact,
isVerified = contactDetails.details.isContactVerified(),
isUntrustworthy = contactDetails.details.trustStatus == TrustStatus.Untrustworthy,
)
@ -150,6 +152,7 @@ method addChatMember*(self: Module, member: ChatMember) =
colorId = contactDetails.colorId,
onlineStatus = status,
isContact = contactDetails.details.isContact,
isVerified = contactDetails.details.isContactVerified(),
isAdmin = member.admin,
joined = member.joined,
isUntrustworthy = contactDetails.details.trustStatus == TrustStatus.Untrustworthy
@ -197,6 +200,7 @@ method onChatMemberUpdated*(self: Module, publicKey: string, admin: bool, joined
alias = contactDetails.details.alias,
icon = contactDetails.icon,
isContact = contactDetails.details.isContact,
isVerified = contactDetails.details.isContactVerified(),
isAdmin = admin,
joined = joined,
isUntrustworthy = contactDetails.details.trustStatus == TrustStatus.Untrustworthy,

View File

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

View File

@ -91,6 +91,7 @@ proc createMemberItem(self: Module, memberId, requestId: string): MemberItem =
colorId = contactDetails.colorId,
onlineStatus = toOnlineStatus(self.controller.getStatusForContactWithId(memberId).statusType),
isContact = contactDetails.details.isContact,
isVerified = contactDetails.details.isContactVerified(),
requestToJoinId = requestId)
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,
onlineStatus = toOnlineStatus(self.controller.getStatusForContactWithId(member.id).statusType),
isContact = contactDetails.details.isContact,
isVerified = contactDetails.details.isContactVerified(),
isAdmin = member.admin
)),
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,
colorId = contactDetails.colorId,
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 =
@ -297,6 +299,7 @@ proc createChannelGroupItem[T](self: Module[T], c: ChannelGroupDto): SectionItem
colorId = contactDetails.colorId,
onlineStatus = toOnlineStatus(self.controller.getStatusForContactWithId(requestDto.publicKey).statusType),
isContact = contactDetails.details.isContact,
isVerified = contactDetails.details.isContactVerified(),
requestToJoinId = requestDto.id
)
) else: @[],
@ -312,6 +315,7 @@ proc createChannelGroupItem[T](self: Module[T], c: ChannelGroupDto): SectionItem
colorId = contactDetails.colorId,
onlineStatus = toOnlineStatus(self.controller.getStatusForContactWithId(requestDto.publicKey).statusType),
isContact = contactDetails.details.isContact,
isVerified = contactDetails.details.isContactVerified(),
requestToJoinId = requestDto.id
)
) else: @[]
@ -826,6 +830,7 @@ method contactUpdated*[T](self: Module[T], publicKey: string) =
contactDetails.details.alias,
contactDetails.icon,
isContact = contactDetails.details.isContact,
isVerified = contactDetails.details.isContactVerified(),
isUntrustworthy = contactDetails.details.isContactUntrustworthy(),
)

View File

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

View File

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

View File

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

View File

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