remove old code about ID verification and fix trustStatus bug (#16548)

* chore: remove old code about ID verification

* refactor(trust): remove untrustowrthy and isVerified from items and use trustStatus

* chore(status-go): up status-go to get fix for trustStatus reseting

Fixes #16392

* chore: remove verified/trusted profile showcase category
This commit is contained in:
Jonathan Rainville 2024-10-29 14:08:12 -04:00 committed by GitHub
parent f2883fdcee
commit d511c25d2e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
71 changed files with 155 additions and 1668 deletions

View File

@ -292,12 +292,6 @@ QtObject:
self.notificationCheck(title, message, details, self.settingsService.getNotifSettingContactRequests()) self.notificationCheck(title, message, details, self.settingsService.getNotifSettingContactRequests())
return return
# In case of identity verification request
elif(details.notificationType == NotificationType.IdentityVerificationRequest):
if(self.settingsService.getNotifSettingIdentityVerificationRequests() != VALUE_NOTIF_TURN_OFF):
self.notificationCheck(title, message, details, self.settingsService.getNotifSettingIdentityVerificationRequests())
return
# In case of new message (regardless it's message with mention or not) # In case of new message (regardless it's message with mention or not)
elif(details.notificationType == NotificationType.NewMessage or elif(details.notificationType == NotificationType.NewMessage or
details.notificationType == NotificationType.NewMessageWithPersonalMention or details.notificationType == NotificationType.NewMessageWithPersonalMention or

View File

@ -30,7 +30,6 @@ type MessageSignal* = ref object of Signal
currentStatus*: seq[StatusUpdateDto] currentStatus*: seq[StatusUpdateDto]
settings*: seq[SettingsFieldDto] settings*: seq[SettingsFieldDto]
clearedHistories*: seq[ClearedHistoryDto] clearedHistories*: seq[ClearedHistoryDto]
verificationRequests*: seq[VerificationRequest]
savedAddresses*: seq[SavedAddressDto] savedAddresses*: seq[SavedAddressDto]
keypairs*: seq[KeypairDto] keypairs*: seq[KeypairDto]
watchOnlyAccounts*: seq[WalletAccountDto] watchOnlyAccounts*: seq[WalletAccountDto]
@ -134,10 +133,6 @@ proc fromEvent*(T: type MessageSignal, event: JsonNode): MessageSignal =
for jsonSettingsField in e["settings"]: for jsonSettingsField in e["settings"]:
signal.settings.add(jsonSettingsField.toSettingsFieldDto()) signal.settings.add(jsonSettingsField.toSettingsFieldDto())
if e.contains("verificationRequests"):
for jsonVerificationRequest in e["verificationRequests"]:
signal.verificationRequests.add(jsonVerificationRequest.toVerificationRequest())
if e.contains("savedAddresses"): if e.contains("savedAddresses"):
for jsonSavedAddress in e["savedAddresses"]: for jsonSavedAddress in e["savedAddresses"]:
signal.savedAddresses.add(jsonSavedAddress.toSavedAddressDto()) signal.savedAddresses.add(jsonSavedAddress.toSavedAddressDto())

View File

@ -12,7 +12,6 @@ type Item* = ref object
chatId: string chatId: string
communityId: string communityId: string
membershipStatus: ActivityCenterMembershipStatus membershipStatus: ActivityCenterMembershipStatus
verificationStatus: VerificationStatus
sectionId: string sectionId: string
name: string name: string
author: string author: string
@ -32,7 +31,6 @@ proc initItem*(
chatId: string, chatId: string,
communityId: string, communityId: string,
membershipStatus: ActivityCenterMembershipStatus, membershipStatus: ActivityCenterMembershipStatus,
verificationStatus: VerificationStatus,
sectionId: string, sectionId: string,
name: string, name: string,
author: string, author: string,
@ -52,7 +50,6 @@ proc initItem*(
result.chatId = chatId result.chatId = chatId
result.communityId = communityId result.communityId = communityId
result.membershipStatus = membershipStatus result.membershipStatus = membershipStatus
result.verificationStatus = verificationStatus
result.sectionId = sectionId result.sectionId = sectionId
result.name = name result.name = name
result.author = author result.author = author
@ -74,7 +71,6 @@ proc `$`*(self: Item): string =
chatId: {$self.chatId}, chatId: {$self.chatId},
communityId: {$self.communityId}, communityId: {$self.communityId},
membershipStatus: {$self.membershipStatus.int}, membershipStatus: {$self.membershipStatus.int},
verificationStatus: {$self.verificationStatus.int},
sectionId: {$self.sectionId}, sectionId: {$self.sectionId},
author: {$self.author}, author: {$self.author},
installationId: {$self.installationId}, installationId: {$self.installationId},
@ -112,9 +108,6 @@ proc communityId*(self: Item): string =
proc membershipStatus*(self: Item): ActivityCenterMembershipStatus = proc membershipStatus*(self: Item): ActivityCenterMembershipStatus =
return self.membershipStatus return self.membershipStatus
proc verificationStatus*(self: Item): VerificationStatus =
return self.verificationStatus
proc sectionId*(self: Item): string = proc sectionId*(self: Item): string =
return self.sectionId return self.sectionId

View File

@ -7,7 +7,6 @@ type
ChatId ChatId
CommunityId CommunityId
MembershipStatus MembershipStatus
VerificationStatus
SectionId SectionId
Name Name
NotificationType NotificationType
@ -70,7 +69,6 @@ QtObject:
of NotifRoles.ChatId: result = newQVariant(activityNotificationItem.chatId) of NotifRoles.ChatId: result = newQVariant(activityNotificationItem.chatId)
of NotifRoles.CommunityId: result = newQVariant(activityNotificationItem.communityId) of NotifRoles.CommunityId: result = newQVariant(activityNotificationItem.communityId)
of NotifRoles.MembershipStatus: result = newQVariant(activityNotificationItem.membershipStatus.int) of NotifRoles.MembershipStatus: result = newQVariant(activityNotificationItem.membershipStatus.int)
of NotifRoles.VerificationStatus: result = newQVariant(activityNotificationItem.verificationStatus.int)
of NotifRoles.SectionId: result = newQVariant(activityNotificationItem.sectionId) of NotifRoles.SectionId: result = newQVariant(activityNotificationItem.sectionId)
of NotifRoles.Name: result = newQVariant(activityNotificationItem.name) of NotifRoles.Name: result = newQVariant(activityNotificationItem.name)
of NotifRoles.Author: result = newQVariant(activityNotificationItem.author) of NotifRoles.Author: result = newQVariant(activityNotificationItem.author)
@ -98,7 +96,6 @@ QtObject:
NotifRoles.ChatId.int:"chatId", NotifRoles.ChatId.int:"chatId",
NotifRoles.CommunityId.int:"communityId", NotifRoles.CommunityId.int:"communityId",
NotifRoles.MembershipStatus.int: "membershipStatus", NotifRoles.MembershipStatus.int: "membershipStatus",
NotifRoles.VerificationStatus.int: "verificationStatus",
NotifRoles.SectionId.int: "sectionId", NotifRoles.SectionId.int: "sectionId",
NotifRoles.Name.int: "name", NotifRoles.Name.int: "name",
NotifRoles.Author.int: "author", NotifRoles.Author.int: "author",

View File

@ -207,7 +207,6 @@ method convertToItems*(
notification.chatId, notification.chatId,
notification.communityId, notification.communityId,
notification.membershipStatus, notification.membershipStatus,
notification.verificationStatus,
sectionId, sectionId,
notification.name, notification.name,
notification.author, notification.author,

View File

@ -194,13 +194,6 @@ QtObject:
read = getContactRequestsCount read = getContactRequestsCount
notify = groupCountersChanged notify = groupCountersChanged
proc getIdentityVerificationCount*(self: View): int {.slot.} =
return self.groupCounters.getOrDefault(ActivityCenterGroup.IdentityVerification, 0)
QtProperty[int] identityVerificationCount:
read = getIdentityVerificationCount
notify = groupCountersChanged
proc getMembershipCount*(self: View): int {.slot.} = proc getMembershipCount*(self: View): int {.slot.} =
return self.groupCounters.getOrDefault(ActivityCenterGroup.Membership, 0) return self.groupCounters.getOrDefault(ActivityCenterGroup.Membership, 0)

View File

@ -1,4 +1,5 @@
import NimQml import NimQml
import ../../../../../app_service/common/types
QtObject: QtObject:
@ -19,7 +20,7 @@ QtObject:
highlight: bool highlight: bool
muted: bool muted: bool
position: int position: int
isUntrustworthy: bool trustStatus: TrustStatus
isContact: bool isContact: bool
active: bool active: bool
blocked: bool blocked: bool
@ -51,7 +52,7 @@ QtObject:
notificationsCount: int, notificationsCount: int,
highlight, muted: bool, highlight, muted: bool,
position: int, position: int,
isUntrustworthy: bool, trustStatus: TrustStatus,
isContact: bool = false, isContact: bool = false,
blocked: bool = false, blocked: bool = false,
canPost: bool = true, canPost: bool = true,
@ -75,7 +76,7 @@ QtObject:
self.highlight = highlight self.highlight = highlight
self.muted = muted self.muted = muted
self.position = position self.position = position
self.isUntrustworthy = isUntrustworthy self.trustStatus = trustStatus
self.isContact = isContact self.isContact = isContact
self.active = false self.active = false
self.blocked = blocked self.blocked = blocked
@ -251,15 +252,23 @@ QtObject:
proc isUntrustworthyChanged(self: ChatDetails) {.signal.} proc isUntrustworthyChanged(self: ChatDetails) {.signal.}
proc getIsUntrustworthy(self: ChatDetails): bool {.slot.} = proc getIsUntrustworthy(self: ChatDetails): bool {.slot.} =
return self.isUntrustworthy return self.trustStatus == TrustStatus.Untrustworthy
QtProperty[bool] isUntrustworthy: QtProperty[bool] isUntrustworthy:
read = getIsUntrustworthy read = getIsUntrustworthy
notify = isUntrustworthyChanged notify = isUntrustworthyChanged
proc setIsUntrustworthy*(self: ChatDetails, value: bool) = # this is not a slot proc trustStatusChanged(self: ChatDetails) {.signal.}
if self.isUntrustworthy == value: proc getTrustStatus(self: ChatDetails): int {.slot.} =
return self.trustStatus.int
QtProperty[int] trustStatus:
read = getTrustStatus
notify = trustStatusChanged
proc setTrustStatus*(self: ChatDetails, value: TrustStatus) = # this is not a slot
if self.trustStatus == value:
return return
self.isUntrustworthy = value self.trustStatus = value
self.trustStatusChanged()
self.isUntrustworthyChanged() self.isUntrustworthyChanged()
proc activeChanged(self: ChatDetails) {.signal.} proc activeChanged(self: ChatDetails) {.signal.}

View File

@ -81,7 +81,7 @@ method load*(self: Module, chatItem: chat_item.Item) =
var chatImage = chatItem.icon var chatImage = chatItem.icon
var isContact = false var isContact = false
var trustStatus = TrustStatus.Unknown var trustStatus = TrustStatus.Unknown
if(chatItem.`type` == ChatType.OneToOne.int): if chatItem.`type` == ChatType.OneToOne.int:
let contactDto = self.controller.getContactById(self.controller.getMyChatId()) let contactDto = self.controller.getContactById(self.controller.getMyChatId())
chatName = contactDto.userDefaultDisplayName() chatName = contactDto.userDefaultDisplayName()
isContact = contactDto.isContact isContact = contactDto.isContact
@ -95,7 +95,7 @@ method load*(self: Module, chatItem: chat_item.Item) =
self.view.chatDetails.setChatDetails(chatItem.id, chatItem.`type`, self.controller.belongsToCommunity(), self.view.chatDetails.setChatDetails(chatItem.id, chatItem.`type`, self.controller.belongsToCommunity(),
self.controller.isUsersListAvailable(), chatName, chatImage, self.controller.isUsersListAvailable(), chatName, chatImage,
chatItem.color, chatItem.description, chatItem.emoji, chatItem.hasUnreadMessages, chatItem.notificationsCount, chatItem.color, chatItem.description, chatItem.emoji, chatItem.hasUnreadMessages, chatItem.notificationsCount,
chatItem.highlight, chatItem.muted, chatItem.position, isUntrustworthy = trustStatus == TrustStatus.Untrustworthy, chatItem.highlight, chatItem.muted, chatItem.position, trustStatus,
isContact, chatItem.blocked, chatItem.canPost, chatItem.canView, chatItem.canPostReactions, isContact, chatItem.blocked, chatItem.canPost, chatItem.canView, chatItem.canPostReactions,
chatItem.hideIfPermissionsNotMet, chatItem.missingEncryptionKey, chatItem.requiresPermissions) chatItem.hideIfPermissionsNotMet, chatItem.missingEncryptionKey, chatItem.requiresPermissions)
@ -362,9 +362,9 @@ method onContactDetailsUpdated*(self: Module, contactId: string) =
let communityChats = self.controller.getCommunityDetails().chats let communityChats = self.controller.getCommunityDetails().chats
item.messageText = self.controller.getRenderedText(item.parsedText, communityChats) item.messageText = self.controller.getRenderedText(item.parsedText, communityChats)
if(self.controller.getMyChatId() == contactId): if self.controller.getMyChatId() == contactId:
self.view.updateChatDetailsNameAndIcon(updatedContact.defaultDisplayName, updatedContact.icon) self.view.updateChatDetailsNameAndIcon(updatedContact.defaultDisplayName, updatedContact.icon)
self.view.updateTrustStatus(updatedContact.dto.trustStatus == TrustStatus.Untrustworthy) self.view.updateTrustStatus(updatedContact.dto.trustStatus)
self.view.updateChatBlocked(updatedContact.dto.blocked) self.view.updateChatBlocked(updatedContact.dto.blocked)
method onNotificationsUpdated*(self: Module, hasUnreadMessages: bool, notificationCount: int) = method onNotificationsUpdated*(self: Module, hasUnreadMessages: bool, notificationCount: int) =

View File

@ -88,7 +88,6 @@ method contactUpdated*(self: Module, publicKey: string) =
if self.isPublicCommunityChannel: if self.isPublicCommunityChannel:
return return
let contactDetails = self.controller.getContactDetails(publicKey) let contactDetails = self.controller.getContactDetails(publicKey)
let isMe = publicKey == singletonInstance.userProfile.getPubKey()
self.view.model().updateItem( self.view.model().updateItem(
pubKey = publicKey, pubKey = publicKey,
displayName = contactDetails.dto.displayName, displayName = contactDetails.dto.displayName,
@ -98,8 +97,7 @@ 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,
isVerified = not isMe and contactDetails.dto.isContactVerified(), trustStatus = contactDetails.dto.trustStatus,
isUntrustworthy = contactDetails.dto.trustStatus == TrustStatus.Untrustworthy,
) )
method userProfileUpdated*(self: Module) = method userProfileUpdated*(self: Module) =
@ -151,10 +149,10 @@ proc processChatMember(self: Module, member: ChatMember, reset: bool = false):
colorHash = contactDetails.colorHash, colorHash = contactDetails.colorHash,
onlineStatus = status, onlineStatus = status,
isContact = contactDetails.dto.isContact, isContact = contactDetails.dto.isContact,
isVerified = not isMe and contactDetails.dto.isContactVerified(), isCurrentUser = isMe,
memberRole = member.role, memberRole = member.role,
joined = member.joined, joined = member.joined,
isUntrustworthy = contactDetails.dto.trustStatus == TrustStatus.Untrustworthy, trustStatus = contactDetails.dto.trustStatus,
) )
method onChatMembersAdded*(self: Module, ids: seq[string]) = method onChatMembersAdded*(self: Module, ids: seq[string]) =
@ -195,7 +193,6 @@ method onChatMemberUpdated*(self: Module, publicKey: string, memberRole: MemberR
if self.isPublicCommunityChannel: if self.isPublicCommunityChannel:
return return
let contactDetails = self.controller.getContactDetails(publicKey) let contactDetails = self.controller.getContactDetails(publicKey)
let isMe = publicKey == singletonInstance.userProfile.getPubKey()
discard self.view.model().updateItem( discard self.view.model().updateItem(
pubKey = publicKey, pubKey = publicKey,
displayName = contactDetails.dto.displayName, displayName = contactDetails.dto.displayName,
@ -205,10 +202,9 @@ method onChatMemberUpdated*(self: Module, publicKey: string, memberRole: MemberR
alias = contactDetails.dto.alias, alias = contactDetails.dto.alias,
icon = contactDetails.icon, icon = contactDetails.icon,
isContact = contactDetails.dto.isContact, isContact = contactDetails.dto.isContact,
isVerified = not isMe and contactDetails.dto.isContactVerified(),
memberRole, memberRole,
joined, joined,
isUntrustworthy = contactDetails.dto.trustStatus == TrustStatus.Untrustworthy, trustStatus = contactDetails.dto.trustStatus,
) )
method addGroupMembers*(self: Module, pubKeys: seq[string]) = method addGroupMembers*(self: Module, pubKeys: seq[string]) =

View File

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

View File

@ -1,6 +1,7 @@
import NimQml import NimQml
import ../../../shared_models/message_model as pinned_msg_model import ../../../shared_models/message_model as pinned_msg_model
import ../item as chat_item import ../item as chat_item
import ../../../../../app_service/common/types
import io_interface import io_interface
import chat_details import chat_details
@ -112,8 +113,8 @@ QtObject:
self.updateChatDetailsNameAndIcon(name, icon) self.updateChatDetailsNameAndIcon(name, icon)
self.chatDetails.setColor(color) self.chatDetails.setColor(color)
proc updateTrustStatus*(self: View, isUntrustworthy: bool) = proc updateTrustStatus*(self: View, trustStatus: TrustStatus) =
self.chatDetails.setIsUntrustworthy(isUntrustworthy) self.chatDetails.setTrustStatus(trustStatus)
proc updateChatDetailsNotifications*(self: View, hasUnreadMessages: bool, notificationCount: int) = proc updateChatDetailsNotifications*(self: View, hasUnreadMessages: bool, notificationCount: int) =
self.chatDetails.setHasUnreadMessages(hasUnreadMessages) self.chatDetails.setHasUnreadMessages(hasUnreadMessages)

View File

@ -1,7 +1,6 @@
import NimQml, Tables, strutils, stew/shims/strformat, json, sequtils, system import NimQml, Tables, strutils, stew/shims/strformat, json, sequtils, system
import ../../../../app_service/common/types import ../../../../app_service/common/types
import ../../../../app_service/service/chat/dto/chat import ../../../../app_service/service/chat/dto/chat
from ../../../../app_service/service/contacts/dto/contacts import TrustStatus
import item import item
import ../../../global/utils as utils import ../../../global/utils as utils
import ../../../global/global_singleton import ../../../global/global_singleton

View File

@ -368,8 +368,7 @@ proc createItemFromPublicKey(self: Module, publicKey: string): UserItem =
colorHash = if not contactDetails.dto.ensVerified: contactDetails.colorHash else: "", colorHash = if not contactDetails.dto.ensVerified: contactDetails.colorHash else: "",
onlineStatus = toOnlineStatus(self.controller.getStatusForContactWithId(publicKey).statusType), onlineStatus = toOnlineStatus(self.controller.getStatusForContactWithId(publicKey).statusType),
isContact = contactDetails.dto.isContact(), isContact = contactDetails.dto.isContact(),
isVerified = contactDetails.dto.isContactVerified(), trustStatus = contactDetails.dto.trustStatus,
isUntrustworthy = contactDetails.dto.isContactUntrustworthy(),
isBlocked = contactDetails.dto.isBlocked(), isBlocked = contactDetails.dto.isBlocked(),
) )

View File

@ -193,7 +193,7 @@ proc createMemberItem(self: Module, memberId, requestId: string, status: Members
colorHash = contactDetails.colorHash, colorHash = contactDetails.colorHash,
onlineStatus = toOnlineStatus(self.controller.getStatusForContactWithId(memberId).statusType), onlineStatus = toOnlineStatus(self.controller.getStatusForContactWithId(memberId).statusType),
isContact = contactDetails.dto.isContact, isContact = contactDetails.dto.isContact,
isVerified = contactDetails.dto.isContactVerified(), trustStatus = contactDetails.dto.trustStatus,
requestToJoinId = requestId, requestToJoinId = requestId,
membershipRequestState = status, membershipRequestState = status,
) )

View File

@ -565,9 +565,6 @@ proc spectateCommunity*(self: Controller, communityId: string) =
proc getStatusForContactWithId*(self: Controller, publicKey: string): StatusUpdateDto = proc getStatusForContactWithId*(self: Controller, publicKey: string): StatusUpdateDto =
return self.contactsService.getStatusForContactWithId(publicKey) return self.contactsService.getStatusForContactWithId(publicKey)
proc getVerificationRequestFrom*(self: Controller, publicKey: string): VerificationRequest =
self.contactsService.getVerificationRequestFrom(publicKey)
proc getCommunityTokensDetailsAsync*(self: Controller, communityId: string) = proc getCommunityTokensDetailsAsync*(self: Controller, communityId: string) =
self.communityTokensService.getCommunityTokensDetailsAsync(communityId) self.communityTokensService.getCommunityTokensDetailsAsync(communityId)

View File

@ -284,9 +284,6 @@ method onStatusUrlRequested*(self: AccessInterface, action: StatusUrlAction, com
url: string, userId: string, shard: Shard) {.base.} = url: string, userId: string, shard: Shard) {.base.} =
raise newException(ValueError, "No implementation available") raise newException(ValueError, "No implementation available")
method getVerificationRequestFrom*(self: AccessInterface, publicKey: string): VerificationRequest {.base.} =
raise newException(ValueError, "No implementation available")
method getKeycardSharedModuleForAuthenticationOrSigning*(self: AccessInterface): QVariant {.base.} = method getKeycardSharedModuleForAuthenticationOrSigning*(self: AccessInterface): QVariant {.base.} =
raise newException(ValueError, "No implementation available") raise newException(ValueError, "No implementation available")

View File

@ -1112,9 +1112,6 @@ method onCommunityMuted*[T](
muted: bool) = muted: bool) =
self.view.model.setMuted(communityId, muted) self.view.model.setMuted(communityId, muted)
method getVerificationRequestFrom*[T](self: Module[T], publicKey: string): VerificationRequest =
self.controller.getVerificationRequestFrom(publicKey)
method getContactDetailsAsJson*[T](self: Module[T], publicKey: string, getVerificationRequest: bool = false, method getContactDetailsAsJson*[T](self: Module[T], publicKey: string, getVerificationRequest: bool = false,
getOnlineStatus: bool = false, includeDetails: bool = false): string = getOnlineStatus: bool = false, includeDetails: bool = false): string =
var contactDetails: ContactDetails var contactDetails: ContactDetails
@ -1155,10 +1152,7 @@ method getContactDetailsAsJson*[T](self: Module[T], publicKey: string, getVerifi
"isSyncing": contactDetails.dto.isSyncing, "isSyncing": contactDetails.dto.isSyncing,
"removed": contactDetails.dto.removed, "removed": contactDetails.dto.removed,
"trustStatus": contactDetails.dto.trustStatus.int, "trustStatus": contactDetails.dto.trustStatus.int,
# TODO rename verificationStatus to outgoingVerificationStatus
"contactRequestState": contactDetails.dto.contactRequestState.int, "contactRequestState": contactDetails.dto.contactRequestState.int,
"verificationStatus": contactDetails.dto.verificationStatus.int,
"incomingVerificationStatus": 0,
"bio": contactDetails.dto.bio, "bio": contactDetails.dto.bio,
"onlineStatus": onlineStatus.int "onlineStatus": onlineStatus.int
} }
@ -1749,7 +1743,7 @@ proc createMemberItem[T](
colorHash = contactDetails.colorHash, colorHash = contactDetails.colorHash,
onlineStatus = toOnlineStatus(status.statusType), onlineStatus = toOnlineStatus(status.statusType),
isContact = contactDetails.dto.isContact, isContact = contactDetails.dto.isContact,
isVerified = contactDetails.dto.isContactVerified(), trustStatus = contactDetails.dto.trustStatus,
memberRole = role, memberRole = role,
membershipRequestState = state, membershipRequestState = state,
requestToJoinId = requestId, requestToJoinId = requestId,
@ -1758,7 +1752,6 @@ proc createMemberItem[T](
method contactUpdated*[T](self: Module[T], contactId: string) = method contactUpdated*[T](self: Module[T], contactId: string) =
let contactDetails = self.controller.getContactDetails(contactId) let contactDetails = self.controller.getContactDetails(contactId)
let isMe = contactId == singletonInstance.userProfile.getPubKey()
self.view.model().updateMemberItemInSections( self.view.model().updateMemberItemInSections(
pubKey = contactId, pubKey = contactId,
displayName = contactDetails.dto.displayName, displayName = contactDetails.dto.displayName,
@ -1768,8 +1761,7 @@ method contactUpdated*[T](self: Module[T], contactId: string) =
alias = contactDetails.dto.alias, alias = contactDetails.dto.alias,
icon = contactDetails.icon, icon = contactDetails.icon,
isContact = contactDetails.dto.isContact, isContact = contactDetails.dto.isContact,
isVerified = not isMe and contactDetails.dto.isContactVerified(), trustStatus = contactDetails.dto.trustStatus,
isUntrustworthy = contactDetails.dto.trustStatus == TrustStatus.Untrustworthy,
) )
{.pop.} {.pop.}

View File

@ -52,27 +52,15 @@ proc init*(self: Controller) =
self.events.on(SIGNAL_CONTACT_UNTRUSTWORTHY) do(e: Args): self.events.on(SIGNAL_CONTACT_UNTRUSTWORTHY) do(e: Args):
var args = TrustArgs(e) var args = TrustArgs(e)
self.delegate.contactTrustStatusChanged(args.publicKey, args.isUntrustworthy) self.delegate.contactTrustStatusChanged(args.publicKey, args.trustStatus)
self.events.on(SIGNAL_CONTACT_TRUSTED) do(e: Args): self.events.on(SIGNAL_CONTACT_TRUSTED) do(e: Args):
var args = TrustArgs(e) var args = TrustArgs(e)
self.delegate.contactTrustStatusChanged(args.publicKey, args.isUntrustworthy) self.delegate.contactTrustStatusChanged(args.publicKey, args.trustStatus)
self.events.on(SIGNAL_REMOVED_TRUST_STATUS) do(e: Args): self.events.on(SIGNAL_REMOVED_TRUST_STATUS) do(e: Args):
var args = TrustArgs(e) var args = TrustArgs(e)
self.delegate.contactTrustStatusChanged(args.publicKey, args.isUntrustworthy) self.delegate.contactTrustStatusChanged(args.publicKey, args.trustStatus)
self.events.on(SIGNAL_CONTACT_VERIFIED) do (e: Args):
var args = ContactArgs(e)
self.delegate.updateContactVerificationStatus(args.contactId)
self.events.on(SIGNAL_CONTACT_VERIFICATION_SENT) do(e: Args):
var args = ContactArgs(e)
self.delegate.updateContactVerificationStatus(args.contactId)
self.events.on(SIGNAL_CONTACT_VERIFICATION_ACCEPTED) do(e: Args):
var args = VerificationRequestArgs(e)
self.delegate.onVerificationRequestUpdatedOrAdded(args.verificationRequest)
self.events.on(SIGNAL_CONTACT_UPDATED) do(e: Args): self.events.on(SIGNAL_CONTACT_UPDATED) do(e: Args):
var args = ContactArgs(e) var args = ContactArgs(e)
@ -82,28 +70,6 @@ proc init*(self: Controller) =
let args = ContactsStatusUpdatedArgs(e) let args = ContactsStatusUpdatedArgs(e)
self.delegate.contactsStatusUpdated(args.statusUpdates) self.delegate.contactsStatusUpdated(args.statusUpdates)
self.events.on(SIGNAL_CONTACT_VERIFICATION_DECLINED) do(e: Args):
var args = ContactArgs(e)
self.delegate.onVerificationRequestDeclined(args.contactId)
self.delegate.updateContactVerificationStatus(args.contactId)
self.events.on(SIGNAL_CONTACT_VERIFICATION_CANCELLED) do(e: Args):
var args = ContactArgs(e)
self.delegate.onVerificationRequestCanceled(args.contactId)
self.delegate.updateContactVerificationStatus(args.contactId)
self.events.on(SIGNAL_CONTACT_VERIFICATION_ADDED) do(e: Args):
var args = VerificationRequestArgs(e)
self.delegate.onVerificationRequestUpdatedOrAdded(args.verificationRequest)
self.events.on(SIGNAL_CONTACT_VERIFICATION_UPDATED) do(e: Args):
var args = VerificationRequestArgs(e)
self.delegate.onVerificationRequestUpdatedOrAdded(args.verificationRequest)
self.events.on(SIGNAL_CONTACT_VERIFICATION_ACCEPTED) do(e: Args):
var args = VerificationRequestArgs(e)
self.delegate.onVerificationRequestUpdatedOrAdded(args.verificationRequest)
self.events.on(SIGNAL_CONTACT_INFO_REQUEST_FINISHED) do(e: Args): self.events.on(SIGNAL_CONTACT_INFO_REQUEST_FINISHED) do(e: Args):
let args = ContactInfoRequestArgs(e) let args = ContactInfoRequestArgs(e)
self.delegate.onContactInfoRequestFinished(args.publicKey, args.ok) self.delegate.onContactInfoRequestFinished(args.publicKey, args.ok)
@ -169,36 +135,6 @@ proc markUntrustworthy*(self: Controller, publicKey: string) =
proc removeTrustStatus*(self: Controller, publicKey: string) = proc removeTrustStatus*(self: Controller, publicKey: string) =
self.contactsService.removeTrustStatus(publicKey) self.contactsService.removeTrustStatus(publicKey)
proc getVerificationRequestSentTo*(self: Controller, publicKey: string): VerificationRequest =
self.contactsService.getVerificationRequestSentTo(publicKey)
proc getVerificationRequestFrom*(self: Controller, publicKey: string): VerificationRequest =
self.contactsService.getVerificationRequestFrom(publicKey)
proc sendVerificationRequest*(self: Controller, publicKey: string, challenge: string) =
self.contactsService.sendVerificationRequest(publicKey, challenge)
proc cancelVerificationRequest*(self: Controller, publicKey: string) =
self.contactsService.cancelVerificationRequest(publicKey)
proc removeTrustVerificationStatus*(self: Controller, publicKey: string) =
self.contactsService.removeTrustVerificationStatus(publicKey)
proc verifiedTrusted*(self: Controller, publicKey: string) =
self.contactsService.verifiedTrusted(publicKey)
proc verifiedUntrustworthy*(self: Controller, publicKey: string) =
self.contactsService.verifiedUntrustworthy(publicKey)
proc acceptVerificationRequest*(self: Controller, publicKey: string, response: string) =
self.contactsService.acceptVerificationRequest(publicKey, response)
proc declineVerificationRequest*(self: Controller, publicKey: string) =
self.contactsService.declineVerificationRequest(publicKey)
proc getReceivedVerificationRequests*(self: Controller): seq[VerificationRequest] =
self.contactsService.getReceivedVerificationRequests()
proc getStatusForContactWithId*(self: Controller, publicKey: string): StatusUpdateDto = proc getStatusForContactWithId*(self: Controller, publicKey: string): StatusUpdateDto =
return self.contactsService.getStatusForContactWithId(publicKey) return self.contactsService.getStatusForContactWithId(publicKey)

View File

@ -1,6 +1,7 @@
import NimQml import NimQml
import ../../../../../app_service/service/contacts/dto/contacts as contacts import ../../../../../app_service/service/contacts/dto/contacts as contacts
import ../../../../../app_service/service/contacts/dto/status_update import ../../../../../app_service/service/contacts/dto/status_update
import app_service/common/types
import app_service/service/contacts/dto/profile_showcase import app_service/service/contacts/dto/profile_showcase
@ -73,15 +74,12 @@ method contactRemoved*(self: AccessInterface, publicKey: string) {.base.} =
method contactNicknameChanged*(self: AccessInterface, publicKey: string) {.base.} = method contactNicknameChanged*(self: AccessInterface, publicKey: string) {.base.} =
raise newException(ValueError, "No implementation available") raise newException(ValueError, "No implementation available")
method contactTrustStatusChanged*(self: AccessInterface, publicKey: string, isUntrustworthy: bool) {.base.} = method contactTrustStatusChanged*(self: AccessInterface, publicKey: string, trustStatus: TrustStatus) {.base.} =
raise newException(ValueError, "No implementation available") raise newException(ValueError, "No implementation available")
method contactUpdated*(self: AccessInterface, publicKey: string) {.base.} = method contactUpdated*(self: AccessInterface, publicKey: string) {.base.} =
raise newException(ValueError, "No implementation available") raise newException(ValueError, "No implementation available")
method updateContactVerificationStatus*(self: AccessInterface, publicKey: string) {.base.} =
raise newException(ValueError, "No implementation available")
method contactsStatusUpdated*(self: AccessInterface, statusUpdates: seq[StatusUpdateDto]) {.base.} = method contactsStatusUpdated*(self: AccessInterface, statusUpdates: seq[StatusUpdateDto]) {.base.} =
raise newException(ValueError, "No implementation available") raise newException(ValueError, "No implementation available")
@ -94,45 +92,6 @@ method markUntrustworthy*(self: AccessInterface, publicKey: string): void {.base
method removeTrustStatus*(self: AccessInterface, publicKey: string): void {.base.} = method removeTrustStatus*(self: AccessInterface, publicKey: string): void {.base.} =
raise newException(ValueError, "No implementation available") raise newException(ValueError, "No implementation available")
method removeTrustVerificationStatus*(self: AccessInterface, publicKey: string): void {.base.} =
raise newException(ValueError, "No implementation available")
method getSentVerificationDetailsAsJson*(self: AccessInterface, publicKey: string): string {.base.} =
raise newException(ValueError, "No implementation available")
method getVerificationDetailsFromAsJson*(self: AccessInterface, publicKey: string): string {.base.} =
raise newException(ValueError, "No implementation available")
method sendVerificationRequest*(self: AccessInterface, publicKey: string, challenge: string) {.base.} =
raise newException(ValueError, "No implementation available")
method cancelVerificationRequest*(self: AccessInterface, publicKey: string) {.base.} =
raise newException(ValueError, "No implementation available")
method verifiedTrusted*(self: AccessInterface, publicKey: string): void {.base.} =
raise newException(ValueError, "No implementation available")
method verifiedUntrustworthy*(self: AccessInterface, publicKey: string): void {.base.} =
raise newException(ValueError, "No implementation available")
method declineVerificationRequest*(self: AccessInterface, publicKey: string): void {.base.} =
raise newException(ValueError, "No implementation available")
method acceptVerificationRequest*(self: AccessInterface, publicKey: string, response: string): void {.base.} =
raise newException(ValueError, "No implementation available")
method getReceivedVerificationRequests*(self: AccessInterface): seq[VerificationRequest] {.base.} =
raise newException(ValueError, "No implementation available")
method onVerificationRequestDeclined*(self: AccessInterface, publicKey: string) {.base.} =
raise newException(ValueError, "No implementation available")
method onVerificationRequestCanceled*(self: AccessInterface, publicKey: string) {.base.} =
raise newException(ValueError, "No implementation available")
method onVerificationRequestUpdatedOrAdded*(self: AccessInterface, VerificationRequest: VerificationRequest) {.base.} =
raise newException(ValueError, "No implementation available")
method requestContactInfo*(self: AccessInterface, publicKey: string) {.base.} = method requestContactInfo*(self: AccessInterface, publicKey: string) {.base.} =
raise newException(ValueError, "No implementation available") raise newException(ValueError, "No implementation available")

View File

@ -84,8 +84,6 @@ proc createItemFromPublicKey(self: Module, publicKey: string): UserItem =
colorHash = contactDetails.colorHash, colorHash = contactDetails.colorHash,
onlineStatus = toOnlineStatus(self.controller.getStatusForContactWithId(publicKey).statusType), onlineStatus = toOnlineStatus(self.controller.getStatusForContactWithId(publicKey).statusType),
isContact = contactDetails.dto.isContact(), isContact = contactDetails.dto.isContact(),
isVerified = contactDetails.dto.isContactVerified(),
isUntrustworthy = contactDetails.dto.isContactUntrustworthy(),
isBlocked = contactDetails.dto.isBlocked(), isBlocked = contactDetails.dto.isBlocked(),
isCurrentUser = contactDetails.isCurrentUser, isCurrentUser = contactDetails.isCurrentUser,
contactRequest = toContactStatus(contactDetails.dto.contactRequestState), contactRequest = toContactStatus(contactDetails.dto.contactRequestState),
@ -128,18 +126,6 @@ method viewDidLoad*(self: Module) =
# Temporary commented until we provide appropriate flags on the `status-go` side to cover all sections. # Temporary commented until we provide appropriate flags on the `status-go` side to cover all sections.
# self.buildModel(self.view.receivedButRejectedContactRequestsModel(), ContactsGroup.IncomingRejectedContactRequests) # self.buildModel(self.view.receivedButRejectedContactRequestsModel(), ContactsGroup.IncomingRejectedContactRequests)
# self.buildModel(self.view.sentButRejectedContactRequestsModel(), ContactsGroup.IncomingRejectedContactRequests) # self.buildModel(self.view.sentButRejectedContactRequestsModel(), ContactsGroup.IncomingRejectedContactRequests)
let receivedVerificationRequests = self.controller.getReceivedVerificationRequests()
var receivedVerificationRequestItems: seq[UserItem] = @[]
for receivedVerificationRequest in receivedVerificationRequests:
if receivedVerificationRequest.status == VerificationStatus.Verifying or
receivedVerificationRequest.status == VerificationStatus.Verified:
let contactItem = self.createItemFromPublicKey(receivedVerificationRequest.fromID)
contactItem.incomingVerificationStatus = toVerificationRequestStatus(receivedVerificationRequest.status)
receivedVerificationRequestItems.add(contactItem)
self.view.contactsModel().updateIncomingRequestStatus(contactItem.pubKey, contactItem.incomingVerificationStatus)
self.view.receivedContactRequestsModel().addItems(receivedVerificationRequestItems)
self.moduleLoaded = true self.moduleLoaded = true
self.delegate.contactsModuleDidLoad() self.delegate.contactsModuleDidLoad()
@ -253,10 +239,10 @@ method contactNicknameChanged*(self: Module, publicKey: string) =
# self.view.sentButRejectedContactRequestsModel().setName(publicKey, displayName, ensName, localNickname) # self.view.sentButRejectedContactRequestsModel().setName(publicKey, displayName, ensName, localNickname)
self.view.blockedContactsModel().setName(publicKey, displayName, ensName, localNickname) self.view.blockedContactsModel().setName(publicKey, displayName, ensName, localNickname)
method contactTrustStatusChanged*(self: Module, publicKey: string, isUntrustworthy: bool) = method contactTrustStatusChanged*(self: Module, publicKey: string, trustStatus: TrustStatus) =
self.view.myMutualContactsModel().updateTrustStatus(publicKey, isUntrustworthy) self.view.contactsModel().updateTrustStatus(publicKey, trustStatus)
self.view.blockedContactsModel().updateTrustStatus(publicKey, isUntrustworthy) self.view.myMutualContactsModel().updateTrustStatus(publicKey, trustStatus)
self.updateContactVerificationStatus(publicKey) self.view.blockedContactsModel().updateTrustStatus(publicKey, trustStatus)
method markAsTrusted*(self: Module, publicKey: string): void = method markAsTrusted*(self: Module, publicKey: string): void =
self.controller.markAsTrusted(publicKey) self.controller.markAsTrusted(publicKey)
@ -267,89 +253,6 @@ method markUntrustworthy*(self: Module, publicKey: string): void =
method removeTrustStatus*(self: Module, publicKey: string): void = method removeTrustStatus*(self: Module, publicKey: string): void =
self.controller.removeTrustStatus(publicKey) self.controller.removeTrustStatus(publicKey)
method removeTrustVerificationStatus*(self: Module, publicKey: string): void =
self.controller.removeTrustVerificationStatus(publicKey)
method updateContactVerificationStatus*(self: Module, publicKey: string) =
let item = self.createItemFromPublicKey(publicKey)
self.view.contactsModel().removeItemById(publicKey)
self.view.contactsModel().addItem(item)
method getSentVerificationDetailsAsJson*(self: Module, publicKey: string): string =
let verificationRequest = self.controller.getVerificationRequestSentTo(publicKey)
let (name, image, largeImage) = self.controller.getContactNameAndImage(publicKey)
let jsonObj = %* {
"challenge": verificationRequest.challenge,
"response": verificationRequest.response,
"requestedAt": verificationRequest.requestedAt,
"requestStatus": verificationRequest.status.int,
"repliedAt": verificationRequest.repliedAt,
"icon": image,
"largeImage": largeImage,
"displayName": name
}
return $jsonObj
method getVerificationDetailsFromAsJson*(self: Module, publicKey: string): string =
let verificationRequest = self.controller.getVerificationRequestFrom(publicKey)
let (name, image, largeImage) = self.controller.getContactNameAndImage(publicKey)
let jsonObj = %* {
"from": verificationRequest.fromId,
"challenge": verificationRequest.challenge,
"response": verificationRequest.response,
"requestedAt": verificationRequest.requestedAt,
"requestStatus": verificationRequest.status.int,
"repliedAt": verificationRequest.repliedAt,
"icon": image,
"largeImage": largeImage,
"displayName": name
}
return $jsonObj
method sendVerificationRequest*(self: Module, publicKey: string, challenge: string) =
self.controller.sendVerificationRequest(publicKey, challenge)
method cancelVerificationRequest*(self: Module, publicKey: string) =
self.controller.cancelVerificationRequest(publicKey)
method verifiedTrusted*(self: Module, publicKey: string) =
self.controller.verifiedTrusted(publicKey)
method verifiedUntrustworthy*(self: Module, publicKey: string) =
self.controller.verifiedUntrustworthy(publicKey)
method declineVerificationRequest*(self: Module, publicKey: string) =
self.controller.declineVerificationRequest(publicKey)
method acceptVerificationRequest*(self: Module, publicKey: string, response: string) =
self.controller.acceptVerificationRequest(publicKey, response)
method getReceivedVerificationRequests*(self: Module): seq[VerificationRequest] =
self.controller.getReceivedVerificationRequests()
method onVerificationRequestDeclined*(self: Module, publicKey: string) =
self.view.receivedContactRequestsModel.removeItemById(publicKey)
method onVerificationRequestCanceled*(self: Module, publicKey: string) =
self.view.receivedContactRequestsModel.removeItemById(publicKey)
method onVerificationRequestUpdatedOrAdded*(self: Module, request: VerificationRequest) =
let item = self.createItemFromPublicKey(request.fromID)
item.incomingVerificationStatus = toVerificationRequestStatus(request.status)
self.view.contactsModel().updateIncomingRequestStatus(item.pubKey, item.incomingVerificationStatus)
if (self.view.receivedContactRequestsModel.containsItemWithPubKey(request.fromID)):
if request.status != VerificationStatus.Verifying and
request.status != VerificationStatus.Verified:
self.view.receivedContactRequestsModel.removeItemById(request.fromID)
return
self.view.receivedContactRequestsModel.updateIncomingRequestStatus(
item.pubKey,
item.incomingVerificationStatus
)
return
self.view.receivedContactRequestsModel.addItem(item)
method requestContactInfo*(self: Module, publicKey: string) = method requestContactInfo*(self: Module, publicKey: string) =
self.controller.requestContactInfo(publicKey) self.controller.requestContactInfo(publicKey)

View File

@ -218,27 +218,6 @@ QtObject:
proc removeTrustStatus*(self: View, publicKey: string) {.slot.} = proc removeTrustStatus*(self: View, publicKey: string) {.slot.} =
self.delegate.removeTrustStatus(publicKey) self.delegate.removeTrustStatus(publicKey)
proc removeTrustVerificationStatus*(self: View, publicKey: string) {.slot.} =
self.delegate.removeTrustVerificationStatus(publicKey)
proc getSentVerificationDetailsAsJson(self: View, publicKey: string): string {.slot.} =
return self.delegate.getSentVerificationDetailsAsJson(publicKey)
proc getVerificationDetailsFromAsJson(self: View, publicKey: string): string {.slot.} =
return self.delegate.getVerificationDetailsFromAsJson(publicKey)
proc sendVerificationRequest*(self: View, publicKey: string, challenge: string) {.slot.} =
self.delegate.sendVerificationRequest(publicKey, challenge)
proc cancelVerificationRequest*(self: View, publicKey: string) {.slot.} =
self.delegate.cancelVerificationRequest(publicKey)
proc verifiedTrusted*(self: View, publicKey: string) {.slot.} =
self.delegate.verifiedTrusted(publicKey)
proc verifiedUntrustworthy*(self: View, publicKey: string) {.slot.} =
self.delegate.verifiedUntrustworthy(publicKey)
proc shareUserUrlWithData*(self: View, pubkey: string): string {.slot.} = proc shareUserUrlWithData*(self: View, pubkey: string): string {.slot.} =
return self.delegate.shareUserUrlWithData(pubkey) return self.delegate.shareUserUrlWithData(pubkey)
@ -248,12 +227,6 @@ QtObject:
proc shareUserUrlWithENS*(self: View, pubkey: string): string {.slot.} = proc shareUserUrlWithENS*(self: View, pubkey: string): string {.slot.} =
return self.delegate.shareUserUrlWithENS(pubkey) return self.delegate.shareUserUrlWithENS(pubkey)
proc declineVerificationRequest*(self: View, publicKey: string) {.slot.} =
self.delegate.declineVerificationRequest(publicKey)
proc acceptVerificationRequest*(self: View, publicKey: string, response: string) {.slot.} =
self.delegate.acceptVerificationRequest(publicKey, response)
proc requestContactInfo*(self: View, publicKey: string) {.slot.} = proc requestContactInfo*(self: View, publicKey: string) {.slot.} =
self.delegate.requestContactInfo(publicKey) self.delegate.requestContactInfo(publicKey)

View File

@ -26,19 +26,17 @@ proc initMemberItem*(
colorId: int, colorId: int,
colorHash: string = "", colorHash: string = "",
onlineStatus: OnlineStatus = OnlineStatus.Inactive, onlineStatus: OnlineStatus = OnlineStatus.Inactive,
isCurrentUser: bool = false,
isContact: bool = false, isContact: bool = false,
isVerified: bool, trustStatus: TrustStatus = TrustStatus.Unknown,
isUntrustworthy: bool = false,
isBlocked: bool = false, isBlocked: bool = false,
contactRequest: ContactRequest = ContactRequest.None, contactRequest: ContactRequest = ContactRequest.None,
incomingVerificationStatus: VerificationRequestStatus = VerificationRequestStatus.None,
outgoingVerificationStatus: VerificationRequestStatus = VerificationRequestStatus.None,
memberRole: MemberRole = MemberRole.None, memberRole: MemberRole = MemberRole.None,
joined: bool = false, joined: bool = false,
requestToJoinId: string = "", requestToJoinId: string = "",
requestToJoinLoading: bool = false, requestToJoinLoading: bool = false,
airdropAddress: string = "", airdropAddress: string = "",
membershipRequestState: MembershipRequestState = MembershipRequestState.None membershipRequestState: MembershipRequestState = MembershipRequestState.None,
): MemberItem = ): MemberItem =
result = MemberItem() result = MemberItem()
result.memberRole = memberRole result.memberRole = memberRole
@ -59,12 +57,10 @@ proc initMemberItem*(
colorHash = colorHash, colorHash = colorHash,
onlineStatus = onlineStatus, onlineStatus = onlineStatus,
isContact = isContact, isContact = isContact,
isVerified = isVerified, isCurrentUser = isCurrentUser,
isUntrustworthy = isUntrustworthy,
isBlocked = isBlocked, isBlocked = isBlocked,
contactRequest = contactRequest, contactRequest = contactRequest,
incomingVerificationStatus = incomingVerificationStatus, trustStatus = trustStatus,
outgoingVerificationStatus = outgoingVerificationStatus
) )
proc `$`*(self: MemberItem): string = proc `$`*(self: MemberItem): string =
@ -81,12 +77,9 @@ proc `$`*(self: MemberItem): string =
colorHash: {self.colorHash}, colorHash: {self.colorHash},
onlineStatus: {$self.onlineStatus.int}, onlineStatus: {$self.onlineStatus.int},
isContact: {self.isContact}, isContact: {self.isContact},
isVerified: {self.isVerified}, trustStatus: {self.trustStatus.int},
isUntrustworthy: {self.isUntrustworthy},
isBlocked: {self.isBlocked}, isBlocked: {self.isBlocked},
contactRequest: {$self.contactRequest.int}, contactRequest: {$self.contactRequest.int},
incomingVerificationStatus: {$self.incomingVerificationStatus.int},
outgoingVerificationStatus: {$self.outgoingVerificationStatus.int},
memberRole: {self.memberRole}, memberRole: {self.memberRole},
joined: {self.joined}, joined: {self.joined},
requestToJoinId: {self.requestToJoinId}, requestToJoinId: {self.requestToJoinId},

View File

@ -23,10 +23,9 @@ type
IsContact IsContact
IsVerified IsVerified
IsUntrustworthy IsUntrustworthy
TrustStatus
IsBlocked IsBlocked
ContactRequest ContactRequest
IncomingVerificationStatus
OutgoingVerificationStatus
MemberRole MemberRole
Joined Joined
RequestToJoinId RequestToJoinId
@ -93,10 +92,9 @@ QtObject:
ModelRole.IsContact.int: "isContact", ModelRole.IsContact.int: "isContact",
ModelRole.IsVerified.int: "isVerified", ModelRole.IsVerified.int: "isVerified",
ModelRole.IsUntrustworthy.int: "isUntrustworthy", ModelRole.IsUntrustworthy.int: "isUntrustworthy",
ModelRole.TrustStatus.int: "trustStatus",
ModelRole.IsBlocked.int: "isBlocked", ModelRole.IsBlocked.int: "isBlocked",
ModelRole.ContactRequest.int: "contactRequest", ModelRole.ContactRequest.int: "contactRequest",
ModelRole.IncomingVerificationStatus.int: "incomingVerificationStatus",
ModelRole.OutgoingVerificationStatus.int: "outgoingVerificationStatus",
ModelRole.MemberRole.int: "memberRole", ModelRole.MemberRole.int: "memberRole",
ModelRole.Joined.int: "joined", ModelRole.Joined.int: "joined",
ModelRole.RequestToJoinId.int: "requestToJoinId", ModelRole.RequestToJoinId.int: "requestToJoinId",
@ -142,17 +140,15 @@ QtObject:
of ModelRole.IsContact: of ModelRole.IsContact:
result = newQVariant(item.isContact) result = newQVariant(item.isContact)
of ModelRole.IsVerified: of ModelRole.IsVerified:
result = newQVariant(item.isVerified) result = newQVariant(not item.isCurrentUser and item.trustStatus == TrustStatus.Trusted)
of ModelRole.IsUntrustworthy: of ModelRole.IsUntrustworthy:
result = newQVariant(item.isUntrustworthy) result = newQVariant(not item.isCurrentUser and item.trustStatus == TrustStatus.Untrustworthy)
of ModelRole.TrustStatus:
result = newQVariant(item.trustStatus.int)
of ModelRole.IsBlocked: of ModelRole.IsBlocked:
result = newQVariant(item.isBlocked) result = newQVariant(item.isBlocked)
of ModelRole.ContactRequest: of ModelRole.ContactRequest:
result = newQVariant(item.contactRequest.int) result = newQVariant(item.contactRequest.int)
of ModelRole.IncomingVerificationStatus:
result = newQVariant(item.incomingVerificationStatus.int)
of ModelRole.OutgoingVerificationStatus:
result = newQVariant(item.outgoingVerificationStatus.int)
of ModelRole.MemberRole: of ModelRole.MemberRole:
result = newQVariant(item.memberRole.int) result = newQVariant(item.memberRole.int)
of ModelRole.Joined: of ModelRole.Joined:
@ -283,11 +279,10 @@ QtObject:
alias: string, alias: string,
icon: string, icon: string,
isContact: bool, isContact: bool,
isVerified: bool,
memberRole: MemberRole, memberRole: MemberRole,
joined: bool, joined: bool,
isUntrustworthy: bool,
membershipRequestState: MembershipRequestState = MembershipRequestState.None, membershipRequestState: MembershipRequestState = MembershipRequestState.None,
trustStatus: TrustStatus,
callDataChanged: bool = true, callDataChanged: bool = true,
): seq[int] = ): seq[int] =
let ind = self.findIndexForMember(pubKey) let ind = self.findIndexForMember(pubKey)
@ -300,6 +295,8 @@ QtObject:
resolvePreferredDisplayName(self.items[ind].localNickname, self.items[ind].ensName, self.items[ind].displayName, self.items[ind].alias) != resolvePreferredDisplayName(self.items[ind].localNickname, self.items[ind].ensName, self.items[ind].displayName, self.items[ind].alias) !=
resolvePreferredDisplayName(localNickname, ensName, displayName, self.items[ind].alias) resolvePreferredDisplayName(localNickname, ensName, displayName, self.items[ind].alias)
let trustStatusChanged = trustStatus != self.items[ind].trustStatus
updateRole(displayName, DisplayName) updateRole(displayName, DisplayName)
updateRole(ensName, EnsName) updateRole(ensName, EnsName)
updateRole(localNickname, LocalNickname) updateRole(localNickname, LocalNickname)
@ -307,10 +304,9 @@ QtObject:
updateRole(alias, Alias) updateRole(alias, Alias)
updateRole(icon, Icon) updateRole(icon, Icon)
updateRole(isContact, IsContact) updateRole(isContact, IsContact)
updateRole(isVerified, IsVerified)
updateRole(memberRole, MemberRole) updateRole(memberRole, MemberRole)
updateRole(joined, Joined) updateRole(joined, Joined)
updateRole(isUntrustworthy, IsUntrustworthy) updateRole(trustStatus, TrustStatus)
var updatedMembershipRequestState = membershipRequestState var updatedMembershipRequestState = membershipRequestState
if updatedMembershipRequestState == MembershipRequestState.None: if updatedMembershipRequestState == MembershipRequestState.None:
@ -321,6 +317,10 @@ QtObject:
if preferredDisplayNameChanged: if preferredDisplayNameChanged:
roles.add(ModelRole.PreferredDisplayName.int) roles.add(ModelRole.PreferredDisplayName.int)
if trustStatusChanged:
roles.add(ModelRole.IsUntrustworthy.int)
roles.add(ModelRole.IsVerified.int)
if roles.len == 0: if roles.len == 0:
return return
@ -348,11 +348,10 @@ QtObject:
item.alias, item.alias,
item.icon, item.icon,
item.isContact, item.isContact,
item.isVerified,
item.memberRole, item.memberRole,
item.joined, item.joined,
item.isUntrustworthy,
item.membershipRequestState, item.membershipRequestState,
item.trustStatus,
callDataChanged = false, callDataChanged = false,
) )
@ -419,8 +418,7 @@ QtObject:
alias: string, alias: string,
icon: string, icon: string,
isContact: bool, isContact: bool,
isVerified: bool, trustStatus: TrustStatus,
isUntrustworthy: bool,
) = ) =
let ind = self.findIndexForMember(pubKey) let ind = self.findIndexForMember(pubKey)
if ind == -1: if ind == -1:
@ -435,11 +433,10 @@ QtObject:
alias, alias,
icon, icon,
isContact, isContact,
isVerified,
memberRole = self.items[ind].memberRole, memberRole = self.items[ind].memberRole,
joined = self.items[ind].joined, joined = self.items[ind].joined,
isUntrustworthy,
self.items[ind].membershipRequestState, self.items[ind].membershipRequestState,
trustStatus,
) )
proc setOnlineStatus*(self: Model, pubKey: string, onlineStatus: OnlineStatus) = proc setOnlineStatus*(self: Model, pubKey: string, onlineStatus: OnlineStatus) =

