fix(cr): fix context menus not containing the contact request info

Fixes #16952
This commit is contained in:
Jonathan Rainville 2024-12-17 15:12:29 -05:00
parent b9501327aa
commit be285b3dc6
6 changed files with 17 additions and 3 deletions

View File

@ -97,8 +97,9 @@ method contactUpdated*(self: Module, publicKey: string) =
alias = contactDetails.dto.alias,
icon = contactDetails.icon,
isContact = contactDetails.dto.isContact,
trustStatus = contactDetails.dto.trustStatus,
isBlocked = contactDetails.dto.isBlocked,
trustStatus = contactDetails.dto.trustStatus,
contactRequest = toContactStatus(contactDetails.dto.contactRequestState),
)
method userProfileUpdated*(self: Module) =
@ -152,6 +153,7 @@ proc processChatMember(self: Module, member: ChatMember, reset: bool = false):
isContact = contactDetails.dto.isContact,
isBlocked = contactDetails.dto.isBlocked,
isCurrentUser = isMe,
contactRequest = toContactStatus(contactDetails.dto.contactRequestState),
memberRole = member.role,
joined = member.joined,
trustStatus = contactDetails.dto.trustStatus,
@ -208,6 +210,7 @@ method onChatMemberUpdated*(self: Module, publicKey: string, memberRole: MemberR
memberRole,
joined,
trustStatus = contactDetails.dto.trustStatus,
contactRequest = toContactStatus(contactDetails.dto.contactRequestState),
)
method addGroupMembers*(self: Module, pubKeys: seq[string]) =

View File

@ -1897,6 +1897,7 @@ proc createMemberItem[T](
isBlocked = contactDetails.dto.isBlocked,
isCurrentUser = contactDetails.isCurrentUser,
trustStatus = contactDetails.dto.trustStatus,
contactRequest = toContactStatus(contactDetails.dto.contactRequestState),
memberRole = role,
membershipRequestState = state,
requestToJoinId = requestId,
@ -1916,6 +1917,7 @@ method contactUpdated*[T](self: Module[T], contactId: string) =
isContact = contactDetails.dto.isContact,
isBlocked = contactDetails.dto.isBlocked,
trustStatus = contactDetails.dto.trustStatus,
contactRequest = toContactStatus(contactDetails.dto.contactRequestState),
)
{.pop.}

View File

@ -293,6 +293,7 @@ QtObject:
joined: bool,
membershipRequestState: MembershipRequestState = MembershipRequestState.None,
trustStatus: TrustStatus,
contactRequest: ContactRequest,
callDataChanged: bool = true,
): seq[int] =
let ind = self.findIndexForMember(pubKey)
@ -318,6 +319,7 @@ QtObject:
updateRole(joined, Joined)
updateRole(trustStatus, TrustStatus)
updateRole(isBlocked, IsBlocked)
updateRole(contactRequest, ContactRequest)
var updatedMembershipRequestState = membershipRequestState
if updatedMembershipRequestState == MembershipRequestState.None:
@ -364,6 +366,7 @@ QtObject:
item.joined,
item.membershipRequestState,
item.trustStatus,
item.contactRequest,
callDataChanged = false,
)
@ -432,6 +435,7 @@ QtObject:
isContact: bool,
isBlocked: bool,
trustStatus: TrustStatus,
contactRequest: ContactRequest
) =
let ind = self.findIndexForMember(pubKey)
if ind == -1:
@ -451,6 +455,7 @@ QtObject:
joined = self.items[ind].joined,
self.items[ind].membershipRequestState,
trustStatus,
contactRequest,
)
proc setOnlineStatus*(self: Model, pubKey: string, onlineStatus: OnlineStatus) =

View File

@ -346,6 +346,7 @@ QtObject:
isContact: bool,
isBlocked: bool,
trustStatus: TrustStatus,
contactRequest: ContactRequest,
) =
for item in self.items:
item.members.updateItem(
@ -359,6 +360,7 @@ QtObject:
isContact,
isBlocked,
trustStatus,
contactRequest,
)
proc getNthEnabledItem*(self: SectionModel, nth: int): SectionItem =

View File

@ -44,9 +44,11 @@ suite "updating member items":
alias = "",
icon = "",
isContact = false,
isBlocked = false,
memberRole = MemberRole.None,
joined = false,
trustStatus = TrustStatus.Unknown,
contactRequest = ContactRequest.None,
callDataChanged = false,
)
# Two updated roles, because preferredDisplayName gets updated too
@ -64,9 +66,11 @@ suite "updating member items":
alias = "",
icon = "icon",
isContact = true,
isBlocked = false,
memberRole = MemberRole.None,
joined = false,
trustStatus = TrustStatus.Unknown,
contactRequest = ContactRequest.None,
callDataChanged = false,
)
check(updatedRoles.len() == 2)

View File

@ -196,8 +196,6 @@ Item {
id: profileContextMenuComponent
ProfileContextMenu {
id: profileContextMenu
property string pubKey
margins: 8