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

View File

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

View File

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

View File

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

View File

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

View File

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