View File

@ -348,10 +348,19 @@ proc updateMember*(
alias: string, alias: string,
image: string, image: string,
isContact: bool, isContact: bool,
isVerified: bool, trustStatus: TrustStatus,
isUntrustworthy: bool) = ) =
self.membersModel.updateItem(pubkey, name, ensName, isEnsVerified, nickname, alias, image, isContact, self.membersModel.updateItem(
isVerified, isUntrustworthy) pubkey,
name,
ensName,
isEnsVerified,
nickname,
alias,
image,
isContact,
trustStatus,
)
proc amIBanned*(self: SectionItem): bool {.inline.} = proc amIBanned*(self: SectionItem): bool {.inline.} =
return self.membersModel.isUserBanned(singletonInstance.userProfile.getPubKey()) return self.membersModel.isUserBanned(singletonInstance.userProfile.getPubKey())

View File

@ -5,6 +5,7 @@ import json
import section_item, member_model, member_item import section_item, member_model, member_item
import ../main/communities/tokens/models/[token_item, token_model] import ../main/communities/tokens/models/[token_item, token_model]
import model_utils import model_utils
import ../../../app_service/common/types
type type
ModelRole {.pure.} = enum ModelRole {.pure.} = enum
@ -343,8 +344,7 @@ QtObject:
alias: string, alias: string,
icon: string, icon: string,
isContact: bool, isContact: bool,
isVerified: bool, trustStatus: TrustStatus,
isUntrustworthy: bool,
) = ) =
for item in self.items: for item in self.items:
item.members.updateItem( item.members.updateItem(
@ -356,8 +356,7 @@ QtObject:
alias, alias,
icon, icon,
isContact, isContact,
isVerified, trustStatus,
isUntrustworthy,
) )
proc getNthEnabledItem*(self: SectionModel, nth: int): SectionItem = proc getNthEnabledItem*(self: SectionModel, nth: int): SectionItem =

View File

@ -10,26 +10,6 @@ type
Received = 3 Received = 3
Dismissed = 4 Dismissed = 4
VerificationRequestStatus* {.pure.} = enum
None = 0
Pending
Answered
Declined
Canceled
Trusted
Untrustworthy
proc toVerificationRequestStatus*(value: VerificationStatus): VerificationRequestStatus =
case value:
of VerificationStatus.Unverified: return VerificationRequestStatus.None
of VerificationStatus.Verifying: return VerificationRequestStatus.Pending
of VerificationStatus.Verified: return VerificationRequestStatus.Answered
of VerificationStatus.Declined: return VerificationRequestStatus.Declined
of VerificationStatus.Canceled: return VerificationRequestStatus.Canceled
of VerificationStatus.Trusted: return VerificationRequestStatus.Trusted
of VerificationStatus.Untrustworthy: return VerificationRequestStatus.Untrustworthy
else: return VerificationRequestStatus.None
#TODO: #14964 - To check if this is needed #TODO: #14964 - To check if this is needed
proc toContactStatus*(value: ContactRequestState): ContactRequest = proc toContactStatus*(value: ContactRequestState): ContactRequest =
case value: case value:
@ -53,12 +33,8 @@ type
colorHash: string colorHash: string
onlineStatus: OnlineStatus onlineStatus: OnlineStatus
isContact: bool isContact: bool
isVerified: bool
isUntrustworthy: bool
isBlocked: bool isBlocked: bool
contactRequest: ContactRequest contactRequest: ContactRequest
incomingVerificationStatus: VerificationRequestStatus
outgoingVerificationStatus: VerificationRequestStatus
#Contact extra details #Contact extra details
isCurrentUser: bool isCurrentUser: bool
defaultDisplayName: string defaultDisplayName: string
@ -86,12 +62,8 @@ proc setup*(self: UserItem,
colorHash: string, colorHash: string,
onlineStatus: OnlineStatus, onlineStatus: OnlineStatus,
isContact: bool, isContact: bool,
isVerified: bool,
isUntrustworthy: bool,
isBlocked: bool, isBlocked: bool,
contactRequest: ContactRequest, contactRequest: ContactRequest,
incomingVerificationStatus: VerificationRequestStatus,
outgoingVerificationStatus: VerificationRequestStatus,
#TODO: #14964 - remove defaults #TODO: #14964 - remove defaults
isCurrentUser: bool = false, isCurrentUser: bool = false,
defaultDisplayName: string = "", defaultDisplayName: string = "",
@ -118,12 +90,8 @@ proc setup*(self: UserItem,
self.colorHash = colorHash self.colorHash = colorHash
self.onlineStatus = onlineStatus self.onlineStatus = onlineStatus
self.isContact = isContact self.isContact = isContact
self.isVerified = isVerified
self.isUntrustworthy = isUntrustworthy
self.isBlocked = isBlocked self.isBlocked = isBlocked
self.contactRequest = contactRequest self.contactRequest = contactRequest
self.incomingVerificationStatus = incomingVerificationStatus
self.outgoingVerificationStatus = outgoingVerificationStatus
self.isCurrentUser = isCurrentUser self.isCurrentUser = isCurrentUser
self.defaultDisplayName = defaultDisplayName self.defaultDisplayName = defaultDisplayName
self.optionalName = optionalName self.optionalName = optionalName
@ -152,12 +120,8 @@ proc initUserItem*(
colorHash: string = "", colorHash: string = "",
onlineStatus: OnlineStatus, onlineStatus: OnlineStatus,
isContact: bool, isContact: bool,
isVerified: bool,
isUntrustworthy: bool,
isBlocked: bool, isBlocked: bool,
contactRequest: ContactRequest = ContactRequest.None, contactRequest: ContactRequest = ContactRequest.None,
incomingVerificationStatus: VerificationRequestStatus = VerificationRequestStatus.None,
outgoingVerificationStatus: VerificationRequestStatus = VerificationRequestStatus.None,
isCurrentUser: bool = false, isCurrentUser: bool = false,
defaultDisplayName: string = "", defaultDisplayName: string = "",
optionalName: string = "", optionalName: string = "",
@ -185,13 +149,9 @@ proc initUserItem*(
colorHash = colorHash, colorHash = colorHash,
onlineStatus = onlineStatus, onlineStatus = onlineStatus,
isContact = isContact, isContact = isContact,
isVerified = isVerified,
isUntrustworthy = isUntrustworthy,
isBlocked = isBlocked, isBlocked = isBlocked,
contactRequest = contactRequest, contactRequest = contactRequest,
incomingVerificationStatus = incomingVerificationStatus,
isCurrentUser = isCurrentUser, isCurrentUser = isCurrentUser,
outgoingVerificationStatus = outgoingVerificationStatus,
defaultDisplayName = defaultDisplayName, defaultDisplayName = defaultDisplayName,
optionalName = optionalName, optionalName = optionalName,
lastUpdated = lastUpdated, lastUpdated = lastUpdated,
@ -219,12 +179,8 @@ proc `$`*(self: UserItem): string =
colorHash: {self.colorHash}, colorHash: {self.colorHash},
onlineStatus: {$self.onlineStatus.int}, onlineStatus: {$self.onlineStatus.int},
isContact: {self.isContact}, isContact: {self.isContact},
isVerified: {self.isVerified},
isUntrustworthy: {self.isUntrustworthy},
isBlocked: {self.isBlocked}, isBlocked: {self.isBlocked},
contactRequest: {$self.contactRequest.int}, contactRequest: {$self.contactRequest.int},
incomingVerificationStatus: {$self.incomingVerificationStatus.int},
outgoingVerificationStatus: {$self.outgoingVerificationStatus.int},
isCurrentUser: {self.isCurrentUser}, isCurrentUser: {self.isCurrentUser},
defaultDisplayName: {self.defaultDisplayName}, defaultDisplayName: {self.defaultDisplayName},
optionalName: {self.optionalName}, optionalName: {self.optionalName},
@ -303,18 +259,6 @@ proc isContact*(self: UserItem): bool {.inline.} =
proc `isContact=`*(self: UserItem, value: bool) {.inline.} = proc `isContact=`*(self: UserItem, value: bool) {.inline.} =
self.isContact = value self.isContact = value
proc isVerified*(self: UserItem): bool {.inline.} =
self.isVerified
proc `isVerified=`*(self: UserItem, value: bool) {.inline.} =
self.isVerified = value
proc isUntrustworthy*(self: UserItem): bool {.inline.} =
self.isUntrustworthy
proc `isUntrustworthy=`*(self: UserItem, value: bool) {.inline.} =
self.isUntrustworthy = value
proc isBlocked*(self: UserItem): bool {.inline.} = proc isBlocked*(self: UserItem): bool {.inline.} =
self.isBlocked self.isBlocked
@ -327,18 +271,6 @@ proc contactRequest*(self: UserItem): ContactRequest {.inline.} =
proc `contactRequest=`*(self: UserItem, value: ContactRequest) {.inline.} = proc `contactRequest=`*(self: UserItem, value: ContactRequest) {.inline.} =
self.contactRequest = value self.contactRequest = value
proc incomingVerificationStatus*(self: UserItem): VerificationRequestStatus {.inline.} =
self.incomingVerificationStatus
proc `incomingVerificationStatus=`*(self: UserItem, value: VerificationRequestStatus) {.inline.} =
self.incomingVerificationStatus = value
proc outgoingVerificationStatus*(self: UserItem): VerificationRequestStatus {.inline.} =
self.outgoingVerificationStatus
proc `outgoingVerificationStatus=`*(self: UserItem, value: VerificationRequestStatus) {.inline.} =
self.outgoingVerificationStatus = value
proc isCurrentUser*(self: UserItem): bool {.inline.} = proc isCurrentUser*(self: UserItem): bool {.inline.} =
self.isCurrentUser self.isCurrentUser

View File

@ -23,8 +23,6 @@ type
IsUntrustworthy IsUntrustworthy
IsBlocked IsBlocked
ContactRequest ContactRequest
IncomingVerificationStatus
OutgoingVerificationStatus
IsCurrentUser IsCurrentUser
DefaultDisplayName DefaultDisplayName
OptionalName OptionalName
@ -100,8 +98,6 @@ QtObject:
ModelRole.IsUntrustworthy.int: "isUntrustworthy", ModelRole.IsUntrustworthy.int: "isUntrustworthy",
ModelRole.IsBlocked.int: "isBlocked", ModelRole.IsBlocked.int: "isBlocked",
ModelRole.ContactRequest.int: "contactRequest", ModelRole.ContactRequest.int: "contactRequest",
ModelRole.IncomingVerificationStatus.int: "incomingVerificationStatus",
ModelRole.OutgoingVerificationStatus.int: "outgoingVerificationStatus",
ModelRole.IsCurrentUser.int: "isCurrentUser", ModelRole.IsCurrentUser.int: "isCurrentUser",
ModelRole.DefaultDisplayName.int: "defaultDisplayName", ModelRole.DefaultDisplayName.int: "defaultDisplayName",
ModelRole.OptionalName.int: "optionalName", ModelRole.OptionalName.int: "optionalName",
@ -154,17 +150,13 @@ QtObject:
of ModelRole.IsContact: of ModelRole.IsContact:
result = newQVariant(item.isContact) result = newQVariant(item.isContact)
of ModelRole.IsVerified: of ModelRole.IsVerified:
result = newQVariant(item.isVerified) result = newQVariant(not item.isCurrentUser and item.trustStatus == TrustStatus.Trusted)
of ModelRole.IsUntrustworthy: of ModelRole.IsUntrustworthy:
result = newQVariant(item.isUntrustworthy) result = newQVariant(not item.isCurrentUser and item.trustStatus == TrustStatus.Untrustworthy)
of ModelRole.IsBlocked: of ModelRole.IsBlocked:
result = newQVariant(item.isBlocked) result = newQVariant(item.isBlocked)
of ModelRole.ContactRequest: of ModelRole.ContactRequest:
result = newQVariant(item.contactRequest.int) result = newQVariant(item.contactRequest.int)
of ModelRole.IncomingVerificationStatus:
result = newQVariant(item.incomingVerificationStatus.int)
of ModelRole.OutgoingVerificationStatus:
result = newQVariant(item.outgoingVerificationStatus.int)
of ModelRole.IsCurrentUser: of ModelRole.IsCurrentUser:
result = newQVariant(item.isCurrentUser) result = newQVariant(item.isCurrentUser)
of ModelRole.DefaultDisplayName: of ModelRole.DefaultDisplayName:
@ -309,8 +301,8 @@ QtObject:
localNickname: string, localNickname: string,
alias: string, alias: string,
icon: string, icon: string,
isUntrustworthy: bool = false, trustStatus: TrustStatus,
) = ) =
let ind = self.findIndexByPubKey(pubKey) let ind = self.findIndexByPubKey(pubKey)
if ind == -1: if ind == -1:
return return
@ -321,16 +313,22 @@ QtObject:
resolvePreferredDisplayName(self.items[ind].localNickname, self.items[ind].ensName, self.items[ind].displayName, self.items[ind].alias) != resolvePreferredDisplayName(self.items[ind].localNickname, self.items[ind].ensName, self.items[ind].displayName, self.items[ind].alias) !=
resolvePreferredDisplayName(localNickname, ensName, displayName, alias) resolvePreferredDisplayName(localNickname, ensName, displayName, alias)
let trustStatusChanged = trustStatus != self.items[ind].trustStatus
updateRole(displayName, DisplayName) updateRole(displayName, DisplayName)
updateRole(ensName, EnsName) updateRole(ensName, EnsName)
updateRole(localNickname, LocalNickname) updateRole(localNickname, LocalNickname)
updateRole(alias, Alias) updateRole(alias, Alias)
updateRole(icon, Icon) updateRole(icon, Icon)
updateRole(isUntrustworthy, IsUntrustworthy) updateRole(trustStatus, TrustStatus)
if preferredDisplayNameChanged: if preferredDisplayNameChanged:
roles.add(ModelRole.PreferredDisplayName.int) roles.add(ModelRole.PreferredDisplayName.int)
if trustStatusChanged:
roles.add(ModelRole.IsUntrustworthy.int)
roles.add(ModelRole.IsVerified.int)
if roles.len == 0: if roles.len == 0:
return return
@ -339,50 +337,36 @@ QtObject:
self.dataChanged(index, index, roles) self.dataChanged(index, index, roles)
self.itemChanged(pubKey) self.itemChanged(pubKey)
proc updateIncomingRequestStatus*( proc updateTrustStatus*(self: Model, pubKey: string, trustStatus: TrustStatus) =
self: Model,
pubKey: string,
requestStatus: VerificationRequestStatus
) =
let ind = self.findIndexByPubKey(pubKey) let ind = self.findIndexByPubKey(pubKey)
if(ind == -1): if ind == -1:
return return
self.items[ind].incomingVerificationStatus = requestStatus if self.items[ind].trustStatus == trustStatus:
return
self.items[ind].trustStatus = trustStatus
let index = self.createIndex(ind, 0, nil) let index = self.createIndex(ind, 0, nil)
defer: index.delete defer: index.delete
self.dataChanged(index, index, @[ self.dataChanged(index, index, @[ModelRole.TrustStatus.int, ModelRole.IsUntrustworthy.int, ModelRole.IsVerified.int])
ModelRole.IncomingVerificationStatus.int
])
self.itemChanged(pubKey) self.itemChanged(pubKey)
proc updateTrustStatus*(self: Model, pubKey: string, isUntrustworthy: bool) = proc setOnlineStatus*(self: Model, pubKey: string, onlineStatus: OnlineStatus) =
let ind = self.findIndexByPubKey(pubKey) let ind = self.findIndexByPubKey(pubKey)
if(ind == -1): if ind == -1:
return return
let first = self.createIndex(ind, 0, nil) if self.items[ind].onlineStatus == onlineStatus:
let last = self.createIndex(ind, 0, nil) return
defer: first.delete
defer: last.delete self.items[ind].onlineStatus = onlineStatus
self.items[ind].isUntrustworthy = isUntrustworthy
self.dataChanged(first, last, @[ModelRole.IsUntrustworthy.int]) let index = self.createIndex(ind, 0, nil)
defer: index.delete
self.dataChanged(index, index, @[ModelRole.OnlineStatus.int])
self.itemChanged(pubKey) self.itemChanged(pubKey)
proc setOnlineStatus*(self: Model, pubKey: string,
onlineStatus: OnlineStatus) =
let ind = self.findIndexByPubKey(pubKey)
if(ind == -1):
return
if(self.items[ind].onlineStatus == onlineStatus):
return
var item = self.items[ind]
item.onlineStatus = onlineStatus
self.removeItemWithIndex(ind)
self.addItem(item)
# TODO: rename me to removeItemByPubkey # TODO: rename me to removeItemByPubkey
proc removeItemById*(self: Model, pubKey: string) = proc removeItemById*(self: Model, pubKey: string) =

View File

@ -96,4 +96,9 @@ type TokenType* {.pure.} = enum
type RequestToJoinState* {.pure.} = enum type RequestToJoinState* {.pure.} = enum
None = 0 None = 0
InProgress InProgress
Requested Requested
type TrustStatus* {.pure.}= enum
Unknown = 0,
Trusted = 1,
Untrustworthy = 2

View File

@ -64,7 +64,6 @@ type ActivityCenterNotificationDto* = ref object of RootObj
chatId*: string chatId*: string
communityId*: string communityId*: string
membershipStatus*: ActivityCenterMembershipStatus membershipStatus*: ActivityCenterMembershipStatus
verificationStatus*: VerificationStatus
name*: string name*: string
author*: string author*: string
installationId*: string installationId*: string
@ -85,7 +84,6 @@ proc `$`*(self: ActivityCenterNotificationDto): string =
chatId: {self.chatId}, chatId: {self.chatId},
communityId: {self.communityId}, communityId: {self.communityId},
membershipStatus: {self.membershipStatus}, membershipStatus: {self.membershipStatus},
contactVerificationStatus: {self.verificationStatus},
author: {self.author}, author: {self.author},
installationId: {self.installationId}, installationId: {self.installationId},
notificationType: {$self.notificationType.int}, notificationType: {$self.notificationType.int},
@ -113,13 +111,6 @@ proc toActivityCenterNotificationDto*(jsonObj: JsonNode): ActivityCenterNotifica
membershipStatusInt <= ord(high(ActivityCenterMembershipStatus)))): membershipStatusInt <= ord(high(ActivityCenterMembershipStatus)))):
result.membershipStatus = ActivityCenterMembershipStatus(membershipStatusInt) result.membershipStatus = ActivityCenterMembershipStatus(membershipStatusInt)
result.verificationStatus = VerificationStatus.Unverified
var verificationStatusInt: int
if (jsonObj.getProp("contactVerificationStatus", verificationStatusInt) and
(verificationStatusInt >= ord(low(VerificationStatus)) and
verificationStatusInt <= ord(high(VerificationStatus)))):
result.verificationStatus = VerificationStatus(verificationStatusInt)
discard jsonObj.getProp("author", result.author) discard jsonObj.getProp("author", result.author)
discard jsonObj.getProp("installationId", result.installationId) discard jsonObj.getProp("installationId", result.installationId)

View File

@ -10,11 +10,6 @@ type
thumbnail*: string thumbnail*: string
large*: string large*: string
type TrustStatus* {.pure.}= enum
Unknown = 0,
Trusted = 1,
Untrustworthy = 2
type ContactRequestState* {.pure.} = enum type ContactRequestState* {.pure.} = enum
None = 0 None = 0
Mutual = 1 Mutual = 1
@ -22,25 +17,6 @@ type ContactRequestState* {.pure.} = enum
Received = 3 Received = 3
Dismissed = 4 Dismissed = 4
type VerificationStatus* {.pure.}= enum
Unverified = 0
Verifying = 1
Verified = 2
Declined = 3
Canceled = 4
Trusted = 5
Untrustworthy = 6
type VerificationRequest* = object
id*: string
fromID*: string
toID*: string
challenge*: string
requestedAt*: int64
response*: string
repliedAt*: int64
status*: VerificationStatus
type ContactsDto* = object type ContactsDto* = object
id*: string id*: string
name*: string name*: string
@ -59,7 +35,6 @@ type ContactsDto* = object
removed*: bool removed*: bool
trustStatus*: TrustStatus trustStatus*: TrustStatus
contactRequestState*: ContactRequestState contactRequestState*: ContactRequestState
verificationStatus*: VerificationStatus
proc `$`(self: Images): string = proc `$`(self: Images): string =
result = fmt"""Images( result = fmt"""Images(
@ -87,7 +62,6 @@ proc `$`*(self: ContactsDto): string =
removed:{self.removed}, removed:{self.removed},
trustStatus:{self.trustStatus}, trustStatus:{self.trustStatus},
contactRequestState:{self.contactRequestState}, contactRequestState:{self.contactRequestState},
verificationStatus:{self.verificationStatus},
)""" )"""
proc toImages(jsonObj: JsonNode): Images = proc toImages(jsonObj: JsonNode): Images =
@ -111,24 +85,6 @@ proc toTrustStatus*(value: int): TrustStatus =
if value >= ord(low(TrustStatus)) or value <= ord(high(TrustStatus)): if value >= ord(low(TrustStatus)) or value <= ord(high(TrustStatus)):
result = TrustStatus(value) result = TrustStatus(value)
proc toVerificationStatus*(value: int): VerificationStatus =
result = VerificationStatus.Unverified
if value >= ord(low(VerificationStatus)) or value <= ord(high(VerificationStatus)):
result = VerificationStatus(value)
proc toVerificationRequest*(jsonObj: JsonNode): VerificationRequest =
result = VerificationRequest()
discard jsonObj.getProp("id", result.id)
discard jsonObj.getProp("from", result.fromID)
discard jsonObj.getProp("to", result.toID)
discard jsonObj.getProp("challenge", result.challenge)
discard jsonObj.getProp("response", result.response)
discard jsonObj.getProp("requested_at", result.requestedAt)
discard jsonObj.getProp("replied_at", result.repliedAt)
var verificationStatusInt: int
discard jsonObj.getProp("verification_status", verificationStatusInt)
result.status = verificationStatusInt.toVerificationStatus()
proc toContactsDto*(jsonObj: JsonNode): ContactsDto = proc toContactsDto*(jsonObj: JsonNode): ContactsDto =
result = ContactsDto() result = ContactsDto()
discard jsonObj.getProp("id", result.id) discard jsonObj.getProp("id", result.id)
@ -152,10 +108,6 @@ proc toContactsDto*(jsonObj: JsonNode): ContactsDto =
var trustStatusInt: int var trustStatusInt: int
discard jsonObj.getProp("trustStatus", trustStatusInt) discard jsonObj.getProp("trustStatus", trustStatusInt)
result.trustStatus = trustStatusInt.toTrustStatus() result.trustStatus = trustStatusInt.toTrustStatus()
var verificationStatusInt: int
discard jsonObj.getProp("verificationStatus", verificationStatusInt)
result.verificationStatus = verificationStatusInt.toVerificationStatus()
var imageObj: JsonNode var imageObj: JsonNode
if(jsonObj.getProp("images", imageObj)): if(jsonObj.getProp("images", imageObj)):
@ -215,7 +167,7 @@ proc trustStatus*(self: ContactsDto): TrustStatus =
result = self.trustStatus result = self.trustStatus
proc isContactVerified*(self: ContactsDto): bool = proc isContactVerified*(self: ContactsDto): bool =
return self.verificationStatus == VerificationStatus.Verified or self.trustStatus == TrustStatus.Trusted return self.trustStatus == TrustStatus.Trusted
proc isContactUntrustworthy*(self: ContactsDto): bool = proc isContactUntrustworthy*(self: ContactsDto): bool =
return self.trustStatus == TrustStatus.Untrustworthy return self.trustStatus == TrustStatus.Untrustworthy

View File

@ -37,7 +37,7 @@ type
TrustArgs* = ref object of Args TrustArgs* = ref object of Args
publicKey*: string publicKey*: string
isUntrustworthy*: bool trustStatus*: TrustStatus
ResolvedContactArgs* = ref object of Args ResolvedContactArgs* = ref object of Args
pubkey*: string pubkey*: string
@ -48,9 +48,6 @@ type
ContactsStatusUpdatedArgs* = ref object of Args ContactsStatusUpdatedArgs* = ref object of Args
statusUpdates*: seq[StatusUpdateDto] statusUpdates*: seq[StatusUpdateDto]
VerificationRequestArgs* = ref object of Args
verificationRequest*: VerificationRequest
ContactInfoRequestArgs* = ref object of Args ContactInfoRequestArgs* = ref object of Args
publicKey*: string publicKey*: string
ok*: bool ok*: bool
@ -83,13 +80,6 @@ const SIGNAL_LOGGEDIN_USER_IMAGE_CHANGED* = "loggedInUserImageChanged"
const SIGNAL_REMOVED_TRUST_STATUS* = "removedTrustStatus" const SIGNAL_REMOVED_TRUST_STATUS* = "removedTrustStatus"
const SIGNAL_CONTACT_UNTRUSTWORTHY* = "contactUntrustworthy" const SIGNAL_CONTACT_UNTRUSTWORTHY* = "contactUntrustworthy"
const SIGNAL_CONTACT_TRUSTED* = "contactTrusted" const SIGNAL_CONTACT_TRUSTED* = "contactTrusted"
const SIGNAL_CONTACT_VERIFIED* = "contactVerified"
const SIGNAL_CONTACT_VERIFICATION_SENT* = "contactVerificationRequestSent"
const SIGNAL_CONTACT_VERIFICATION_CANCELLED* = "contactVerificationRequestCancelled"
const SIGNAL_CONTACT_VERIFICATION_DECLINED* = "contactVerificationRequestDeclined"
const SIGNAL_CONTACT_VERIFICATION_ACCEPTED* = "contactVerificationRequestAccepted"
const SIGNAL_CONTACT_VERIFICATION_ADDED* = "contactVerificationRequestAdded"
const SIGNAL_CONTACT_VERIFICATION_UPDATED* = "contactVerificationRequestUpdated"
const SIGNAL_CONTACT_INFO_REQUEST_FINISHED* = "contactInfoRequestFinished" const SIGNAL_CONTACT_INFO_REQUEST_FINISHED* = "contactInfoRequestFinished"
const SIGNAL_APPEND_CHAT_MESSAGES* = "appendChatMessages" const SIGNAL_APPEND_CHAT_MESSAGES* = "appendChatMessages"
@ -114,7 +104,6 @@ QtObject:
settingsService: settings_service.Service settingsService: settings_service.Service
contacts: Table[string, ContactDetails] # [contact_id, ContactDetails] contacts: Table[string, ContactDetails] # [contact_id, ContactDetails]
contactsStatus: Table[string, StatusUpdateDto] # [contact_id, StatusUpdateDto] contactsStatus: Table[string, StatusUpdateDto] # [contact_id, StatusUpdateDto]
receivedIdentityRequests: Table[string, VerificationRequest] # [from_id, VerificationRequest]
events: EventEmitter events: EventEmitter
closingApp: bool closingApp: bool
imageServerUrl: string imageServerUrl: string
@ -122,7 +111,6 @@ QtObject:
# Forward declaration # Forward declaration
proc getContactById*(self: Service, id: string): ContactsDto proc getContactById*(self: Service, id: string): ContactsDto
proc saveContact(self: Service, contact: ContactsDto) proc saveContact(self: Service, contact: ContactsDto)
proc fetchReceivedVerificationRequests*(self: Service) : seq[VerificationRequest]
proc requestContactInfo*(self: Service, pubkey: string) proc requestContactInfo*(self: Service, pubkey: string)
proc constructContactDetails(self: Service, contactDto: ContactsDto): ContactDetails proc constructContactDetails(self: Service, contactDto: ContactsDto): ContactDetails
@ -130,7 +118,6 @@ QtObject:
self.closingApp = true self.closingApp = true
self.contacts.clear self.contacts.clear
self.contactsStatus.clear self.contactsStatus.clear
self.receivedIdentityRequests.clear
self.QObject.delete self.QObject.delete
proc newService*( proc newService*(
@ -148,7 +135,6 @@ QtObject:
result.threadpool = threadpool result.threadpool = threadpool
result.contacts = initTable[string, ContactDetails]() result.contacts = initTable[string, ContactDetails]()
result.contactsStatus = initTable[string, StatusUpdateDto]() result.contactsStatus = initTable[string, StatusUpdateDto]()
result.receivedIdentityRequests = initTable[string, VerificationRequest]()
proc addContact(self: Service, contact: ContactDetails) = proc addContact(self: Service, contact: ContactDetails) =
# Private proc, used for adding contacts only. # Private proc, used for adding contacts only.
@ -164,10 +150,6 @@ QtObject:
for contact in contacts: for contact in contacts:
self.addContact(self.constructContactDetails(contact)) self.addContact(self.constructContactDetails(contact))
# Identity verifications
for request in self.fetchReceivedVerificationRequests():
self.receivedIdentityRequests[request.fromId] = request
except Exception as e: except Exception as e:
let errDesription = e.msg let errDesription = e.msg
error "error fetching contacts: ", errDesription error "error fetching contacts: ", errDesription
@ -207,35 +189,6 @@ QtObject:
let data = ContactArgs(contactId: c.id) let data = ContactArgs(contactId: c.id)
self.events.emit(SIGNAL_CONTACT_UPDATED, data) self.events.emit(SIGNAL_CONTACT_UPDATED, data)
let myPubKey = singletonInstance.userProfile.getPubKey()
if(receivedData.verificationRequests.len > 0):
for request in receivedData.verificationRequests:
if request.fromId == myPubKey:
# TODO handle reacting to my own request later
continue
let data = VerificationRequestArgs(verificationRequest: request)
let alreadyContains = self.receivedIdentityRequests.contains(request.fromId)
self.receivedIdentityRequests[request.fromId] = request
if alreadyContains:
self.events.emit(SIGNAL_CONTACT_VERIFICATION_UPDATED, data)
if request.status == VerificationStatus.Trusted:
if self.contacts.hasKey(request.fromId):
self.contacts[request.fromId].dto.trustStatus = TrustStatus.Trusted
self.contacts[request.fromId].dto.verificationStatus = VerificationStatus.Trusted
self.events.emit(SIGNAL_CONTACT_TRUSTED,
TrustArgs(publicKey: request.fromId, isUntrustworthy: false))
self.events.emit(SIGNAL_CONTACT_VERIFIED, ContactArgs(contactId: request.fromId))
if request.status == VerificationStatus.Canceled:
if self.contacts.hasKey(request.fromId):
self.contacts[request.fromId].dto.verificationStatus = VerificationStatus.Canceled
self.events.emit(SIGNAL_CONTACT_VERIFICATION_CANCELLED, ContactArgs(contactId: request.fromId))
else:
self.events.emit(SIGNAL_CONTACT_VERIFICATION_ADDED, data)
self.events.on(SignalType.Message.event) do(e: Args): self.events.on(SignalType.Message.event) do(e: Args):
let receivedData = MessageSignal(e) let receivedData = MessageSignal(e)
if receivedData.updatedProfileShowcaseContactIDs.len > 0: if receivedData.updatedProfileShowcaseContactIDs.len > 0:
@ -650,7 +603,7 @@ QtObject:
self.contacts[publicKey].dto.trustStatus = TrustStatus.Trusted self.contacts[publicKey].dto.trustStatus = TrustStatus.Trusted
self.events.emit(SIGNAL_CONTACT_TRUSTED, self.events.emit(SIGNAL_CONTACT_TRUSTED,
TrustArgs(publicKey: publicKey, isUntrustworthy: false)) TrustArgs(publicKey: publicKey, trustStatus: self.contacts[publicKey].dto.trustStatus))
proc markUntrustworthy*(self: Service, publicKey: string) = proc markUntrustworthy*(self: Service, publicKey: string) =
let response = status_contacts.markUntrustworthy(publicKey) let response = status_contacts.markUntrustworthy(publicKey)
@ -662,57 +615,7 @@ QtObject:
self.contacts[publicKey].dto.trustStatus = TrustStatus.Untrustworthy self.contacts[publicKey].dto.trustStatus = TrustStatus.Untrustworthy
self.events.emit(SIGNAL_CONTACT_UNTRUSTWORTHY, self.events.emit(SIGNAL_CONTACT_UNTRUSTWORTHY,
TrustArgs(publicKey: publicKey, isUntrustworthy: true)) TrustArgs(publicKey: publicKey, trustStatus: self.contacts[publicKey].dto.trustStatus))
proc verifiedTrusted*(self: Service, publicKey: string) =
try:
var response = status_contacts.getVerificationRequestSentTo(publicKey)
if not response.error.isNil:
let msg = response.error.message
raise newException(RpcException, msg)
let request = response.result.toVerificationRequest()
response = status_contacts.verifiedTrusted(request.id)
if not response.error.isNil:
let msg = response.error.message
raise newException(RpcException, msg)
if self.contacts.hasKey(publicKey):
self.contacts[publicKey].dto.trustStatus = TrustStatus.Trusted
self.contacts[publicKey].dto.verificationStatus = VerificationStatus.Trusted
self.events.emit(SIGNAL_CONTACT_TRUSTED, TrustArgs(publicKey: publicKey, isUntrustworthy: false))
self.events.emit(SIGNAL_CONTACT_VERIFIED, ContactArgs(contactId: publicKey))
checkAndEmitACNotificationsFromResponse(self.events, response.result{"activityCenterNotifications"})
except Exception as e:
error "error verified trusted request", msg=e.msg
proc verifiedUntrustworthy*(self: Service, publicKey: string) =
try:
var response = status_contacts.getVerificationRequestSentTo(publicKey)
if not response.error.isNil:
let msg = response.error.message
raise newException(RpcException, msg)
let request = response.result.toVerificationRequest()
response = status_contacts.verifiedUntrustworthy(request.id)
if not response.error.isNil:
let msg = response.error.message
raise newException(RpcException, msg)
if self.contacts.hasKey(publicKey):
self.contacts[publicKey].dto.trustStatus = TrustStatus.Untrustworthy
self.contacts[publicKey].dto.verificationStatus = VerificationStatus.Untrustworthy
self.events.emit(SIGNAL_CONTACT_UNTRUSTWORTHY, TrustArgs(publicKey: publicKey, isUntrustworthy: true))
self.events.emit(SIGNAL_CONTACT_VERIFIED, ContactArgs(contactId: publicKey))
checkAndEmitACNotificationsFromResponse(self.events, response.result{"activityCenterNotifications"})
except Exception as e:
error "error verified untrustworthy request", msg=e.msg
proc removeTrustStatus*(self: Service, publicKey: string) = proc removeTrustStatus*(self: Service, publicKey: string) =
try: try:
@ -726,141 +629,11 @@ QtObject:
if self.contacts.hasKey(publicKey): if self.contacts.hasKey(publicKey):
self.contacts[publicKey].dto.trustStatus = TrustStatus.Unknown self.contacts[publicKey].dto.trustStatus = TrustStatus.Unknown
self.events.emit(SIGNAL_REMOVED_TRUST_STATUS, TrustArgs(publicKey: publicKey, isUntrustworthy: false)) self.events.emit(SIGNAL_REMOVED_TRUST_STATUS,
TrustArgs(publicKey: publicKey, trustStatus: self.contacts[publicKey].dto.trustStatus))
except Exception as e: except Exception as e:
error "error in removeTrustStatus request", msg = e.msg error "error in removeTrustStatus request", msg = e.msg
proc removeTrustVerificationStatus*(self: Service, publicKey: string) =
try:
let response = status_contacts.removeTrustVerificationStatus(publicKey)
if not response.error.isNil:
error "error removing trust status", msg = response.error.message
return
self.parseContactsResponse(response)
self.events.emit(SIGNAL_REMOVED_TRUST_STATUS, TrustArgs(publicKey: publicKey, isUntrustworthy: false))
self.events.emit(SIGNAL_CONTACT_VERIFIED, ContactArgs(contactId: publicKey))
except Exception as e:
error "error removeTrustVerificationStatus request", msg = e.msg
proc getVerificationRequestSentTo*(self: Service, publicKey: string): VerificationRequest =
try:
let response = status_contacts.getVerificationRequestSentTo(publicKey)
return response.result.toVerificationRequest()
except Exception as e:
let errDesription = e.msg
error "error obtaining verification request", errDesription
return
proc getVerificationRequestFrom*(self: Service, publicKey: string): VerificationRequest =
try:
if (self.receivedIdentityRequests.contains(publicKey)):
return self.receivedIdentityRequests[publicKey]
let response = status_contacts.getVerificationRequestFrom(publicKey)
if not response.result.isNil and response.result.kind == JObject:
result = response.result.toVerificationRequest()
self.receivedIdentityRequests[publicKey] = result
except Exception as e:
let errDesription = e.msg
error "error obtaining verification request", errDesription
proc fetchReceivedVerificationRequests*(self: Service): seq[VerificationRequest] =
try:
let response = status_contacts.getReceivedVerificationRequests()
for request in response.result:
result.add(request.toVerificationRequest())
except Exception as e:
let errDesription = e.msg
error "error obtaining verification requests", errDesription
proc getReceivedVerificationRequests*(self: Service): seq[VerificationRequest] =
result = toSeq(self.receivedIdentityRequests.values)
proc sendVerificationRequest*(self: Service, publicKey: string, challenge: string) =
try:
let response = status_contacts.sendVerificationRequest(publicKey, challenge)
if not response.error.isNil:
error "error sending contact verification request", msg = response.error.message
return
var contact = self.getContactById(publicKey)
contact.verificationStatus = VerificationStatus.Verifying
self.saveContact(contact)
self.events.emit(SIGNAL_CONTACT_VERIFICATION_SENT, ContactArgs(contactId: publicKey))
checkAndEmitACNotificationsFromResponse(self.events, response.result{"activityCenterNotifications"})
except Exception as e:
error "Error sending verification request", msg = e.msg
proc cancelVerificationRequest*(self: Service, publicKey: string) =
try:
var response = status_contacts.getVerificationRequestSentTo(publicKey)
if not response.error.isNil:
let msg = response.error.message
raise newException(RpcException, msg)
let request = response.result.toVerificationRequest()
response = status_contacts.cancelVerificationRequest(request.id)
if not response.error.isNil:
error "error sending contact verification request", msg = response.error.message
return
var contact = self.getContactById(publicKey)
contact.verificationStatus = VerificationStatus.Unverified
self.saveContact(contact)
self.events.emit(SIGNAL_CONTACT_VERIFICATION_CANCELLED, ContactArgs(contactId: publicKey))
checkAndEmitACNotificationsFromResponse(self.events, response.result{"activityCenterNotifications"})
except Exception as e:
error "Error canceling verification request", msg = e.msg
proc acceptVerificationRequest*(self: Service, publicKey: string, responseText: string) =
try:
if not self.receivedIdentityRequests.contains(publicKey):
raise newException(ValueError, fmt"No verification request for public key: `{publicKey}`")
var request = self.receivedIdentityRequests[publicKey]
let response = status_contacts.acceptVerificationRequest(request.id, responseText)
if(not response.error.isNil):
let msg = response.error.message
raise newException(RpcException, msg)
request.status = VerificationStatus.Verified
request.response = responseText
request.repliedAt = getTime().toUnix * 1000
self.receivedIdentityRequests[publicKey] = request
self.events.emit(SIGNAL_CONTACT_VERIFICATION_ACCEPTED, VerificationRequestArgs(verificationRequest: request))
checkAndEmitACNotificationsFromResponse(self.events, response.result{"activityCenterNotifications"})
except Exception as e:
error "error accepting contact verification request", msg=e.msg
proc declineVerificationRequest*(self: Service, publicKey: string) =
try:
if not self.receivedIdentityRequests.contains(publicKey):
raise newException(ValueError, fmt"No verification request for public key: `{publicKey}`")
var request = self.receivedIdentityRequests[publicKey]
let response = status_contacts.declineVerificationRequest(request.id)
if(not response.error.isNil):
let msg = response.error.message
raise newException(RpcException, msg)
request.status = VerificationStatus.Declined
self.receivedIdentityRequests[publicKey] = request
self.events.emit(SIGNAL_CONTACT_VERIFICATION_DECLINED, ContactArgs(contactId: publicKey))
checkAndEmitACNotificationsFromResponse(self.events, response.result{"activityCenterNotifications"})
except Exception as e:
error "error declining contact verification request", msg=e.msg
proc asyncContactInfoLoaded*(self: Service, pubkeyAndRpcResponse: string) {.slot.} = proc asyncContactInfoLoaded*(self: Service, pubkeyAndRpcResponse: string) {.slot.} =
let rpcResponseObj = pubkeyAndRpcResponse.parseJson let rpcResponseObj = pubkeyAndRpcResponse.parseJson
let publicKey = rpcResponseObj{"publicKey"}.getStr let publicKey = rpcResponseObj{"publicKey"}.getStr

View File

@ -62,7 +62,6 @@ QtObject:
proc getNotifSettingGlobalMentions*(self: Service): string proc getNotifSettingGlobalMentions*(self: Service): string
proc getNotifSettingAllMessages*(self: Service): string proc getNotifSettingAllMessages*(self: Service): string
proc getNotifSettingContactRequests*(self: Service): string proc getNotifSettingContactRequests*(self: Service): string
proc getNotifSettingIdentityVerificationRequests*(self: Service): string
proc getNotificationSoundsEnabled*(self: Service): bool proc getNotificationSoundsEnabled*(self: Service): bool
proc getNotificationVolume*(self: Service): int proc getNotificationVolume*(self: Service): int
proc getNotificationMessagePreview*(self: Service): int proc getNotificationMessagePreview*(self: Service): int
@ -126,7 +125,6 @@ QtObject:
discard self.getNotifSettingGlobalMentions() discard self.getNotifSettingGlobalMentions()
discard self.getNotifSettingAllMessages() discard self.getNotifSettingAllMessages()
discard self.getNotifSettingContactRequests() discard self.getNotifSettingContactRequests()
discard self.getNotifSettingIdentityVerificationRequests()
discard self.getNotificationSoundsEnabled() discard self.getNotificationSoundsEnabled()
discard self.getNotificationVolume() discard self.getNotificationVolume()
discard self.getNotificationMessagePreview() discard self.getNotificationMessagePreview()
@ -781,40 +779,6 @@ QtObject:
write = setNotifSettingContactRequests write = setNotifSettingContactRequests
notify = notifSettingContactRequestsChanged notify = notifSettingContactRequestsChanged
proc notifSettingIdentityVerificationRequestsChanged*(self: Service) {.signal.}
proc getNotifSettingIdentityVerificationRequests*(self: Service): string {.slot.} =
if self.initialized:
return self.settings.notificationsIdentityVerificationRequests
result = VALUE_NOTIF_SEND_ALERTS #default value
try:
let response = status_settings.getIdentityVerificationRequests()
if(not response.error.isNil):
error "error reading identity verification request setting: ", errDescription = response.error.message
return
result = response.result.getStr
self.settings.notificationsIdentityVerificationRequests = result
except Exception as e:
let errDesription = e.msg
error "reading identity verification request setting error: ", errDesription
proc setNotifSettingIdentityVerificationRequests*(self: Service, value: string) {.slot.} =
try:
let response = status_settings.setIdentityVerificationRequests(value)
if(not response.error.isNil):
error "error saving identity verification request setting: ", errDescription = response.error.message
return
self.settings.notificationsIdentityVerificationRequests = value
self.notifSettingIdentityVerificationRequestsChanged()
except Exception as e:
let errDesription = e.msg
error "saving identity verification request setting error: ", errDesription
QtProperty[string] notifSettingIdentityVerificationRequests:
read = getNotifSettingIdentityVerificationRequests
write = setNotifSettingIdentityVerificationRequests
notify = notifSettingIdentityVerificationRequestsChanged
proc notificationSoundsEnabledChanged*(self: Service) {.signal.} proc notificationSoundsEnabledChanged*(self: Service) {.signal.}
proc getNotificationSoundsEnabled*(self: Service): bool {.slot.} = proc getNotificationSoundsEnabled*(self: Service): bool {.slot.} =
if self.initialized: if self.initialized:

View File

@ -79,58 +79,14 @@ proc markUntrustworthy*(pubkey: string): RpcResponse[JsonNode] =
let payload = %* [pubkey] let payload = %* [pubkey]
result = callPrivateRPC("markAsUntrustworthy".prefix, payload) result = callPrivateRPC("markAsUntrustworthy".prefix, payload)
proc verifiedTrusted*(requestId: string): RpcResponse[JsonNode] =
let payload = %*[{
"id": requestId
}]
result = callPrivateRPC("verifiedTrusted".prefix, payload)
proc verifiedUntrustworthy*(requestId: string): RpcResponse[JsonNode] =
let payload = %*[{
"id": requestId
}]
result = callPrivateRPC("verifiedUntrustworthy".prefix, payload)
proc removeTrustStatus*(pubkey: string): RpcResponse[JsonNode] = proc removeTrustStatus*(pubkey: string): RpcResponse[JsonNode] =
let payload = %* [pubkey] let payload = %* [pubkey]
result = callPrivateRPC("removeTrustStatus".prefix, payload) result = callPrivateRPC("removeTrustStatus".prefix, payload)
proc removeTrustVerificationStatus*(pubkey: string): RpcResponse[JsonNode] =
let payload = %* [pubkey]
result = callPrivateRPC("removeTrustVerificationStatus".prefix, payload)
proc getTrustStatus*(pubkey: string): RpcResponse[JsonNode] = proc getTrustStatus*(pubkey: string): RpcResponse[JsonNode] =
let payload = %* [pubkey] let payload = %* [pubkey]
result = callPrivateRPC("getTrustStatus".prefix, payload) result = callPrivateRPC("getTrustStatus".prefix, payload)
proc sendVerificationRequest*(pubkey: string, challenge: string): RpcResponse[JsonNode] =
let payload = %* [pubkey, challenge]
result = callPrivateRPC("sendContactVerificationRequest".prefix, payload)
proc acceptVerificationRequest*(requestId: string, response: string): RpcResponse[JsonNode] =
let payload = %* [requestId, response]
result = callPrivateRPC("acceptContactVerificationRequest".prefix, payload)
proc declineVerificationRequest*(requestId: string): RpcResponse[JsonNode] =
let payload = %* [requestId]
result = callPrivateRPC("declineContactVerificationRequest".prefix, payload)
proc getVerificationRequestSentTo*(pubkey: string): RpcResponse[JsonNode] =
let payload = %* [pubkey]
result = callPrivateRPC("getVerificationRequestSentTo".prefix, payload)
proc getVerificationRequestFrom*(pubkey: string): RpcResponse[JsonNode] =
let payload = %* [pubkey]
result = callPrivateRPC("getLatestVerificationRequestFrom".prefix, payload)
proc getReceivedVerificationRequests*(): RpcResponse[JsonNode] =
let payload = %* []
result = callPrivateRPC("getReceivedVerificationRequests".prefix, payload)
proc cancelVerificationRequest*(requestId: string): RpcResponse[JsonNode] =
let payload = %* [requestId]
result = callPrivateRPC("cancelVerificationRequest".prefix, payload)
proc retractContactRequest*(pubkey: string): RpcResponse[JsonNode] = proc retractContactRequest*(pubkey: string): RpcResponse[JsonNode] =
let payload = %*[{ let payload = %*[{
"id": pubkey "id": pubkey

View File

@ -52,12 +52,6 @@ proc getContactRequests*(): RpcResponse[JsonNode] =
proc setContactRequests*(value: string): RpcResponse[JsonNode] = proc setContactRequests*(value: string): RpcResponse[JsonNode] =
return core.callPrivateRPC("settings_notificationsSetContactRequests", %* [value]) return core.callPrivateRPC("settings_notificationsSetContactRequests", %* [value])
proc getIdentityVerificationRequests*(): RpcResponse[JsonNode] =
return core.callPrivateRPC("settings_notificationsGetIdentityVerificationRequests")
proc setIdentityVerificationRequests*(value: string): RpcResponse[JsonNode] =
return core.callPrivateRPC("settings_notificationsSetIdentityVerificationRequests", %* [value])
proc getSoundEnabled*(): RpcResponse[JsonNode] = proc getSoundEnabled*(): RpcResponse[JsonNode] =
return core.callPrivateRPC("settings_notificationsGetSoundEnabled") return core.callPrivateRPC("settings_notificationsGetSoundEnabled")

View File

@ -96,7 +96,6 @@ SplitView {
removed: false, removed: false,
trustStatus: Constants.trustStatus.unknown, trustStatus: Constants.trustStatus.unknown,
verificationStatus: Constants.verificationStatus.unverified, verificationStatus: Constants.verificationStatus.unverified,
incomingVerificationStatus: Constants.verificationStatus.unverified
}) })
} }

View File

@ -96,14 +96,6 @@ SplitView {
Layout.fillWidth: true Layout.fillWidth: true
text: "contactRequestState: " + contactDetails.contactRequestState text: "contactRequestState: " + contactDetails.contactRequestState
} }
Label {
Layout.fillWidth: true
text: "incomingVerificationStatus: " + contactDetails.incomingVerificationStatus
}
Label {
Layout.fillWidth: true
text: "outgoingVerificationStatus: " + contactDetails.outgoingVerificationStatus
}
Pane { Pane {
contentItem: RowLayout { contentItem: RowLayout {
@ -168,8 +160,6 @@ SplitView {
isUntrustworthy: false, isUntrustworthy: false,
isBlocked: false, isBlocked: false,
contactRequestState: 3, contactRequestState: 3,
incomingVerificationStatus: 3,
outgoingVerificationStatus: 2,
defaaaultDisplayName: "defaultDisplayName", defaaaultDisplayName: "defaultDisplayName",
optionalName: "optionalName", optionalName: "optionalName",
lastUpdated: 1234567890, lastUpdated: 1234567890,

View File

@ -157,7 +157,6 @@ SplitView {
removed: false, removed: false,
trustStatus: Constants.trustStatus.unknown, trustStatus: Constants.trustStatus.unknown,
verificationStatus: Constants.verificationStatus.unverified, verificationStatus: Constants.verificationStatus.unverified,
incomingVerificationStatus: Constants.verificationStatus.unverified
}) })
} }

View File

@ -85,7 +85,6 @@ SplitView {
isSyncing: false, isSyncing: false,
trustStatus: ctrlTrustStatus.currentValue, trustStatus: ctrlTrustStatus.currentValue,
verificationStatus: ctrlVerificationStatus.currentValue, verificationStatus: ctrlVerificationStatus.currentValue,
incomingVerificationStatus: ctrlIncomingVerificationStatus.currentValue,
contactRequestState: ctrlContactRequestState.currentValue, contactRequestState: ctrlContactRequestState.currentValue,
bio: bio.text, bio: bio.text,
onlineStatus: ctrlOnlineStatus.currentValue onlineStatus: ctrlOnlineStatus.currentValue
@ -319,7 +318,6 @@ SplitView {
implicitWidth: 640 implicitWidth: 640
readOnly: ctrlReadOnly.checked readOnly: ctrlReadOnly.checked
idVerificationFlowsEnabled: true // enabled in SB
publicKey: switchOwnProfile.checked ? "0xdeadbeef" : "0xrandomguy" publicKey: switchOwnProfile.checked ? "0xdeadbeef" : "0xrandomguy"
onCloseRequested: logs.logEvent("closeRequested()") onCloseRequested: logs.logEvent("closeRequested()")
@ -537,38 +535,6 @@ SplitView {
RowLayout { RowLayout {
Layout.fillWidth: true Layout.fillWidth: true
Label { text: "incomingVerificationStatus:" }
ComboBox {
id: ctrlIncomingVerificationStatus
enabled: ctrlIsContact.checked && !switchOwnProfile.checked
textRole: "text"
valueRole: "value"
model: [
{ value: Constants.verificationStatus.unverified, text: "unverified" },
{ value: Constants.verificationStatus.verifying, text: "verifying" },
{ value: Constants.verificationStatus.verified, text: "verified" },
{ value: Constants.verificationStatus.declined, text: "declined" },
{ value: Constants.verificationStatus.canceled, text: "canceled" },
{ value: Constants.verificationStatus.trusted, text: "trusted" },
{ value: Constants.verificationStatus.untrustworthy, text: "untrustworthy" }
]
}
Label { text: "verificationStatus:" }
ComboBox {
id: ctrlVerificationStatus
enabled: ctrlIsContact.checked && !switchOwnProfile.checked
textRole: "text"
valueRole: "value"
model: [
{ value: Constants.verificationStatus.unverified, text: "unverified" },
{ value: Constants.verificationStatus.verifying, text: "verifying" },
{ value: Constants.verificationStatus.verified, text: "verified" },
{ value: Constants.verificationStatus.declined, text: "declined" },
{ value: Constants.verificationStatus.canceled, text: "canceled" },
{ value: Constants.verificationStatus.trusted, text: "trusted" },
{ value: Constants.verificationStatus.untrustworthy, text: "untrustworthy" }
]
}
Button { Button {
text: "Send ID request" text: "Send ID request"
onClicked: { onClicked: {

View File

@ -46,8 +46,6 @@ Item {
isUntrustworthy: false, isUntrustworthy: false,
isBlocked: false, isBlocked: false,
contactRequest: 3, contactRequest: 3,
incomingVerificationStatus: 3,
outgoingVerificationStatus: 2,
defaultDisplayName: "defaultDisplayName", defaultDisplayName: "defaultDisplayName",
optionalName: "optionalName", optionalName: "optionalName",
lastUpdated: 1234567890, lastUpdated: 1234567890,
@ -151,8 +149,6 @@ Item {
compare(contactDetails.isUntrustworthy, false, "Expected the isUntrustworthy flag to be set") compare(contactDetails.isUntrustworthy, false, "Expected the isUntrustworthy flag to be set")
compare(contactDetails.isBlocked, false, "Expected the isBlocked flag to be set") compare(contactDetails.isBlocked, false, "Expected the isBlocked flag to be set")
compare(contactDetails.contactRequestState, 3, "Expected the contactRequestState flag to be set") compare(contactDetails.contactRequestState, 3, "Expected the contactRequestState flag to be set")
compare(contactDetails.incomingVerificationStatus, 3, "Expected the incomingVerificationStatus flag to be set")
compare(contactDetails.outgoingVerificationStatus, 2, "Expected the outgoingVerificationStatus flag to be set")
compare(contactDetails.defaultDisplayName, "defaultDisplayName", "Expected the defaultDisplayName to be set") compare(contactDetails.defaultDisplayName, "defaultDisplayName", "Expected the defaultDisplayName to be set")
compare(contactDetails.optionalName, "optionalName", "Expected the optionalName to be set") compare(contactDetails.optionalName, "optionalName", "Expected the optionalName to be set")
compare(contactDetails.lastUpdated, 1234567890, "Expected the lastUpdated to be set") compare(contactDetails.lastUpdated, 1234567890, "Expected the lastUpdated to be set")
@ -260,8 +256,6 @@ Item {
isUntrustworthy: true, isUntrustworthy: true,
isBlocked: true, isBlocked: true,
contactRequest: 2, contactRequest: 2,
incomingVerificationStatus: 2,
outgoingVerificationStatus: 1,
defaultDisplayName: "newDefaultDisplayName", defaultDisplayName: "newDefaultDisplayName",
optionalName: "newOptionalName", optionalName: "newOptionalName",
lastUpdated: 1234567891, lastUpdated: 1234567891,
@ -295,8 +289,6 @@ Item {
compare(contactDetails.isUntrustworthy, true, "Expected the isUntrustworthy flag to be set") compare(contactDetails.isUntrustworthy, true, "Expected the isUntrustworthy flag to be set")
compare(contactDetails.isBlocked, true, "Expected the isBlocked flag to be set") compare(contactDetails.isBlocked, true, "Expected the isBlocked flag to be set")
compare(contactDetails.contactRequestState, 2, "Expected the contactRequestState flag to be set") compare(contactDetails.contactRequestState, 2, "Expected the contactRequestState flag to be set")
compare(contactDetails.incomingVerificationStatus, 2, "Expected the incomingVerificationStatus flag to be set")
compare(contactDetails.outgoingVerificationStatus, 1, "Expected the outgoingVerificationStatus flag to be set")
compare(contactDetails.defaultDisplayName, "newDefaultDisplayName", "Expected the defaultDisplayName to be set") compare(contactDetails.defaultDisplayName, "newDefaultDisplayName", "Expected the defaultDisplayName to be set")
compare(contactDetails.optionalName, "newOptionalName", "Expected the optionalName to be set") compare(contactDetails.optionalName, "newOptionalName", "Expected the optionalName to be set")
compare(contactDetails.lastUpdated, 1234567891, "Expected the lastUpdated to be set") compare(contactDetails.lastUpdated, 1234567891, "Expected the lastUpdated to be set")

View File

@ -13,7 +13,7 @@ proc createTestMemberItem(pubKey: string): MemberItem =
alias = "", alias = "",
icon = "", icon = "",
colorId = 0, colorId = 0,
isVerified = false, trustStatus = TrustStatus.Unknown,
) )
let memberA = createTestMemberItem("0xa") let memberA = createTestMemberItem("0xa")
@ -44,10 +44,9 @@ suite "updating member items":
alias = "", alias = "",
icon = "", icon = "",
isContact = false, isContact = false,
isVerified = false,
memberRole = MemberRole.None, memberRole = MemberRole.None,
joined = false, joined = false,
isUntrustworthy = false, trustStatus = TrustStatus.Unknown,
callDataChanged = false, callDataChanged = false,
) )
# Two updated roles, because preferredDisplayName gets updated too # Two updated roles, because preferredDisplayName gets updated too
@ -65,10 +64,9 @@ suite "updating member items":
alias = "", alias = "",
icon = "icon", icon = "icon",
isContact = true, isContact = true,
isVerified = false,
memberRole = MemberRole.None, memberRole = MemberRole.None,
joined = false, joined = false,
isUntrustworthy = false, trustStatus = TrustStatus.Unknown,
callDataChanged = false, callDataChanged = false,
) )
check(updatedRoles.len() == 2) check(updatedRoles.len() == 2)

View File

@ -83,7 +83,7 @@ Row {
return qsTr("Blocked") return qsTr("Blocked")
if (root.isContact) { if (root.isContact) {
if (root.trustIndicator === StatusContactVerificationIcons.TrustedType.Verified) if (root.trustIndicator === StatusContactVerificationIcons.TrustedType.Verified)
return qsTr("ID verified contact") return qsTr("Trusted contact")
if (root.trustIndicator === StatusContactVerificationIcons.TrustedType.Untrustworthy) if (root.trustIndicator === StatusContactVerificationIcons.TrustedType.Untrustworthy)
return qsTr("Untrusted contact") return qsTr("Untrusted contact")
return qsTr("Contact") return qsTr("Contact")

View File

@ -108,7 +108,7 @@ ItemDelegate {
userName: ProfileUtils.displayName("", root.contactDetails.ensName, root.contactDetails.displayName, root.contactDetails.alias) userName: ProfileUtils.displayName("", root.contactDetails.ensName, root.contactDetails.displayName, root.contactDetails.alias)
pubKey: root.contactDetails.isEnsVerified ? "" : Utils.getCompressedPk(root.contactId) pubKey: root.contactDetails.isEnsVerified ? "" : Utils.getCompressedPk(root.contactId)
isContact: root.contactDetails.isContact isContact: root.contactDetails.isContact
isVerified: root.contactDetails.verificationStatus === Constants.verificationStatus.verified isVerified: root.contactDetails.trustStatus === Constants.trustStatus.trusted
isUntrustworthy: root.contactDetails.trustStatus === Constants.trustStatus.untrustworthy isUntrustworthy: root.contactDetails.trustStatus === Constants.trustStatus.untrustworthy
isAdmin: root.contactDetails.memberRole === Constants.memberRole.owner isAdmin: root.contactDetails.memberRole === Constants.memberRole.owner
status: root.contactDetails.onlineStatus status: root.contactDetails.onlineStatus

View File

@ -318,7 +318,7 @@ StatusScrollView {
userName: ProfileUtils.displayName("", model.ensName, model.displayName, model.alias) userName: ProfileUtils.displayName("", model.ensName, model.displayName, model.alias)
pubKey: model.isEnsVerified ? "" : Utils.getCompressedPk(model.pubKey) pubKey: model.isEnsVerified ? "" : Utils.getCompressedPk(model.pubKey)
isContact: model.isContact isContact: model.isContact
isVerified: model.verificationStatus === Constants.verificationStatus.verified isVerified: model.trustStatus === Constants.trustStatus.trusted
isUntrustworthy: model.trustStatus === Constants.trustStatus.untrustworthy isUntrustworthy: model.trustStatus === Constants.trustStatus.untrustworthy
status: model.onlineStatus status: model.onlineStatus
icon.name: model.icon icon.name: model.icon

View File

@ -113,11 +113,6 @@ StatusDraggableListItem {
showcaseVisibility: Constants.ShowcaseVisibility.Contacts showcaseVisibility: Constants.ShowcaseVisibility.Contacts
text: enabled ? qsTr("Contacts") : qsTr("Contacts (set account to Contacts)") text: enabled ? qsTr("Contacts") : qsTr("Contacts (set account to Contacts)")
} }
ShowcaseVisibilityAction {
id: idVerifiedContactsAction
showcaseVisibility: Constants.ShowcaseVisibility.IdVerifiedContacts
text: enabled ? qsTr("ID verified contacts") : qsTr("ID verified contacts (set account to ID verified contacts)")
}
StatusMenuSeparator {} StatusMenuSeparator {}

View File

@ -32,8 +32,6 @@ QObject {
readonly property bool isUntrustworthy: d.contactDetails.isUntrustworthy ?? false readonly property bool isUntrustworthy: d.contactDetails.isUntrustworthy ?? false
readonly property bool isBlocked: d.contactDetails.isBlocked ?? false readonly property bool isBlocked: d.contactDetails.isBlocked ?? false
readonly property int contactRequestState: d.contactDetails.contactRequest ?? Constants.ContactRequestState.None readonly property int contactRequestState: d.contactDetails.contactRequest ?? Constants.ContactRequestState.None
readonly property int incomingVerificationStatus: d.contactDetails.incomingVerificationStatus ?? Constants.verificationStatus.unverified
readonly property int outgoingVerificationStatus: d.contactDetails.outgoingVerificationStatus ?? Constants.verificationStatus.unverified
readonly property string defaultDisplayName: d.contactDetails.defaultDisplayName ?? "" readonly property string defaultDisplayName: d.contactDetails.defaultDisplayName ?? ""
readonly property string optionalName: d.contactDetails.optionalName ?? "" readonly property string optionalName: d.contactDetails.optionalName ?? ""
readonly property int lastUpdated: d.contactDetails.lastUpdated ?? 0 readonly property int lastUpdated: d.contactDetails.lastUpdated ?? 0
@ -50,11 +48,9 @@ QObject {
// Backwards compatibility properties - Don't use in new code // Backwards compatibility properties - Don't use in new code
// TODO: #14965 - Try to remove these properties // TODO: #14965 - Try to remove these properties
readonly property string name: ensName readonly property string name: ensName
readonly property int verificationStatus: outgoingVerificationStatus
// Extra properties provided by getContactDetailsAsJson, not available in the model // Extra properties provided by getContactDetailsAsJson, not available in the model
// TODO: #14964 - Review all the model rolenames and fill the rest of the properties with data from the model // TODO: #14964 - Review all the model rolenames and fill the rest of the properties with data from the model
//readonly property int verificationStatus: d.contactDetails.verificationStatus ?? Constants.verificationStatus.unverified
//readonly property var socialLinks: d.contactDetails.socialLinks ?? [] //readonly property var socialLinks: d.contactDetails.socialLinks ?? []
ModelEntry { ModelEntry {
@ -91,8 +87,6 @@ QObject {
readonly property bool isUntrustworthy: false readonly property bool isUntrustworthy: false
readonly property bool isBlocked: false readonly property bool isBlocked: false
readonly property int contactRequestState: Constants.ContactRequestState.None readonly property int contactRequestState: Constants.ContactRequestState.None
readonly property int incomingVerificationStatus: Constants.verificationStatus.unverified
readonly property int outgoingVerificationStatus: Constants.verificationStatus.unverified
readonly property string defaultDisplayName: root.profileStore.defaultDisplayName readonly property string defaultDisplayName: root.profileStore.defaultDisplayName
readonly property string optionalName: defaultDisplayName readonly property string optionalName: defaultDisplayName
readonly property string name: defaultDisplayName readonly property string name: defaultDisplayName

View File

@ -69,18 +69,6 @@ StatusListItem {
} }
components: [ components: [
StatusFlatButton {
objectName: "idVerifyBtn"
visible: verificationRequestStatus === Constants.verificationStatus.verifying ||
verificationRequestStatus === Constants.verificationStatus.verified
width: visible ? implicitWidth : 0
height: visible ? implicitHeight : 0
text: verificationRequestStatus === Constants.verificationStatus.verifying ?
qsTr("Reply to ID verification request") :
qsTr("Review ID verification reply")
size: StatusBaseButton.Size.Small
onClicked: root.showVerificationRequest(root.publicKey)
},
StatusFlatRoundButton { StatusFlatRoundButton {
objectName: "chatBtn" objectName: "chatBtn"
visible: showSendMessageButton visible: showSendMessageButton

View File

@ -114,7 +114,6 @@ Item {
isBlocked: model.isBlocked isBlocked: model.isBlocked
isVerified: model.isVerified isVerified: model.isVerified
isUntrustworthy: model.isUntrustworthy isUntrustworthy: model.isUntrustworthy
verificationRequestStatus: model.incomingVerificationStatus
showSendMessageButton: isContact && !isBlocked showSendMessageButton: isContact && !isBlocked
onOpenContactContextMenu: function (publicKey, name, icon) { onOpenContactContextMenu: function (publicKey, name, icon) {

View File

@ -262,8 +262,7 @@ DoubleFlickableWithFolding {
(d.isAnyHiddenDragActive || (d.isAnyHiddenDragActive ||
parent.containsDrag || parent.containsDrag ||
everyoneContainsDrag || everyoneContainsDrag ||
contactsContainsDrag || contactsContainsDrag)
verifiedContainsDrag)
} }
} }
@ -414,7 +413,6 @@ DoubleFlickableWithFolding {
readonly property bool everyoneContainsDrag: dropAreaEveryone.containsDrag readonly property bool everyoneContainsDrag: dropAreaEveryone.containsDrag
readonly property bool contactsContainsDrag: dropAreaContacts.containsDrag readonly property bool contactsContainsDrag: dropAreaContacts.containsDrag
readonly property bool verifiedContainsDrag: dropAreaVerified.containsDrag
property int margins: Theme.halfPadding property int margins: Theme.halfPadding
RowLayout { RowLayout {
@ -439,15 +437,6 @@ DoubleFlickableWithFolding {
text: qsTr("Contacts") text: qsTr("Contacts")
dropAreaKeys: d.dragHiddenItemKey dropAreaKeys: d.dragHiddenItemKey
} }
VisibilityDropAreaButton {
id: dropAreaVerified
Layout.fillWidth: true
Layout.fillHeight: true
showcaseVisibility: Constants.ShowcaseVisibility.IdVerifiedContacts
text: qsTr("Verified")
dropAreaKeys: d.dragHiddenItemKey
}
} }
} }

View File

@ -127,46 +127,6 @@ QtObject {
root.contactsModule.removeTrustStatus(pubKey) root.contactsModule.removeTrustStatus(pubKey)
} }
function removeTrustVerificationStatus(pubKey) {
root.contactsModule.removeTrustVerificationStatus(pubKey)
}
function sendVerificationRequest(pubKey, challenge) {
root.contactsModule.sendVerificationRequest(pubKey, challenge);
Global.displaySuccessToastMessage(qsTr("ID verification request sent"))
}
function cancelVerificationRequest(pubKey) {
root.contactsModule.cancelVerificationRequest(pubKey);
Global.displaySuccessToastMessage(qsTr("ID verification request cancelled"))
}
function declineVerificationRequest(pubKey) {
root.contactsModule.declineVerificationRequest(pubKey);
}
function acceptVerificationRequest(pubKey, response) {
root.contactsModule.acceptVerificationRequest(pubKey, response);
}
function getVerificationDetailsFromAsJson(pubKey) {
let resp = root.contactsModule.getVerificationDetailsFromAsJson(pubKey);
return JSON.parse(resp);
}
function getSentVerificationDetailsAsJson(pubKey) {
let resp = root.contactsModule.getSentVerificationDetailsAsJson(pubKey);
return JSON.parse(resp);
}
function verifiedTrusted(pubKey) {
root.contactsModule.verifiedTrusted(pubKey);
}
function verifiedUntrustworthy(pubKey) {
root.contactsModule.verifiedUntrustworthy(pubKey);
}
function requestContactInfo(publicKey) { function requestContactInfo(publicKey) {
root.contactsModule.requestContactInfo(publicKey) root.contactsModule.requestContactInfo(publicKey)
} }

View File

@ -165,7 +165,7 @@ SettingsContentBase {
ContactsListPanel { ContactsListPanel {
id: verifiedContacts id: verifiedContacts
Layout.fillWidth: true Layout.fillWidth: true
title: qsTr("Identity Verified Contacts") title: qsTr("Trusted Contacts")
visible: !noFriendsItem.visible && count > 0 visible: !noFriendsItem.visible && count > 0
contactsModel: root.contactsStore.myContactsModel contactsModel: root.contactsStore.myContactsModel
searchString: searchBox.text searchString: searchBox.text
@ -246,10 +246,6 @@ SettingsContentBase {
onContactRequestRejected: { onContactRequestRejected: {
root.contactsStore.dismissContactRequest(publicKey, "") root.contactsStore.dismissContactRequest(publicKey, "")
} }
onShowVerificationRequest: {
Global.openIncomingIDRequestPopup(publicKey, null, null)
}
} }
ContactsListPanel { ContactsListPanel {

View File

@ -312,21 +312,6 @@ SettingsContentBase {
] ]
} }
StatusListItem {
// Hidden since 2.29 since it's not mature enough
visible: false
Layout.preferredWidth: root.contentWidth
title: qsTr("Identity Verification Requests")
components: [
NotificationSelect {
selected: appSettings.notifSettingIdentityVerificationRequests
onSendAlertsClicked: appSettings.notifSettingIdentityVerificationRequests = Constants.settingsSection.notifications.sendAlertsValue
onDeliverQuietlyClicked: appSettings.notifSettingIdentityVerificationRequests = Constants.settingsSection.notifications.deliverQuietlyValue
onTurnOffClicked: appSettings.notifSettingIdentityVerificationRequests = Constants.settingsSection.notifications.turnOffValue
}
]
}
Separator { Separator {
Layout.preferredWidth: root.contentWidth Layout.preferredWidth: root.contentWidth
Layout.preferredHeight: Theme.bigPadding Layout.preferredHeight: Theme.bigPadding

View File

@ -61,11 +61,8 @@ QtObject {
property var activePopupComponents: [] property var activePopupComponents: []
Component.onCompleted: { Component.onCompleted: {
Global.openSendIDRequestPopup.connect(openSendIDRequestPopup)
Global.openMarkAsIDVerifiedPopup.connect(openMarkAsIDVerifiedPopup) Global.openMarkAsIDVerifiedPopup.connect(openMarkAsIDVerifiedPopup)
Global.openRemoveIDVerificationDialog.connect(openRemoveIDVerificationDialog) Global.openRemoveIDVerificationDialog.connect(openRemoveIDVerificationDialog)
Global.openOutgoingIDRequestPopup.connect(openOutgoingIDRequestPopup)
Global.openIncomingIDRequestPopup.connect(openIncomingIDRequestPopup)
Global.openInviteFriendsToCommunityPopup.connect(openInviteFriendsToCommunityPopup) Global.openInviteFriendsToCommunityPopup.connect(openInviteFriendsToCommunityPopup)
Global.openInviteFriendsToCommunityByIdPopup.connect(openInviteFriendsToCommunityByIdPopup) Global.openInviteFriendsToCommunityByIdPopup.connect(openInviteFriendsToCommunityByIdPopup)
Global.openContactRequestPopup.connect(openContactRequestPopup) Global.openContactRequestPopup.connect(openContactRequestPopup)
@ -185,17 +182,6 @@ QtObject {
openPopup(communityProfilePopup, { store: store, community: community, communitySectionModule: communitySectionModule}) openPopup(communityProfilePopup, { store: store, community: community, communitySectionModule: communitySectionModule})
} }
function openSendIDRequestPopup(publicKey, contactDetails, cb) {
openPopup(sendIDRequestPopupComponent, {
publicKey: publicKey,
contactDetails: contactDetails,
title: qsTr("Request ID verification"),
labelText: qsTr("Ask a question only they can answer"),
challengeText: qsTr("Ask your question..."),
buttonText: qsTr("Request ID verification")
}, cb)
}
function openMarkAsIDVerifiedPopup(publicKey, contactDetails, cb) { function openMarkAsIDVerifiedPopup(publicKey, contactDetails, cb) {
openPopup(markAsIDVerifiedPopupComponent, {publicKey, contactDetails}, cb) openPopup(markAsIDVerifiedPopupComponent, {publicKey, contactDetails}, cb)
} }
@ -204,32 +190,6 @@ QtObject {
openPopup(removeIDVerificationPopupComponent, {publicKey, contactDetails}, cb) openPopup(removeIDVerificationPopupComponent, {publicKey, contactDetails}, cb)
} }
function openOutgoingIDRequestPopup(publicKey, contactDetails, cb) {
let details = contactDetails ?? Utils.getContactDetailsAsJson(publicKey)
try {
const verificationDetails = rootStore.contactStore.getSentVerificationDetailsAsJson(publicKey)
const popupProperties = {
publicKey: publicKey,
contactDetails: details,
verificationStatus: verificationDetails.requestStatus,
verificationChallenge: verificationDetails.challenge,
verificationResponse: verificationDetails.response,
verificationResponseDisplayName: verificationDetails.displayName,
verificationResponseIcon: verificationDetails.icon,
verificationRequestedAt: verificationDetails.requestedAt,
verificationRepliedAt: verificationDetails.repliedAt
}
openPopup(contactOutgoingVerificationRequestPopupComponent, popupProperties, cb)
} catch (e) {
console.error("Error getting or parsing verification data", e)
}
}
function openIncomingIDRequestPopup(publicKey, contactDetails, cb) {
let details = contactDetails ?? Utils.getContactDetailsAsJson(publicKey)
openPopup(contactVerificationRequestPopupComponent, {publicKey, contactDetails: details})
}
function openInviteFriendsToCommunityPopup(community, communitySectionModule, cb) { function openInviteFriendsToCommunityPopup(community, communitySectionModule, cb) {
openPopup(inviteFriendsToCommunityPopup, { community: community, communitySectionModule: communitySectionModule }, cb) openPopup(inviteFriendsToCommunityPopup, { community: community, communitySectionModule: communitySectionModule }, cb)
} }
@ -421,7 +381,7 @@ QtObject {
onAccepted: { onAccepted: {
rootStore.contactStore.removeContact(publicKey) rootStore.contactStore.removeContact(publicKey)
if (removeIDVerification) if (removeIDVerification)
rootStore.contactStore.removeTrustVerificationStatus(publicKey) rootStore.contactStore.removeTrustStatus(publicKey)
if (markAsUntrusted) { if (markAsUntrusted) {
rootStore.contactStore.markUntrustworthy(publicKey) rootStore.contactStore.markUntrustworthy(publicKey)
Global.displaySuccessToastMessage(qsTr("%1 removed from contacts and marked as untrusted").arg(mainDisplayName)) Global.displaySuccessToastMessage(qsTr("%1 removed from contacts and marked as untrusted").arg(mainDisplayName))
@ -433,52 +393,6 @@ QtObject {
onClosed: destroy() onClosed: destroy()
} }
}, },
Component {
id: contactVerificationRequestPopupComponent
ContactVerificationRequestPopup {
contactsStore: rootStore.contactStore
onResponseSent: (senderPublicKey, response) => {
contactsStore.acceptVerificationRequest(senderPublicKey, response)
Global.displaySuccessToastMessage(qsTr("ID verification reply sent"))
}
onVerificationRefused: (senderPublicKey) => {
contactsStore.declineVerificationRequest(senderPublicKey)
Global.displaySuccessToastMessage(qsTr("ID verification request declined"))
}
onClosed: destroy()
}
},
Component {
id: contactOutgoingVerificationRequestPopupComponent
OutgoingContactVerificationRequestPopup {
profileStore: root.profileStore
utilsStore: root.utilsStore
onVerificationRequestCanceled: {
rootStore.contactStore.cancelVerificationRequest(publicKey)
}
onUntrustworthyVerified: {
rootStore.contactStore.verifiedUntrustworthy(publicKey)
Global.displaySuccessToastMessage(qsTr("%1 marked as untrusted").arg(mainDisplayName))
}
onTrustedVerified: {
rootStore.contactStore.verifiedTrusted(publicKey)
Global.displaySuccessToastMessage(qsTr("%1 ID verified").arg(mainDisplayName))
}
onClosed: destroy()
}
},
Component {
id: sendIDRequestPopupComponent
SendContactRequestModal {
rootStore: root.rootStore
onAccepted: rootStore.contactStore.sendVerificationRequest(publicKey, message)
onClosed: destroy()
}
},
Component { Component {
id: markAsIDVerifiedPopupComponent id: markAsIDVerifiedPopupComponent
@ -487,7 +401,7 @@ QtObject {
onAccepted: { onAccepted: {
rootStore.contactStore.markAsTrusted(publicKey) rootStore.contactStore.markAsTrusted(publicKey)
Global.displaySuccessToastMessage(qsTr("%1 ID verified").arg(mainDisplayName)) Global.displaySuccessToastMessage(qsTr("%1 marked as trusted").arg(mainDisplayName))
close() close()
} }
onClosed: destroy() onClosed: destroy()
@ -500,20 +414,20 @@ QtObject {
utilsStore: root.utilsStore utilsStore: root.utilsStore
onAccepted: { onAccepted: {
rootStore.contactStore.removeTrustVerificationStatus(publicKey) rootStore.contactStore.removeTrustStatus(publicKey)
if (markAsUntrusted && removeContact) { if (markAsUntrusted && removeContact) {
rootStore.contactStore.markUntrustworthy(publicKey) rootStore.contactStore.markUntrustworthy(publicKey)
rootStore.contactStore.removeContact(publicKey) rootStore.contactStore.removeContact(publicKey)
Global.displaySuccessToastMessage(qsTr("%1 ID verification removed, removed from contacts and marked as untrusted").arg(mainDisplayName)) Global.displaySuccessToastMessage(qsTr("%1 trust mark removed, removed from contacts and marked as untrusted").arg(mainDisplayName))
} else if (markAsUntrusted) { } else if (markAsUntrusted) {
rootStore.contactStore.markUntrustworthy(publicKey) rootStore.contactStore.markUntrustworthy(publicKey)
Global.displaySuccessToastMessage(qsTr("%1 ID verification removed and marked as untrusted").arg(mainDisplayName)) Global.displaySuccessToastMessage(qsTr("%1 trust mark removed and marked as untrusted").arg(mainDisplayName))
} else if (removeContact) { } else if (removeContact) {
rootStore.contactStore.removeContact(publicKey) rootStore.contactStore.removeContact(publicKey)
Global.displaySuccessToastMessage(qsTr("%1 ID verification removed and removed from contacts").arg(mainDisplayName)) Global.displaySuccessToastMessage(qsTr("%1 trust mark removed and removed from contacts").arg(mainDisplayName))
} else { } else {
Global.displaySuccessToastMessage(qsTr("%1 ID verification removed").arg(mainDisplayName)) Global.displaySuccessToastMessage(qsTr("%1 trust mark removed").arg(mainDisplayName))
} }
close() close()
} }
@ -732,7 +646,7 @@ QtObject {
onAccepted: { onAccepted: {
rootStore.contactStore.blockContact(publicKey) rootStore.contactStore.blockContact(publicKey)
if (removeIDVerification) if (removeIDVerification)
rootStore.contactStore.removeTrustVerificationStatus(publicKey) rootStore.contactStore.removeTrustStatus(publicKey)
if (removeContact) if (removeContact)
rootStore.contactStore.removeContact(publicKey) rootStore.contactStore.removeContact(publicKey)
Global.displaySuccessToastMessage(qsTr("%1 blocked").arg(mainDisplayName)) Global.displaySuccessToastMessage(qsTr("%1 blocked").arg(mainDisplayName))

View File

@ -19,7 +19,6 @@ Item {
property bool hasMentions: false property bool hasMentions: false
property bool hasReplies: false property bool hasReplies: false
property bool hasContactRequests: false property bool hasContactRequests: false
property bool hasIdentityVerification: false
property bool hasMembership: false property bool hasMembership: false
property bool hideReadNotifications: false property bool hideReadNotifications: false
@ -55,8 +54,6 @@ Item {
{ text: qsTr("Mentions"), group: ActivityCenterStore.ActivityCenterGroup.Mentions, visible: true, enabled: root.hasMentions }, { text: qsTr("Mentions"), group: ActivityCenterStore.ActivityCenterGroup.Mentions, visible: true, enabled: root.hasMentions },
{ text: qsTr("Replies"), group: ActivityCenterStore.ActivityCenterGroup.Replies, visible: true, enabled: root.hasReplies }, { text: qsTr("Replies"), group: ActivityCenterStore.ActivityCenterGroup.Replies, visible: true, enabled: root.hasReplies },
{ text: qsTr("Contact requests"), group: ActivityCenterStore.ActivityCenterGroup.ContactRequests, visible: true, enabled: root.hasContactRequests }, { text: qsTr("Contact requests"), group: ActivityCenterStore.ActivityCenterGroup.ContactRequests, visible: true, enabled: root.hasContactRequests },
// Hidden since 2.29 since it's not mature enough
{ text: qsTr("Identity verification"), group: ActivityCenterStore.ActivityCenterGroup.IdentityVerification, visible: false, enabled: root.hasIdentityVerification },
{ text: qsTr("Transactions"), group: ActivityCenterStore.ActivityCenterGroup.Transactions, visible: false, enabled: true }, { text: qsTr("Transactions"), group: ActivityCenterStore.ActivityCenterGroup.Transactions, visible: false, enabled: true },
{ text: qsTr("Membership"), group: ActivityCenterStore.ActivityCenterGroup.Membership, visible: true, enabled: root.hasMembership }, { text: qsTr("Membership"), group: ActivityCenterStore.ActivityCenterGroup.Membership, visible: true, enabled: root.hasMembership },
{ text: qsTr("System"), group: ActivityCenterStore.ActivityCenterGroup.System, visible: false, enabled: true } ] { text: qsTr("System"), group: ActivityCenterStore.ActivityCenterGroup.System, visible: false, enabled: true } ]

View File

@ -1,50 +0,0 @@
import QtQuick 2.14
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Controls 0.1
import shared 1.0
import utils 1.0
StatusFlatButton {
id: root
property int verificationStatus: -1
signal activate()
enabled: verificationStatus === Constants.verificationStatus.verifying ||
verificationStatus === Constants.verificationStatus.verified
size: StatusBaseButton.Size.Small
text: {
switch (verificationStatus) {
case Constants.verificationStatus.verifying:
return qsTr("Answer")
case Constants.verificationStatus.verified:
return qsTr("Edit Answer")
case Constants.verificationStatus.canceled:
return qsTr("Canceled")
case Constants.verificationStatus.declined:
return qsTr("Declined")
// That should never happen
case Constants.verificationStatus.trusted:
case Constants.verificationStatus.untrustworthy:
case Constants.verificationStatus.unverified:
default:
return qsTr("Unknown")
}
}
disabledTextColor: {
switch (verificationStatus) {
case Constants.verificationStatus.declined:
return Theme.palette.dangerColor1
case Constants.verificationStatus.trusted:
return Theme.palette.successColor1
default:
return Theme.palette.baseColor1
}
}
onClicked: root.activate()
}

View File

@ -1,53 +0,0 @@
import QtQuick 2.14
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Controls 0.1
import shared 1.0
import utils 1.0
StatusFlatButton {
id: root
property int verificationStatus: -1
signal activate()
enabled: verificationStatus == Constants.verificationStatus.verifying ||
verificationStatus == Constants.verificationStatus.verified
size: StatusBaseButton.Size.Small
text: {
switch (verificationStatus) {
case Constants.verificationStatus.verifying:
return qsTr("Sent")
case Constants.verificationStatus.verified:
return qsTr("Verify Identity")
case Constants.verificationStatus.canceled:
return qsTr("Canceled")
case Constants.verificationStatus.declined:
return qsTr("Verification Request Declined")
case Constants.verificationStatus.trusted:
return qsTr("Identity Verified")
case Constants.verificationStatus.untrustworthy:
return qsTr("Marked Untrustworthy")
case Constants.verificationStatus.unverified:
default:
return qsTr("Unknown")
}
}
disabledTextColor: {
switch (verificationStatus) {
case Constants.verificationStatus.declined:
case Constants.verificationStatus.unverified:
case Constants.verificationStatus.untrustworthy:
return Theme.palette.dangerColor1
case Constants.verificationStatus.trusted:
return Theme.palette.successColor1
default:
return Theme.palette.baseColor1
}
}
onClicked: root.activate()
}

View File

@ -82,7 +82,6 @@ Popup {
hasReplies: activityCenterStore.repliesCount > 0 hasReplies: activityCenterStore.repliesCount > 0
hasMentions: activityCenterStore.mentionsCount > 0 hasMentions: activityCenterStore.mentionsCount > 0
hasContactRequests: activityCenterStore.contactRequestsCount > 0 hasContactRequests: activityCenterStore.contactRequestsCount > 0
hasIdentityVerification: activityCenterStore.identityVerificationCount > 0
hasMembership: activityCenterStore.membershipCount > 0 hasMembership: activityCenterStore.membershipCount > 0
hideReadNotifications: activityCenterStore.activityCenterReadType === ActivityCenterStore.ActivityCenterReadType.Unread hideReadNotifications: activityCenterStore.activityCenterReadType === ActivityCenterStore.ActivityCenterReadType.Unread
activeGroup: activityCenterStore.activeNotificationGroup activeGroup: activityCenterStore.activeNotificationGroup
@ -121,8 +120,6 @@ Popup {
return replyNotificationComponent return replyNotificationComponent
case ActivityCenterStore.ActivityCenterNotificationType.ContactRequest: case ActivityCenterStore.ActivityCenterNotificationType.ContactRequest:
return contactRequestNotificationComponent return contactRequestNotificationComponent
case ActivityCenterStore.ActivityCenterNotificationType.ContactVerification:
return verificationRequestNotificationComponent
case ActivityCenterStore.ActivityCenterNotificationType.CommunityInvitation: case ActivityCenterStore.ActivityCenterNotificationType.CommunityInvitation:
return communityInvitationNotificationComponent return communityInvitationNotificationComponent
case ActivityCenterStore.ActivityCenterNotificationType.CommunityMembershipRequest: case ActivityCenterStore.ActivityCenterNotificationType.CommunityMembershipRequest:
@ -195,17 +192,6 @@ Popup {
onCloseActivityCenter: root.close() onCloseActivityCenter: root.close()
} }
} }
Component {
id: verificationRequestNotificationComponent
ActivityNotificationContactVerification {
filteredIndex: parent.filteredIndex
notification: parent.notification
store: root.store
activityCenterStore: root.activityCenterStore
onCloseActivityCenter: root.close()
}
}
Component { Component {
id: communityInvitationNotificationComponent id: communityInvitationNotificationComponent

View File

@ -78,7 +78,6 @@ QtObject {
readonly property int mentionsCount: activityCenterModuleInst.mentionsCount readonly property int mentionsCount: activityCenterModuleInst.mentionsCount
readonly property int repliesCount: activityCenterModuleInst.repliesCount readonly property int repliesCount: activityCenterModuleInst.repliesCount
readonly property int contactRequestsCount: activityCenterModuleInst.contactRequestsCount readonly property int contactRequestsCount: activityCenterModuleInst.contactRequestsCount
readonly property int identityVerificationCount: activityCenterModuleInst.identityVerificationCount
readonly property int membershipCount: activityCenterModuleInst.membershipCount readonly property int membershipCount: activityCenterModuleInst.membershipCount
function markAllActivityCenterNotificationsRead() { function markAllActivityCenterNotificationsRead() {

View File

@ -1,82 +0,0 @@
import QtQuick 2.14
import QtQuick.Layouts 1.14
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Core.Utils 0.1 as CoreUtils
import StatusQ.Components 0.1
import shared 1.0
import shared.panels 1.0
import utils 1.0
import "../panels"
ActivityNotificationMessage {
id: root
Connections {
target: root.isOutgoingMessage ? root.store.contactsStore.sentContactRequestsModel :
root.store.contactsStore.receivedContactRequestsModel
function onItemChanged(pubKey) {
if (pubKey === root.contactId)
root.updateContactDetails()
}
}
messageDetails.messageText: {
if (!notification)
return ""
return root.isOutgoingMessage ? notification.repliedMessage.messageText : notification.message.messageText
}
messageSubheaderComponent: StatusBaseText {
text: {
if (!notification)
return ""
if (root.isOutgoingMessage) {
return qsTr("To verify their identity you asked: %1").arg(CoreUtils.Utils.stripHtmlTags(notification.message.messageText))
}
return qsTr("Identity Verification Question:")
}
wrapMode: Text.Wrap
color: Theme.palette.baseColor1
font.weight: Font.Medium
font.italic: true
font.pixelSize: 15
}
ctaComponent: isOutgoingMessage ? outgoingContactVerificationCta : incomingContactVerificationCta
onMessageClicked: {
root.openProfilePopup()
}
Component {
id: outgoingContactVerificationCta
OutgoingContactVerificationCta {
verificationStatus: notification ? notification.verificationStatus : Constants.verificationStatus.unverified
onActivate: {
Global.openOutgoingIDRequestPopup(root.contactId, root.contactDetails, null)
root.closeActivityCenter()
}
}
}
Component {
id: incomingContactVerificationCta
IncomingContactVerificationCta {
verificationStatus: notification ? notification.verificationStatus : Constants.verificationStatus.unverified
onActivate: {
Global.openIncomingIDRequestPopup(root.contactId, root.contactDetails, null)
root.closeActivityCenter()
}
}
}
}

View File

@ -57,7 +57,7 @@ StatusButton {
} }
ShowcaseVisibilityAction { ShowcaseVisibilityAction {
showcaseVisibility: Constants.ShowcaseVisibility.IdVerifiedContacts showcaseVisibility: Constants.ShowcaseVisibility.IdVerifiedContacts
text: qsTr("ID verified contact") text: qsTr("Trusted contact")
} }
} }

View File

@ -17,12 +17,6 @@ CommonContactDialog {
title: qsTr("Block user") title: qsTr("Block user")
readonly property var d: QtObject {
id: d
readonly property bool isTrusted: contactDetails.outgoingVerificationStatus === Constants.verificationStatus.trusted ||
contactDetails.incomingVerificationStatus === Constants.verificationStatus.trusted
}
StatusBaseText { StatusBaseText {
objectName: "youWillNotSeeText" objectName: "youWillNotSeeText"
Layout.fillWidth: true Layout.fillWidth: true
@ -57,10 +51,10 @@ CommonContactDialog {
StatusCheckBox { StatusCheckBox {
id: ctrlRemoveIDVerification id: ctrlRemoveIDVerification
visible: (contactDetails.isContact && d.isTrusted) || contactDetails.trustStatus === Constants.trustStatus.trusted visible: contactDetails.trustStatus === Constants.trustStatus.trusted
checked: visible checked: visible
enabled: false enabled: false
text: qsTr("Remove ID verification") text: qsTr("Remove trust mark")
} }
rightButtons: ObjectModel { rightButtons: ObjectModel {

View File

@ -1,127 +0,0 @@
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQml.Models 2.15
import StatusQ.Controls 0.1
import StatusQ.Core 0.1
import StatusQ.Components 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Core.Utils 0.1 as SQUtils
import utils 1.0
import AppLayouts.Profile.stores 1.0 as ProfileStores
CommonContactDialog {
id: root
required property ProfileStores.ContactsStore contactsStore
signal verificationRefused(string senderPublicKey)
signal responseSent(string senderPublicKey, string response)
function updateVerificationDetails() {
try {
const request = root.contactsStore.getVerificationDetailsFromAsJson(root.publicKey)
if (request.requestStatus === Constants.verificationStatus.canceled) {
root.close()
}
d.senderPublicKey = request.from
d.challengeText = request.challenge
d.responseText = request.response
d.messageTimestamp = request.requestedAt
} catch (e) {
console.error("Error getting or parsing verification data", e)
}
}
readonly property var _con: Connections {
target: root.contactsStore.receivedContactRequestsModel ?? null
function onItemChanged(pubKey) {
if (pubKey === root.publicKey)
root.updateVerificationDetails()
}
}
readonly property var d: QtObject {
id: d
property string senderPublicKey
property string challengeText
property string responseText
property double messageTimestamp
property double responseTimestamp
}
title: qsTr("Reply to ID verification request")
onAboutToShow: {
root.updateVerificationDetails()
verificationResponse.input.edit.forceActiveFocus()
}
Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: msgColumn.implicitHeight + msgColumn.anchors.topMargin + msgColumn.anchors.bottomMargin
color: "transparent"
border.width: 1
border.color: Theme.palette.baseColor2
radius: Theme.radius
ColumnLayout {
id: msgColumn
anchors.fill: parent
anchors.margins: Theme.padding
StatusTimeStampLabel {
Layout.fillWidth: true
timestamp: d.messageTimestamp
}
StatusBaseText {
Layout.fillWidth: true
wrapMode: Text.WordWrap
text: d.challengeText
}
}
}
StatusInput {
id: verificationResponse
input.multiline: true
label: qsTr("Your answer")
placeholderText: qsTr("Write your answer...")
minimumHeight: 152
maximumHeight: 152
input.verticalAlignment: TextEdit.AlignTop
charLimit: 280
Layout.fillWidth: true
Layout.topMargin: Theme.padding
}
rightButtons: ObjectModel {
StatusButton {
text: qsTr("Decline")
type: StatusBaseButton.Type.Danger
objectName: "refuseVerificationButton"
onClicked: {
root.verificationRefused(d.senderPublicKey)
root.close()
}
}
StatusButton {
text: qsTr("Send reply")
type: StatusBaseButton.Type.Success
objectName: "sendAnswerButton"
enabled: verificationResponse.text !== ""
onClicked: {
root.responseSent(d.senderPublicKey, SQUtils.StringUtils.escapeHtml(verificationResponse.text))
d.responseText = verificationResponse.text
d.responseTimestamp = Date.now()
root.close()
}
}
}
}

View File

@ -8,12 +8,12 @@ import StatusQ.Controls 0.1
CommonContactDialog { CommonContactDialog {
id: root id: root
title: qsTr("Mark as ID verified") title: qsTr("Mark as trusted")
StatusBaseText { StatusBaseText {
Layout.fillWidth: true Layout.fillWidth: true
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
text: qsTr("Mark users as ID verified only if youre 100% sure who they are. Otherwise, its safer to send %1 an ID verification request.").arg(mainDisplayName) text: qsTr("Mark users as trusted only if you're 100% sure who they are.")
} }
rightButtons: ObjectModel { rightButtons: ObjectModel {
@ -22,7 +22,7 @@ CommonContactDialog {
onClicked: root.close() onClicked: root.close()
} }
StatusButton { StatusButton {
text: qsTr("Mark as ID verified") text: qsTr("Mark as trusted")
onClicked: root.accepted() onClicked: root.accepted()
} }
} }

View File

@ -17,14 +17,6 @@ CommonContactDialog {
title: qsTr("Mark as untrusted") title: qsTr("Mark as untrusted")
readonly property var d: QtObject {
id: d
readonly property int outgoingVerificationStatus: contactDetails.verificationStatus
readonly property int incomingVerificationStatus: contactDetails.incomingVerificationStatus
readonly property bool isTrusted: outgoingVerificationStatus === Constants.verificationStatus.trusted ||
incomingVerificationStatus === Constants.verificationStatus.trusted
}
StatusBaseText { StatusBaseText {
Layout.fillWidth: true Layout.fillWidth: true
Layout.bottomMargin: Theme.halfPadding Layout.bottomMargin: Theme.halfPadding
@ -34,10 +26,10 @@ CommonContactDialog {
StatusCheckBox { StatusCheckBox {
id: ctrlRemoveIDVerification id: ctrlRemoveIDVerification
visible: (contactDetails.isContact && d.isTrusted) || contactDetails.trustStatus === Constants.trustStatus.trusted visible: contactDetails.trustStatus === Constants.trustStatus.trusted
checked: visible checked: visible
enabled: false enabled: false
text: qsTr("Remove ID verification") text: qsTr("Remove trust mark")
} }
StatusCheckBox { StatusCheckBox {

View File

@ -1,118 +0,0 @@
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQml.Models 2.15
import utils 1.0
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Controls 0.1
import shared.views.chat 1.0
import AppLayouts.Profile.stores 1.0 as ProfileStores
CommonContactDialog {
id: root
property ProfileStores.ProfileStore profileStore
property int verificationStatus
property string verificationChallenge
property string verificationResponse
property string verificationResponseDisplayName
property string verificationResponseIcon
property string verificationRequestedAt
property string verificationRepliedAt
readonly property bool hasReply: root.verificationResponse !== ""
signal verificationRequestCanceled(string publicKey)
signal untrustworthyVerified(string publicKey)
signal trustedVerified(string publicKey)
title: !hasReply ? qsTr("ID verification pending") : qsTr("Review ID verification reply")
rightButtons: ObjectModel {
StatusFlatButton {
text: qsTr("Cancel request")
type: StatusBaseButton.Type.Danger
borderColor: "transparent"
visible: !root.hasReply
onClicked: {
root.verificationRequestCanceled(root.publicKey)
root.close()
}
}
StatusButton {
text: qsTr("Done")
visible: !root.hasReply
onClicked: root.close()
}
StatusButton {
text: qsTr("Mark as untrusted")
visible: root.hasReply
type: StatusBaseButton.Type.Danger
onClicked: {
root.untrustworthyVerified(root.publicKey)
root.close()
}
}
StatusButton {
text: qsTr("Mark as verified")
visible: root.hasReply
type: StatusBaseButton.Type.Success
onClicked: {
root.trustedVerified(root.publicKey)
root.close()
}
}
}
SimplifiedMessageView {
id: challengeMessage
timestamp: root.verificationRequestedAt
messageDetails.messageText: root.verificationChallenge
messageDetails.sender.id: root.profileStore.pubkey
messageDetails.sender.displayName: root.profileStore.name
messageDetails.sender.profileImage.name: root.profileStore.icon
messageDetails.sender.profileImage.assetSettings.isImage: true
messageDetails.sender.profileImage.colorId: Utils.colorIdForPubkey(root.profileStore.pubkey)
messageDetails.sender.profileImage.colorHash: Utils.getColorHashAsJson(root.profileStore.pubkey, !!root.profileStore.preferredName)
messageDetails.sender.isEnsVerified: !!root.profileStore.preferredName
Layout.fillWidth: true
}
SimplifiedMessageView {
id: responseMessage
visible: root.hasReply
timestamp: root.verificationRepliedAt
messageDetails.messageText: root.verificationResponse
messageDetails.sender.id: root.publicKey
messageDetails.sender.displayName: root.verificationResponseDisplayName
messageDetails.sender.profileImage.name: root.verificationResponseIcon
messageDetails.sender.profileImage.assetSettings.isImage: true
messageDetails.sender.profileImage.colorId: Utils.colorIdForPubkey(root.publicKey)
messageDetails.sender.profileImage.colorHash: Utils.getColorHashAsJson(root.publicKey)
messageDetails.sender.isEnsVerified: contactDetails.ensVerified
Layout.fillWidth: true
}
StatusBaseText {
Layout.fillWidth: true
Layout.topMargin: Theme.halfPadding
text: root.hasReply ? qsTr("Still not sure?") + " " + Utils.getLinkStyle(qsTr("Ask something else"), hoveredLink, Theme.palette.primaryColor1)
: qsTr("Awaiting %1's response...").arg(root.verificationResponseDisplayName)
font.pixelSize: Theme.additionalTextSize
horizontalAlignment : Text.AlignHCenter
wrapMode: Text.WordWrap
textFormat: Text.RichText
color: root.hasReply ? Theme.palette.directColor1 : Theme.palette.baseColor1
onLinkActivated: {
root.verificationRequestCanceled(root.publicKey)
root.close()
Global.openSendIDRequestPopup(root.publicKey, root.contactDetails, null)
}
}
}

View File

@ -17,12 +17,6 @@ CommonContactDialog {
title: qsTr("Remove contact") title: qsTr("Remove contact")
readonly property var d: QtObject {
id: d
readonly property bool isTrusted: contactDetails.outgoingVerificationStatus === Constants.verificationStatus.trusted ||
contactDetails.incomingVerificationStatus === Constants.verificationStatus.trusted
}
StatusBaseText { StatusBaseText {
Layout.fillWidth: true Layout.fillWidth: true
Layout.bottomMargin: Theme.halfPadding Layout.bottomMargin: Theme.halfPadding
@ -32,10 +26,10 @@ CommonContactDialog {
StatusCheckBox { StatusCheckBox {
id: ctrlRemoveIDVerification id: ctrlRemoveIDVerification
visible: d.isTrusted || contactDetails.trustStatus === Constants.trustStatus.trusted visible: contactDetails.trustStatus === Constants.trustStatus.trusted
checked: visible checked: visible
enabled: false enabled: false
text: qsTr("Remove ID verification") text: qsTr("Remove trust mark")
} }
StatusCheckBox { StatusCheckBox {

View File

@ -14,13 +14,13 @@ CommonContactDialog {
readonly property bool markAsUntrusted: ctrlMarkAsUntrusted.checked readonly property bool markAsUntrusted: ctrlMarkAsUntrusted.checked
readonly property bool removeContact: ctrlRemoveContact.checked readonly property bool removeContact: ctrlRemoveContact.checked
title: qsTr("Remove ID verification") title: qsTr("Remove trust mark")
StatusBaseText { StatusBaseText {
Layout.fillWidth: true Layout.fillWidth: true
Layout.bottomMargin: Theme.halfPadding Layout.bottomMargin: Theme.halfPadding
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
text: qsTr("%1s identity will no longer be verified. This is only visible to you.").arg(mainDisplayName) text: qsTr("%1's identity will no longer be verified. This is only visible to you.").arg(mainDisplayName)
} }
StatusCheckBox { StatusCheckBox {
@ -40,7 +40,7 @@ CommonContactDialog {
} }
StatusButton { StatusButton {
type: StatusBaseButton.Type.Danger type: StatusBaseButton.Type.Danger
text: qsTr("Remove ID verification") text: qsTr("Remove trust mark")
onClicked: root.accepted() onClicked: root.accepted()
} }
} }

View File

@ -31,7 +31,6 @@ Pane {
id: root id: root
property bool readOnly // inside settings/profile/preview property bool readOnly // inside settings/profile/preview
property bool idVerificationFlowsEnabled: false // disabled temporarily as per https://github.com/status-im/status-desktop/issues/14954
property string publicKey: contactsStore.myPublicKey property string publicKey: contactsStore.myPublicKey
readonly property alias isCurrentUser: d.isCurrentUser readonly property alias isCurrentUser: d.isCurrentUser
@ -88,19 +87,6 @@ Pane {
readonly property int contactRequestState: contactDetails.contactRequestState readonly property int contactRequestState: contactDetails.contactRequestState
readonly property int outgoingVerificationStatus: contactDetails.outgoingVerificationStatus
readonly property int incomingVerificationStatus: contactDetails.incomingVerificationStatus
readonly property bool isVerificationRequestSent:
outgoingVerificationStatus !== Constants.verificationStatus.unverified &&
outgoingVerificationStatus !== Constants.verificationStatus.verified &&
outgoingVerificationStatus !== Constants.verificationStatus.trusted
readonly property bool isVerificationRequestReceived: incomingVerificationStatus === Constants.verificationStatus.verifying ||
incomingVerificationStatus === Constants.verificationStatus.verified
readonly property bool isTrusted: outgoingVerificationStatus === Constants.verificationStatus.trusted ||
incomingVerificationStatus === Constants.verificationStatus.trusted
readonly property bool isLocallyTrusted: contactDetails.trustStatus === Constants.trustStatus.trusted readonly property bool isLocallyTrusted: contactDetails.trustStatus === Constants.trustStatus.trusted
readonly property string linkToProfile: root.contactsStore.getLinkToProfile(root.publicKey) readonly property string linkToProfile: root.contactsStore.getLinkToProfile(root.publicKey)
@ -196,39 +182,6 @@ Pane {
} }
} }
Component {
id: btnReplyToIdRequestComponent
StatusFlatButton {
size: StatusButton.Size.Small
text: qsTr("Reply to ID verification request")
objectName: "respondToIDRequest_StatusItem"
icon.name: "checkmark-circle"
onClicked: Global.openIncomingIDRequestPopup(root.publicKey, contactDetails, null)
}
}
Component {
id: btnRequestIDVerification
StatusFlatButton {
size: StatusButton.Size.Small
text: qsTr("Request ID verification")
objectName: "requestIDVerification_StatusItem"
icon.name: "checkmark-circle"
onClicked: Global.openSendIDRequestPopup(root.publicKey, contactDetails, null)
}
}
Component {
id: btnReviewIDVerificationReply
StatusFlatButton {
size: StatusButton.Size.Small
text: d.incomingVerificationStatus !== Constants.verificationStatus.verified ? qsTr("ID verification pending")
: qsTr("Review ID verification reply")
icon.name: d.incomingVerificationStatus !== Constants.verificationStatus.verified ? "history" : "checkmark-circle"
onClicked: Global.openOutgoingIDRequestPopup(root.publicKey, contactDetails, null)
}
}
Component { Component {
id: btnShareProfile id: btnShareProfile
StatusFlatButton { StatusFlatButton {
@ -292,22 +245,8 @@ Pane {
Loader { Loader {
Layout.alignment: Qt.AlignTop Layout.alignment: Qt.AlignTop
Layout.preferredHeight: menuButton.visible ? menuButton.height : -1 Layout.preferredHeight: menuButton.visible ? menuButton.height : -1
sourceComponent: { active: d.isCurrentUser && !root.readOnly
if (d.isCurrentUser && !root.readOnly) sourceComponent: btnShareProfile
return btnShareProfile
if (!root.idVerificationFlowsEnabled)
return
if (d.isContact && !(d.isTrusted || d.isLocallyTrusted) && !d.isBlocked) {
if (d.isVerificationRequestSent)
return btnReviewIDVerificationReply
else if (d.isVerificationRequestReceived)
return btnReplyToIdRequestComponent
else if (d.outgoingVerificationStatus === Constants.verificationStatus.unverified)
return btnRequestIDVerification
}
}
} }
// primary action button // primary action button
@ -338,12 +277,6 @@ Pane {
return txtPendingContactRequestComponent return txtPendingContactRequestComponent
case Constants.ContactRequestState.Received: case Constants.ContactRequestState.Received:
break // handled above break // handled above
case Constants.ContactRequestState.Mutual: {
if (d.outgoingVerificationStatus === Constants.verificationStatus.declined) {
return btnBlockUserComponent
}
break
}
case Constants.ContactRequestState.None: case Constants.ContactRequestState.None:
case Constants.ContactRequestState.Dismissed: case Constants.ContactRequestState.Dismissed:
return btnSendContactRequestComponent return btnSendContactRequestComponent
@ -378,9 +311,9 @@ Pane {
} }
} }
StatusAction { StatusAction {
text: qsTr("Mark as ID verified") text: qsTr("Mark as trusted")
icon.name: "checkmark-circle" icon.name: "checkmark-circle"
enabled: root.idVerificationFlowsEnabled && d.isContact && !d.isBlocked && !(d.isTrusted || d.isLocallyTrusted) enabled: d.isContact && !d.isBlocked && !d.isLocallyTrusted
onTriggered: Global.openMarkAsIDVerifiedPopup(root.publicKey, contactDetails, null) onTriggered: Global.openMarkAsIDVerifiedPopup(root.publicKey, contactDetails, null)
} }
StatusAction { StatusAction {
@ -408,10 +341,10 @@ Pane {
} }
StatusMenuSeparator {} StatusMenuSeparator {}
StatusAction { StatusAction {
text: qsTr("Remove ID verification") text: qsTr("Remove trusted mark")
icon.name: "delete" icon.name: "delete"
type: StatusAction.Type.Danger type: StatusAction.Type.Danger
enabled: root.idVerificationFlowsEnabled && d.isContact && (d.isTrusted || d.isLocallyTrusted) enabled: d.isContact && d.isLocallyTrusted
onTriggered: Global.openRemoveIDVerificationDialog(root.publicKey, contactDetails, null) onTriggered: Global.openRemoveIDVerificationDialog(root.publicKey, contactDetails, null)
} }
StatusAction { StatusAction {
@ -431,13 +364,6 @@ Pane {
Global.markAsUntrustedRequested(root.publicKey, contactDetails) Global.markAsUntrustedRequested(root.publicKey, contactDetails)
} }
} }
StatusAction {
text: qsTr("Cancel ID verification request")
icon.name: "delete"
type: StatusAction.Type.Danger
enabled: root.idVerificationFlowsEnabled && d.isContact && !d.isBlocked && d.isVerificationRequestSent
onTriggered: root.contactsStore.cancelVerificationRequest(root.publicKey)
}
StatusAction { StatusAction {
text: qsTr("Remove untrusted mark") text: qsTr("Remove untrusted mark")
icon.name: "warning" icon.name: "warning"

View File

@ -494,16 +494,6 @@ QtObject {
readonly property int untrustworthy: 2 readonly property int untrustworthy: 2
} }
readonly property QtObject verificationStatus: QtObject {
readonly property int unverified: 0
readonly property int verifying: 1
readonly property int verified: 2
readonly property int declined: 3
readonly property int canceled: 4
readonly property int trusted: 5
readonly property int untrustworthy: 6
}
readonly property QtObject contactsPanelUsage: QtObject { readonly property QtObject contactsPanelUsage: QtObject {
readonly property int unknownPosition: -1 readonly property int unknownPosition: -1
readonly property int mutualContacts: 0 readonly property int mutualContacts: 0

View File

@ -35,7 +35,6 @@ QtObject {
signal openVideoPopup(string url) signal openVideoPopup(string url)
signal openProfilePopupRequested(string publicKey, var parentPopup, var cb) signal openProfilePopupRequested(string publicKey, var parentPopup, var cb)
signal openActivityCenterPopupRequested() signal openActivityCenterPopupRequested()
signal openSendIDRequestPopup(string publicKey, var contactDetails, var cb)
signal openMarkAsIDVerifiedPopup(string publicKey, var contactDetails, var cb) signal openMarkAsIDVerifiedPopup(string publicKey, var contactDetails, var cb)
signal openRemoveIDVerificationDialog(string publicKey, var contactDetails, var cb) signal openRemoveIDVerificationDialog(string publicKey, var contactDetails, var cb)
signal openContactRequestPopup(string publicKey, var contactDetails, var cb) signal openContactRequestPopup(string publicKey, var contactDetails, var cb)
@ -44,8 +43,6 @@ QtObject {
signal removeContactRequested(string publicKey, var contactDetails) signal removeContactRequested(string publicKey, var contactDetails)
signal openInviteFriendsToCommunityPopup(var community, var communitySectionModule, var cb) signal openInviteFriendsToCommunityPopup(var community, var communitySectionModule, var cb)
signal openInviteFriendsToCommunityByIdPopup(string communityId, var cb) signal openInviteFriendsToCommunityByIdPopup(string communityId, var cb)
signal openIncomingIDRequestPopup(string publicKey, var contactDetails, var cb)
signal openOutgoingIDRequestPopup(string publicKey, var contactDetails, var cb)
signal openDeleteMessagePopup(string messageId, var messageStore) signal openDeleteMessagePopup(string messageId, var messageStore)
signal openDownloadImageDialog(string imageSource) signal openDownloadImageDialog(string imageSource)
signal openExportControlNodePopup(var community) signal openExportControlNodePopup(var community)

View File

@ -739,8 +739,6 @@ QtObject {
removed: false, removed: false,
trustStatus: Constants.trustStatus.unknown, trustStatus: Constants.trustStatus.unknown,
contactRequestState: Constants.ContactRequestState.None, contactRequestState: Constants.ContactRequestState.None,
verificationStatus: Constants.verificationStatus.unverified,
incomingVerificationStatus: Constants.verificationStatus.unverified,
socialLinks: [], socialLinks: [],
bio: "", bio: "",
onlineStatus: Constants.onlineStatus.inactive onlineStatus: Constants.onlineStatus.inactive

2
vendor/status-go vendored

@ -1 +1 @@
Subproject commit 132ea05fc8735b91922a440009efdbc7f1b8b8ce Subproject commit d99fdf1b672c2f8207371e7e2386a403196341b9