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:
parent
f2883fdcee
commit
d511c25d2e
|
@ -292,12 +292,6 @@ QtObject:
|
|||
self.notificationCheck(title, message, details, self.settingsService.getNotifSettingContactRequests())
|
||||
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)
|
||||
elif(details.notificationType == NotificationType.NewMessage or
|
||||
details.notificationType == NotificationType.NewMessageWithPersonalMention or
|
||||
|
|
|
@ -30,7 +30,6 @@ type MessageSignal* = ref object of Signal
|
|||
currentStatus*: seq[StatusUpdateDto]
|
||||
settings*: seq[SettingsFieldDto]
|
||||
clearedHistories*: seq[ClearedHistoryDto]
|
||||
verificationRequests*: seq[VerificationRequest]
|
||||
savedAddresses*: seq[SavedAddressDto]
|
||||
keypairs*: seq[KeypairDto]
|
||||
watchOnlyAccounts*: seq[WalletAccountDto]
|
||||
|
@ -134,10 +133,6 @@ proc fromEvent*(T: type MessageSignal, event: JsonNode): MessageSignal =
|
|||
for jsonSettingsField in e["settings"]:
|
||||
signal.settings.add(jsonSettingsField.toSettingsFieldDto())
|
||||
|
||||
if e.contains("verificationRequests"):
|
||||
for jsonVerificationRequest in e["verificationRequests"]:
|
||||
signal.verificationRequests.add(jsonVerificationRequest.toVerificationRequest())
|
||||
|
||||
if e.contains("savedAddresses"):
|
||||
for jsonSavedAddress in e["savedAddresses"]:
|
||||
signal.savedAddresses.add(jsonSavedAddress.toSavedAddressDto())
|
||||
|
|
|
@ -12,7 +12,6 @@ type Item* = ref object
|
|||
chatId: string
|
||||
communityId: string
|
||||
membershipStatus: ActivityCenterMembershipStatus
|
||||
verificationStatus: VerificationStatus
|
||||
sectionId: string
|
||||
name: string
|
||||
author: string
|
||||
|
@ -32,7 +31,6 @@ proc initItem*(
|
|||
chatId: string,
|
||||
communityId: string,
|
||||
membershipStatus: ActivityCenterMembershipStatus,
|
||||
verificationStatus: VerificationStatus,
|
||||
sectionId: string,
|
||||
name: string,
|
||||
author: string,
|
||||
|
@ -52,7 +50,6 @@ proc initItem*(
|
|||
result.chatId = chatId
|
||||
result.communityId = communityId
|
||||
result.membershipStatus = membershipStatus
|
||||
result.verificationStatus = verificationStatus
|
||||
result.sectionId = sectionId
|
||||
result.name = name
|
||||
result.author = author
|
||||
|
@ -74,7 +71,6 @@ proc `$`*(self: Item): string =
|
|||
chatId: {$self.chatId},
|
||||
communityId: {$self.communityId},
|
||||
membershipStatus: {$self.membershipStatus.int},
|
||||
verificationStatus: {$self.verificationStatus.int},
|
||||
sectionId: {$self.sectionId},
|
||||
author: {$self.author},
|
||||
installationId: {$self.installationId},
|
||||
|
@ -112,9 +108,6 @@ proc communityId*(self: Item): string =
|
|||
proc membershipStatus*(self: Item): ActivityCenterMembershipStatus =
|
||||
return self.membershipStatus
|
||||
|
||||
proc verificationStatus*(self: Item): VerificationStatus =
|
||||
return self.verificationStatus
|
||||
|
||||
proc sectionId*(self: Item): string =
|
||||
return self.sectionId
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ type
|
|||
ChatId
|
||||
CommunityId
|
||||
MembershipStatus
|
||||
VerificationStatus
|
||||
SectionId
|
||||
Name
|
||||
NotificationType
|
||||
|
@ -70,7 +69,6 @@ QtObject:
|
|||
of NotifRoles.ChatId: result = newQVariant(activityNotificationItem.chatId)
|
||||
of NotifRoles.CommunityId: result = newQVariant(activityNotificationItem.communityId)
|
||||
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.Name: result = newQVariant(activityNotificationItem.name)
|
||||
of NotifRoles.Author: result = newQVariant(activityNotificationItem.author)
|
||||
|
@ -98,7 +96,6 @@ QtObject:
|
|||
NotifRoles.ChatId.int:"chatId",
|
||||
NotifRoles.CommunityId.int:"communityId",
|
||||
NotifRoles.MembershipStatus.int: "membershipStatus",
|
||||
NotifRoles.VerificationStatus.int: "verificationStatus",
|
||||
NotifRoles.SectionId.int: "sectionId",
|
||||
NotifRoles.Name.int: "name",
|
||||
NotifRoles.Author.int: "author",
|
||||
|
|
|
@ -207,7 +207,6 @@ method convertToItems*(
|
|||
notification.chatId,
|
||||
notification.communityId,
|
||||
notification.membershipStatus,
|
||||
notification.verificationStatus,
|
||||
sectionId,
|
||||
notification.name,
|
||||
notification.author,
|
||||
|
|
|
@ -194,13 +194,6 @@ QtObject:
|
|||
read = getContactRequestsCount
|
||||
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.} =
|
||||
return self.groupCounters.getOrDefault(ActivityCenterGroup.Membership, 0)
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import NimQml
|
||||
import ../../../../../app_service/common/types
|
||||
|
||||
|
||||
QtObject:
|
||||
|
@ -19,7 +20,7 @@ QtObject:
|
|||
highlight: bool
|
||||
muted: bool
|
||||
position: int
|
||||
isUntrustworthy: bool
|
||||
trustStatus: TrustStatus
|
||||
isContact: bool
|
||||
active: bool
|
||||
blocked: bool
|
||||
|
@ -51,7 +52,7 @@ QtObject:
|
|||
notificationsCount: int,
|
||||
highlight, muted: bool,
|
||||
position: int,
|
||||
isUntrustworthy: bool,
|
||||
trustStatus: TrustStatus,
|
||||
isContact: bool = false,
|
||||
blocked: bool = false,
|
||||
canPost: bool = true,
|
||||
|
@ -75,7 +76,7 @@ QtObject:
|
|||
self.highlight = highlight
|
||||
self.muted = muted
|
||||
self.position = position
|
||||
self.isUntrustworthy = isUntrustworthy
|
||||
self.trustStatus = trustStatus
|
||||
self.isContact = isContact
|
||||
self.active = false
|
||||
self.blocked = blocked
|
||||
|
@ -251,15 +252,23 @@ QtObject:
|
|||
|
||||
proc isUntrustworthyChanged(self: ChatDetails) {.signal.}
|
||||
proc getIsUntrustworthy(self: ChatDetails): bool {.slot.} =
|
||||
return self.isUntrustworthy
|
||||
return self.trustStatus == TrustStatus.Untrustworthy
|
||||
QtProperty[bool] isUntrustworthy:
|
||||
read = getIsUntrustworthy
|
||||
notify = isUntrustworthyChanged
|
||||
|
||||
proc setIsUntrustworthy*(self: ChatDetails, value: bool) = # this is not a slot
|
||||
if self.isUntrustworthy == value:
|
||||
proc trustStatusChanged(self: ChatDetails) {.signal.}
|
||||
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
|
||||
self.isUntrustworthy = value
|
||||
self.trustStatus = value
|
||||
self.trustStatusChanged()
|
||||
self.isUntrustworthyChanged()
|
||||
|
||||
proc activeChanged(self: ChatDetails) {.signal.}
|
||||
|
|
|
@ -81,7 +81,7 @@ method load*(self: Module, chatItem: chat_item.Item) =
|
|||
var chatImage = chatItem.icon
|
||||
var isContact = false
|
||||
var trustStatus = TrustStatus.Unknown
|
||||
if(chatItem.`type` == ChatType.OneToOne.int):
|
||||
if chatItem.`type` == ChatType.OneToOne.int:
|
||||
let contactDto = self.controller.getContactById(self.controller.getMyChatId())
|
||||
chatName = contactDto.userDefaultDisplayName()
|
||||
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.controller.isUsersListAvailable(), chatName, chatImage,
|
||||
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,
|
||||
chatItem.hideIfPermissionsNotMet, chatItem.missingEncryptionKey, chatItem.requiresPermissions)
|
||||
|
||||
|
@ -362,9 +362,9 @@ method onContactDetailsUpdated*(self: Module, contactId: string) =
|
|||
let communityChats = self.controller.getCommunityDetails().chats
|
||||
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.updateTrustStatus(updatedContact.dto.trustStatus == TrustStatus.Untrustworthy)
|
||||
self.view.updateTrustStatus(updatedContact.dto.trustStatus)
|
||||
self.view.updateChatBlocked(updatedContact.dto.blocked)
|
||||
|
||||
method onNotificationsUpdated*(self: Module, hasUnreadMessages: bool, notificationCount: int) =
|
||||
|
|
|
@ -88,7 +88,6 @@ method contactUpdated*(self: Module, publicKey: string) =
|
|||
if self.isPublicCommunityChannel:
|
||||
return
|
||||
let contactDetails = self.controller.getContactDetails(publicKey)
|
||||
let isMe = publicKey == singletonInstance.userProfile.getPubKey()
|
||||
self.view.model().updateItem(
|
||||
pubKey = publicKey,
|
||||
displayName = contactDetails.dto.displayName,
|
||||
|
@ -98,8 +97,7 @@ method contactUpdated*(self: Module, publicKey: string) =
|
|||
alias = contactDetails.dto.alias,
|
||||
icon = contactDetails.icon,
|
||||
isContact = contactDetails.dto.isContact,
|
||||
isVerified = not isMe and contactDetails.dto.isContactVerified(),
|
||||
isUntrustworthy = contactDetails.dto.trustStatus == TrustStatus.Untrustworthy,
|
||||
trustStatus = contactDetails.dto.trustStatus,
|
||||
)
|
||||
|
||||
method userProfileUpdated*(self: Module) =
|
||||
|
@ -151,10 +149,10 @@ proc processChatMember(self: Module, member: ChatMember, reset: bool = false):
|
|||
colorHash = contactDetails.colorHash,
|
||||
onlineStatus = status,
|
||||
isContact = contactDetails.dto.isContact,
|
||||
isVerified = not isMe and contactDetails.dto.isContactVerified(),
|
||||
isCurrentUser = isMe,
|
||||
memberRole = member.role,
|
||||
joined = member.joined,
|
||||
isUntrustworthy = contactDetails.dto.trustStatus == TrustStatus.Untrustworthy,
|
||||
trustStatus = contactDetails.dto.trustStatus,
|
||||
)
|
||||
|
||||
method onChatMembersAdded*(self: Module, ids: seq[string]) =
|
||||
|
@ -195,7 +193,6 @@ method onChatMemberUpdated*(self: Module, publicKey: string, memberRole: MemberR
|
|||
if self.isPublicCommunityChannel:
|
||||
return
|
||||
let contactDetails = self.controller.getContactDetails(publicKey)
|
||||
let isMe = publicKey == singletonInstance.userProfile.getPubKey()
|
||||
discard self.view.model().updateItem(
|
||||
pubKey = publicKey,
|
||||
displayName = contactDetails.dto.displayName,
|
||||
|
@ -205,10 +202,9 @@ method onChatMemberUpdated*(self: Module, publicKey: string, memberRole: MemberR
|
|||
alias = contactDetails.dto.alias,
|
||||
icon = contactDetails.icon,
|
||||
isContact = contactDetails.dto.isContact,
|
||||
isVerified = not isMe and contactDetails.dto.isContactVerified(),
|
||||
memberRole,
|
||||
joined,
|
||||
isUntrustworthy = contactDetails.dto.trustStatus == TrustStatus.Untrustworthy,
|
||||
trustStatus = contactDetails.dto.trustStatus,
|
||||
)
|
||||
|
||||
method addGroupMembers*(self: Module, pubKeys: seq[string]) =
|
||||
|
|
|
@ -63,7 +63,6 @@ QtObject:
|
|||
alias = "",
|
||||
icon = "",
|
||||
colorId = 0,
|
||||
isVerified = false,
|
||||
)
|
||||
self.temporaryModel.addItem(userItem)
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import NimQml
|
||||
import ../../../shared_models/message_model as pinned_msg_model
|
||||
import ../item as chat_item
|
||||
import ../../../../../app_service/common/types
|
||||
|
||||
import io_interface
|
||||
import chat_details
|
||||
|
@ -112,8 +113,8 @@ QtObject:
|
|||
self.updateChatDetailsNameAndIcon(name, icon)
|
||||
self.chatDetails.setColor(color)
|
||||
|
||||
proc updateTrustStatus*(self: View, isUntrustworthy: bool) =
|
||||
self.chatDetails.setIsUntrustworthy(isUntrustworthy)
|
||||
proc updateTrustStatus*(self: View, trustStatus: TrustStatus) =
|
||||
self.chatDetails.setTrustStatus(trustStatus)
|
||||
|
||||
proc updateChatDetailsNotifications*(self: View, hasUnreadMessages: bool, notificationCount: int) =
|
||||
self.chatDetails.setHasUnreadMessages(hasUnreadMessages)
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import NimQml, Tables, strutils, stew/shims/strformat, json, sequtils, system
|
||||
import ../../../../app_service/common/types
|
||||
import ../../../../app_service/service/chat/dto/chat
|
||||
from ../../../../app_service/service/contacts/dto/contacts import TrustStatus
|
||||
import item
|
||||
import ../../../global/utils as utils
|
||||
import ../../../global/global_singleton
|
||||
|
|
|
@ -368,8 +368,7 @@ proc createItemFromPublicKey(self: Module, publicKey: string): UserItem =
|
|||
colorHash = if not contactDetails.dto.ensVerified: contactDetails.colorHash else: "",
|
||||
onlineStatus = toOnlineStatus(self.controller.getStatusForContactWithId(publicKey).statusType),
|
||||
isContact = contactDetails.dto.isContact(),
|
||||
isVerified = contactDetails.dto.isContactVerified(),
|
||||
isUntrustworthy = contactDetails.dto.isContactUntrustworthy(),
|
||||
trustStatus = contactDetails.dto.trustStatus,
|
||||
isBlocked = contactDetails.dto.isBlocked(),
|
||||
)
|
||||
|
||||
|
|
|
@ -193,7 +193,7 @@ proc createMemberItem(self: Module, memberId, requestId: string, status: Members
|
|||
colorHash = contactDetails.colorHash,
|
||||
onlineStatus = toOnlineStatus(self.controller.getStatusForContactWithId(memberId).statusType),
|
||||
isContact = contactDetails.dto.isContact,
|
||||
isVerified = contactDetails.dto.isContactVerified(),
|
||||
trustStatus = contactDetails.dto.trustStatus,
|
||||
requestToJoinId = requestId,
|
||||
membershipRequestState = status,
|
||||
)
|
||||
|
|
|
@ -565,9 +565,6 @@ proc spectateCommunity*(self: Controller, communityId: string) =
|
|||
proc getStatusForContactWithId*(self: Controller, publicKey: string): StatusUpdateDto =
|
||||
return self.contactsService.getStatusForContactWithId(publicKey)
|
||||
|
||||
proc getVerificationRequestFrom*(self: Controller, publicKey: string): VerificationRequest =
|
||||
self.contactsService.getVerificationRequestFrom(publicKey)
|
||||
|
||||
proc getCommunityTokensDetailsAsync*(self: Controller, communityId: string) =
|
||||
self.communityTokensService.getCommunityTokensDetailsAsync(communityId)
|
||||
|
||||
|
|
|
@ -284,9 +284,6 @@ method onStatusUrlRequested*(self: AccessInterface, action: StatusUrlAction, com
|
|||
url: string, userId: string, shard: Shard) {.base.} =
|
||||
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.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
|
|
|
@ -1112,9 +1112,6 @@ method onCommunityMuted*[T](
|
|||
muted: bool) =
|
||||
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,
|
||||
getOnlineStatus: bool = false, includeDetails: bool = false): string =
|
||||
var contactDetails: ContactDetails
|
||||
|
@ -1155,10 +1152,7 @@ method getContactDetailsAsJson*[T](self: Module[T], publicKey: string, getVerifi
|
|||
"isSyncing": contactDetails.dto.isSyncing,
|
||||
"removed": contactDetails.dto.removed,
|
||||
"trustStatus": contactDetails.dto.trustStatus.int,
|
||||
# TODO rename verificationStatus to outgoingVerificationStatus
|
||||
"contactRequestState": contactDetails.dto.contactRequestState.int,
|
||||
"verificationStatus": contactDetails.dto.verificationStatus.int,
|
||||
"incomingVerificationStatus": 0,
|
||||
"bio": contactDetails.dto.bio,
|
||||
"onlineStatus": onlineStatus.int
|
||||
}
|
||||
|
@ -1749,7 +1743,7 @@ proc createMemberItem[T](
|
|||
colorHash = contactDetails.colorHash,
|
||||
onlineStatus = toOnlineStatus(status.statusType),
|
||||
isContact = contactDetails.dto.isContact,
|
||||
isVerified = contactDetails.dto.isContactVerified(),
|
||||
trustStatus = contactDetails.dto.trustStatus,
|
||||
memberRole = role,
|
||||
membershipRequestState = state,
|
||||
requestToJoinId = requestId,
|
||||
|
@ -1758,7 +1752,6 @@ proc createMemberItem[T](
|
|||
|
||||
method contactUpdated*[T](self: Module[T], contactId: string) =
|
||||
let contactDetails = self.controller.getContactDetails(contactId)
|
||||
let isMe = contactId == singletonInstance.userProfile.getPubKey()
|
||||
self.view.model().updateMemberItemInSections(
|
||||
pubKey = contactId,
|
||||
displayName = contactDetails.dto.displayName,
|
||||
|
@ -1768,8 +1761,7 @@ method contactUpdated*[T](self: Module[T], contactId: string) =
|
|||
alias = contactDetails.dto.alias,
|
||||
icon = contactDetails.icon,
|
||||
isContact = contactDetails.dto.isContact,
|
||||
isVerified = not isMe and contactDetails.dto.isContactVerified(),
|
||||
isUntrustworthy = contactDetails.dto.trustStatus == TrustStatus.Untrustworthy,
|
||||
trustStatus = contactDetails.dto.trustStatus,
|
||||
)
|
||||
|
||||
{.pop.}
|
||||
|
|
|
@ -52,27 +52,15 @@ proc init*(self: Controller) =
|
|||
|
||||
self.events.on(SIGNAL_CONTACT_UNTRUSTWORTHY) do(e: Args):
|
||||
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):
|
||||
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):
|
||||
var args = TrustArgs(e)
|
||||
self.delegate.contactTrustStatusChanged(args.publicKey, args.isUntrustworthy)
|
||||
|
||||
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.delegate.contactTrustStatusChanged(args.publicKey, args.trustStatus)
|
||||
|
||||
self.events.on(SIGNAL_CONTACT_UPDATED) do(e: Args):
|
||||
var args = ContactArgs(e)
|
||||
|
@ -82,28 +70,6 @@ proc init*(self: Controller) =
|
|||
let args = ContactsStatusUpdatedArgs(e)
|
||||
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):
|
||||
let args = ContactInfoRequestArgs(e)
|
||||
self.delegate.onContactInfoRequestFinished(args.publicKey, args.ok)
|
||||
|
@ -169,36 +135,6 @@ proc markUntrustworthy*(self: Controller, publicKey: string) =
|
|||
proc removeTrustStatus*(self: Controller, publicKey: string) =
|
||||
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 =
|
||||
return self.contactsService.getStatusForContactWithId(publicKey)
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import NimQml
|
||||
import ../../../../../app_service/service/contacts/dto/contacts as contacts
|
||||
import ../../../../../app_service/service/contacts/dto/status_update
|
||||
import app_service/common/types
|
||||
|
||||
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.} =
|
||||
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")
|
||||
|
||||
method contactUpdated*(self: AccessInterface, publicKey: string) {.base.} =
|
||||
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.} =
|
||||
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.} =
|
||||
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.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
|
|
|
@ -84,8 +84,6 @@ proc createItemFromPublicKey(self: Module, publicKey: string): UserItem =
|
|||
colorHash = contactDetails.colorHash,
|
||||
onlineStatus = toOnlineStatus(self.controller.getStatusForContactWithId(publicKey).statusType),
|
||||
isContact = contactDetails.dto.isContact(),
|
||||
isVerified = contactDetails.dto.isContactVerified(),
|
||||
isUntrustworthy = contactDetails.dto.isContactUntrustworthy(),
|
||||
isBlocked = contactDetails.dto.isBlocked(),
|
||||
isCurrentUser = contactDetails.isCurrentUser,
|
||||
contactRequest = toContactStatus(contactDetails.dto.contactRequestState),
|
||||
|
@ -129,18 +127,6 @@ method viewDidLoad*(self: Module) =
|
|||
# self.buildModel(self.view.receivedButRejectedContactRequestsModel(), 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.delegate.contactsModuleDidLoad()
|
||||
|
||||
|
@ -253,10 +239,10 @@ method contactNicknameChanged*(self: Module, publicKey: string) =
|
|||
# self.view.sentButRejectedContactRequestsModel().setName(publicKey, displayName, ensName, localNickname)
|
||||
self.view.blockedContactsModel().setName(publicKey, displayName, ensName, localNickname)
|
||||
|
||||
method contactTrustStatusChanged*(self: Module, publicKey: string, isUntrustworthy: bool) =
|
||||
self.view.myMutualContactsModel().updateTrustStatus(publicKey, isUntrustworthy)
|
||||
self.view.blockedContactsModel().updateTrustStatus(publicKey, isUntrustworthy)
|
||||
self.updateContactVerificationStatus(publicKey)
|
||||
method contactTrustStatusChanged*(self: Module, publicKey: string, trustStatus: TrustStatus) =
|
||||
self.view.contactsModel().updateTrustStatus(publicKey, trustStatus)
|
||||
self.view.myMutualContactsModel().updateTrustStatus(publicKey, trustStatus)
|
||||
self.view.blockedContactsModel().updateTrustStatus(publicKey, trustStatus)
|
||||
|
||||
method markAsTrusted*(self: Module, publicKey: string): void =
|
||||
self.controller.markAsTrusted(publicKey)
|
||||
|
@ -267,89 +253,6 @@ method markUntrustworthy*(self: Module, publicKey: string): void =
|
|||
method removeTrustStatus*(self: Module, publicKey: string): void =
|
||||
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) =
|
||||
self.controller.requestContactInfo(publicKey)
|
||||
|
||||
|
|
|
@ -218,27 +218,6 @@ QtObject:
|
|||
proc removeTrustStatus*(self: View, publicKey: string) {.slot.} =
|
||||
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.} =
|
||||
return self.delegate.shareUserUrlWithData(pubkey)
|
||||
|
||||
|
@ -248,12 +227,6 @@ QtObject:
|
|||
proc shareUserUrlWithENS*(self: View, pubkey: string): string {.slot.} =
|
||||
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.} =
|
||||
self.delegate.requestContactInfo(publicKey)
|
||||
|
||||
|
|
|
@ -26,19 +26,17 @@ proc initMemberItem*(
|
|||
colorId: int,
|
||||
colorHash: string = "",
|
||||
onlineStatus: OnlineStatus = OnlineStatus.Inactive,
|
||||
isCurrentUser: bool = false,
|
||||
isContact: bool = false,
|
||||
isVerified: bool,
|
||||
isUntrustworthy: bool = false,
|
||||
trustStatus: TrustStatus = TrustStatus.Unknown,
|
||||
isBlocked: bool = false,
|
||||
contactRequest: ContactRequest = ContactRequest.None,
|
||||
incomingVerificationStatus: VerificationRequestStatus = VerificationRequestStatus.None,
|
||||
outgoingVerificationStatus: VerificationRequestStatus = VerificationRequestStatus.None,
|
||||
memberRole: MemberRole = MemberRole.None,
|
||||
joined: bool = false,
|
||||
requestToJoinId: string = "",
|
||||
requestToJoinLoading: bool = false,
|
||||
airdropAddress: string = "",
|
||||
membershipRequestState: MembershipRequestState = MembershipRequestState.None
|
||||
membershipRequestState: MembershipRequestState = MembershipRequestState.None,
|
||||
): MemberItem =
|
||||
result = MemberItem()
|
||||
result.memberRole = memberRole
|
||||
|
@ -59,12 +57,10 @@ proc initMemberItem*(
|
|||
colorHash = colorHash,
|
||||
onlineStatus = onlineStatus,
|
||||
isContact = isContact,
|
||||
isVerified = isVerified,
|
||||
isUntrustworthy = isUntrustworthy,
|
||||
isCurrentUser = isCurrentUser,
|
||||
isBlocked = isBlocked,
|
||||
contactRequest = contactRequest,
|
||||
incomingVerificationStatus = incomingVerificationStatus,
|
||||
outgoingVerificationStatus = outgoingVerificationStatus
|
||||
trustStatus = trustStatus,
|
||||
)
|
||||
|
||||
proc `$`*(self: MemberItem): string =
|
||||
|
@ -81,12 +77,9 @@ proc `$`*(self: MemberItem): string =
|
|||
colorHash: {self.colorHash},
|
||||
onlineStatus: {$self.onlineStatus.int},
|
||||
isContact: {self.isContact},
|
||||
isVerified: {self.isVerified},
|
||||
isUntrustworthy: {self.isUntrustworthy},
|
||||
trustStatus: {self.trustStatus.int},
|
||||
isBlocked: {self.isBlocked},
|
||||
contactRequest: {$self.contactRequest.int},
|
||||
incomingVerificationStatus: {$self.incomingVerificationStatus.int},
|
||||
outgoingVerificationStatus: {$self.outgoingVerificationStatus.int},
|
||||
memberRole: {self.memberRole},
|
||||
joined: {self.joined},
|
||||
requestToJoinId: {self.requestToJoinId},
|
||||
|
|
|
@ -23,10 +23,9 @@ type
|
|||
IsContact
|
||||
IsVerified
|
||||
IsUntrustworthy
|
||||
TrustStatus
|
||||
IsBlocked
|
||||
ContactRequest
|
||||
IncomingVerificationStatus
|
||||
OutgoingVerificationStatus
|
||||
MemberRole
|
||||
Joined
|
||||
RequestToJoinId
|
||||
|
@ -93,10 +92,9 @@ QtObject:
|
|||
ModelRole.IsContact.int: "isContact",
|
||||
ModelRole.IsVerified.int: "isVerified",
|
||||
ModelRole.IsUntrustworthy.int: "isUntrustworthy",
|
||||
ModelRole.TrustStatus.int: "trustStatus",
|
||||
ModelRole.IsBlocked.int: "isBlocked",
|
||||
ModelRole.ContactRequest.int: "contactRequest",
|
||||
ModelRole.IncomingVerificationStatus.int: "incomingVerificationStatus",
|
||||
ModelRole.OutgoingVerificationStatus.int: "outgoingVerificationStatus",
|
||||
ModelRole.MemberRole.int: "memberRole",
|
||||
ModelRole.Joined.int: "joined",
|
||||
ModelRole.RequestToJoinId.int: "requestToJoinId",
|
||||
|
@ -142,17 +140,15 @@ QtObject:
|
|||
of ModelRole.IsContact:
|
||||
result = newQVariant(item.isContact)
|
||||
of ModelRole.IsVerified:
|
||||
result = newQVariant(item.isVerified)
|
||||
result = newQVariant(not item.isCurrentUser and item.trustStatus == TrustStatus.Trusted)
|
||||
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:
|
||||
result = newQVariant(item.isBlocked)
|
||||
of ModelRole.ContactRequest:
|
||||
result = newQVariant(item.contactRequest.int)
|
||||
of ModelRole.IncomingVerificationStatus:
|
||||
result = newQVariant(item.incomingVerificationStatus.int)
|
||||
of ModelRole.OutgoingVerificationStatus:
|
||||
result = newQVariant(item.outgoingVerificationStatus.int)
|
||||
of ModelRole.MemberRole:
|
||||
result = newQVariant(item.memberRole.int)
|
||||
of ModelRole.Joined:
|
||||
|
@ -283,11 +279,10 @@ QtObject:
|
|||
alias: string,
|
||||
icon: string,
|
||||
isContact: bool,
|
||||
isVerified: bool,
|
||||
memberRole: MemberRole,
|
||||
joined: bool,
|
||||
isUntrustworthy: bool,
|
||||
membershipRequestState: MembershipRequestState = MembershipRequestState.None,
|
||||
trustStatus: TrustStatus,
|
||||
callDataChanged: bool = true,
|
||||
): seq[int] =
|
||||
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(localNickname, ensName, displayName, self.items[ind].alias)
|
||||
|
||||
let trustStatusChanged = trustStatus != self.items[ind].trustStatus
|
||||
|
||||
updateRole(displayName, DisplayName)
|
||||
updateRole(ensName, EnsName)
|
||||
updateRole(localNickname, LocalNickname)
|
||||
|
@ -307,10 +304,9 @@ QtObject:
|
|||
updateRole(alias, Alias)
|
||||
updateRole(icon, Icon)
|
||||
updateRole(isContact, IsContact)
|
||||
updateRole(isVerified, IsVerified)
|
||||
updateRole(memberRole, MemberRole)
|
||||
updateRole(joined, Joined)
|
||||
updateRole(isUntrustworthy, IsUntrustworthy)
|
||||
updateRole(trustStatus, TrustStatus)
|
||||
|
||||
var updatedMembershipRequestState = membershipRequestState
|
||||
if updatedMembershipRequestState == MembershipRequestState.None:
|
||||
|
@ -321,6 +317,10 @@ QtObject:
|
|||
if preferredDisplayNameChanged:
|
||||
roles.add(ModelRole.PreferredDisplayName.int)
|
||||
|
||||
if trustStatusChanged:
|
||||
roles.add(ModelRole.IsUntrustworthy.int)
|
||||
roles.add(ModelRole.IsVerified.int)
|
||||
|
||||
if roles.len == 0:
|
||||
return
|
||||
|
||||
|
@ -348,11 +348,10 @@ QtObject:
|
|||
item.alias,
|
||||
item.icon,
|
||||
item.isContact,
|
||||
item.isVerified,
|
||||
item.memberRole,
|
||||
item.joined,
|
||||
item.isUntrustworthy,
|
||||
item.membershipRequestState,
|
||||
item.trustStatus,
|
||||
callDataChanged = false,
|
||||
)
|
||||
|
||||
|
@ -419,8 +418,7 @@ QtObject:
|
|||
alias: string,
|
||||
icon: string,
|
||||
isContact: bool,
|
||||
isVerified: bool,
|
||||
isUntrustworthy: bool,
|
||||
trustStatus: TrustStatus,
|
||||
) =
|
||||
let ind = self.findIndexForMember(pubKey)
|
||||
if ind == -1:
|
||||
|
@ -435,11 +433,10 @@ QtObject:
|
|||
alias,
|
||||
icon,
|
||||
isContact,
|
||||
isVerified,
|
||||
memberRole = self.items[ind].memberRole,
|
||||
joined = self.items[ind].joined,
|
||||
isUntrustworthy,
|
||||
self.items[ind].membershipRequestState,
|
||||
trustStatus,
|
||||
)
|
||||
|
||||
proc setOnlineStatus*(self: Model, pubKey: string, onlineStatus: OnlineStatus) =
|
||||
|
|
|
@ -348,10 +348,19 @@ proc updateMember*(
|
|||
alias: string,
|
||||
image: string,
|
||||
isContact: bool,
|
||||
isVerified: bool,
|
||||
isUntrustworthy: bool) =
|
||||
self.membersModel.updateItem(pubkey, name, ensName, isEnsVerified, nickname, alias, image, isContact,
|
||||
isVerified, isUntrustworthy)
|
||||
trustStatus: TrustStatus,
|
||||
) =
|
||||
self.membersModel.updateItem(
|
||||
pubkey,
|
||||
name,
|
||||
ensName,
|
||||
isEnsVerified,
|
||||
nickname,
|
||||
alias,
|
||||
image,
|
||||
isContact,
|
||||
trustStatus,
|
||||
)
|
||||
|
||||
proc amIBanned*(self: SectionItem): bool {.inline.} =
|
||||
return self.membersModel.isUserBanned(singletonInstance.userProfile.getPubKey())
|
||||
|
|
|
@ -5,6 +5,7 @@ import json
|
|||
import section_item, member_model, member_item
|
||||
import ../main/communities/tokens/models/[token_item, token_model]
|
||||
import model_utils
|
||||
import ../../../app_service/common/types
|
||||
|
||||
type
|
||||
ModelRole {.pure.} = enum
|
||||
|
@ -343,8 +344,7 @@ QtObject:
|
|||
alias: string,
|
||||
icon: string,
|
||||
isContact: bool,
|
||||
isVerified: bool,
|
||||
isUntrustworthy: bool,
|
||||
trustStatus: TrustStatus,
|
||||
) =
|
||||
for item in self.items:
|
||||
item.members.updateItem(
|
||||
|
@ -356,8 +356,7 @@ QtObject:
|
|||
alias,
|
||||
icon,
|
||||
isContact,
|
||||
isVerified,
|
||||
isUntrustworthy,
|
||||
trustStatus,
|
||||
)
|
||||
|
||||
proc getNthEnabledItem*(self: SectionModel, nth: int): SectionItem =
|
||||
|
|
|
@ -10,26 +10,6 @@ type
|
|||
Received = 3
|
||||
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
|
||||
proc toContactStatus*(value: ContactRequestState): ContactRequest =
|
||||
case value:
|
||||
|
@ -53,12 +33,8 @@ type
|
|||
colorHash: string
|
||||
onlineStatus: OnlineStatus
|
||||
isContact: bool
|
||||
isVerified: bool
|
||||
isUntrustworthy: bool
|
||||
isBlocked: bool
|
||||
contactRequest: ContactRequest
|
||||
incomingVerificationStatus: VerificationRequestStatus
|
||||
outgoingVerificationStatus: VerificationRequestStatus
|
||||
#Contact extra details
|
||||
isCurrentUser: bool
|
||||
defaultDisplayName: string
|
||||
|
@ -86,12 +62,8 @@ proc setup*(self: UserItem,
|
|||
colorHash: string,
|
||||
onlineStatus: OnlineStatus,
|
||||
isContact: bool,
|
||||
isVerified: bool,
|
||||
isUntrustworthy: bool,
|
||||
isBlocked: bool,
|
||||
contactRequest: ContactRequest,
|
||||
incomingVerificationStatus: VerificationRequestStatus,
|
||||
outgoingVerificationStatus: VerificationRequestStatus,
|
||||
#TODO: #14964 - remove defaults
|
||||
isCurrentUser: bool = false,
|
||||
defaultDisplayName: string = "",
|
||||
|
@ -118,12 +90,8 @@ proc setup*(self: UserItem,
|
|||
self.colorHash = colorHash
|
||||
self.onlineStatus = onlineStatus
|
||||
self.isContact = isContact
|
||||
self.isVerified = isVerified
|
||||
self.isUntrustworthy = isUntrustworthy
|
||||
self.isBlocked = isBlocked
|
||||
self.contactRequest = contactRequest
|
||||
self.incomingVerificationStatus = incomingVerificationStatus
|
||||
self.outgoingVerificationStatus = outgoingVerificationStatus
|
||||
self.isCurrentUser = isCurrentUser
|
||||
self.defaultDisplayName = defaultDisplayName
|
||||
self.optionalName = optionalName
|
||||
|
@ -152,12 +120,8 @@ proc initUserItem*(
|
|||
colorHash: string = "",
|
||||
onlineStatus: OnlineStatus,
|
||||
isContact: bool,
|
||||
isVerified: bool,
|
||||
isUntrustworthy: bool,
|
||||
isBlocked: bool,
|
||||
contactRequest: ContactRequest = ContactRequest.None,
|
||||
incomingVerificationStatus: VerificationRequestStatus = VerificationRequestStatus.None,
|
||||
outgoingVerificationStatus: VerificationRequestStatus = VerificationRequestStatus.None,
|
||||
isCurrentUser: bool = false,
|
||||
defaultDisplayName: string = "",
|
||||
optionalName: string = "",
|
||||
|
@ -185,13 +149,9 @@ proc initUserItem*(
|
|||
colorHash = colorHash,
|
||||
onlineStatus = onlineStatus,
|
||||
isContact = isContact,
|
||||
isVerified = isVerified,
|
||||
isUntrustworthy = isUntrustworthy,
|
||||
isBlocked = isBlocked,
|
||||
contactRequest = contactRequest,
|
||||
incomingVerificationStatus = incomingVerificationStatus,
|
||||
isCurrentUser = isCurrentUser,
|
||||
outgoingVerificationStatus = outgoingVerificationStatus,
|
||||
defaultDisplayName = defaultDisplayName,
|
||||
optionalName = optionalName,
|
||||
lastUpdated = lastUpdated,
|
||||
|
@ -219,12 +179,8 @@ proc `$`*(self: UserItem): string =
|
|||
colorHash: {self.colorHash},
|
||||
onlineStatus: {$self.onlineStatus.int},
|
||||
isContact: {self.isContact},
|
||||
isVerified: {self.isVerified},
|
||||
isUntrustworthy: {self.isUntrustworthy},
|
||||
isBlocked: {self.isBlocked},
|
||||
contactRequest: {$self.contactRequest.int},
|
||||
incomingVerificationStatus: {$self.incomingVerificationStatus.int},
|
||||
outgoingVerificationStatus: {$self.outgoingVerificationStatus.int},
|
||||
isCurrentUser: {self.isCurrentUser},
|
||||
defaultDisplayName: {self.defaultDisplayName},
|
||||
optionalName: {self.optionalName},
|
||||
|
@ -303,18 +259,6 @@ proc isContact*(self: UserItem): bool {.inline.} =
|
|||
proc `isContact=`*(self: UserItem, value: bool) {.inline.} =
|
||||
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.} =
|
||||
self.isBlocked
|
||||
|
||||
|
@ -327,18 +271,6 @@ proc contactRequest*(self: UserItem): ContactRequest {.inline.} =
|
|||
proc `contactRequest=`*(self: UserItem, value: ContactRequest) {.inline.} =
|
||||
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.} =
|
||||
self.isCurrentUser
|
||||
|
||||
|
|
|
@ -23,8 +23,6 @@ type
|
|||
IsUntrustworthy
|
||||
IsBlocked
|
||||
ContactRequest
|
||||
IncomingVerificationStatus
|
||||
OutgoingVerificationStatus
|
||||
IsCurrentUser
|
||||
DefaultDisplayName
|
||||
OptionalName
|
||||
|
@ -100,8 +98,6 @@ QtObject:
|
|||
ModelRole.IsUntrustworthy.int: "isUntrustworthy",
|
||||
ModelRole.IsBlocked.int: "isBlocked",
|
||||
ModelRole.ContactRequest.int: "contactRequest",
|
||||
ModelRole.IncomingVerificationStatus.int: "incomingVerificationStatus",
|
||||
ModelRole.OutgoingVerificationStatus.int: "outgoingVerificationStatus",
|
||||
ModelRole.IsCurrentUser.int: "isCurrentUser",
|
||||
ModelRole.DefaultDisplayName.int: "defaultDisplayName",
|
||||
ModelRole.OptionalName.int: "optionalName",
|
||||
|
@ -154,17 +150,13 @@ QtObject:
|
|||
of ModelRole.IsContact:
|
||||
result = newQVariant(item.isContact)
|
||||
of ModelRole.IsVerified:
|
||||
result = newQVariant(item.isVerified)
|
||||
result = newQVariant(not item.isCurrentUser and item.trustStatus == TrustStatus.Trusted)
|
||||
of ModelRole.IsUntrustworthy:
|
||||
result = newQVariant(item.isUntrustworthy)
|
||||
result = newQVariant(not item.isCurrentUser and item.trustStatus == TrustStatus.Untrustworthy)
|
||||
of ModelRole.IsBlocked:
|
||||
result = newQVariant(item.isBlocked)
|
||||
of ModelRole.ContactRequest:
|
||||
result = newQVariant(item.contactRequest.int)
|
||||
of ModelRole.IncomingVerificationStatus:
|
||||
result = newQVariant(item.incomingVerificationStatus.int)
|
||||
of ModelRole.OutgoingVerificationStatus:
|
||||
result = newQVariant(item.outgoingVerificationStatus.int)
|
||||
of ModelRole.IsCurrentUser:
|
||||
result = newQVariant(item.isCurrentUser)
|
||||
of ModelRole.DefaultDisplayName:
|
||||
|
@ -309,7 +301,7 @@ QtObject:
|
|||
localNickname: string,
|
||||
alias: string,
|
||||
icon: string,
|
||||
isUntrustworthy: bool = false,
|
||||
trustStatus: TrustStatus,
|
||||
) =
|
||||
let ind = self.findIndexByPubKey(pubKey)
|
||||
if ind == -1:
|
||||
|
@ -321,16 +313,22 @@ QtObject:
|
|||
resolvePreferredDisplayName(self.items[ind].localNickname, self.items[ind].ensName, self.items[ind].displayName, self.items[ind].alias) !=
|
||||
resolvePreferredDisplayName(localNickname, ensName, displayName, alias)
|
||||
|
||||
let trustStatusChanged = trustStatus != self.items[ind].trustStatus
|
||||
|
||||
updateRole(displayName, DisplayName)
|
||||
updateRole(ensName, EnsName)
|
||||
updateRole(localNickname, LocalNickname)
|
||||
updateRole(alias, Alias)
|
||||
updateRole(icon, Icon)
|
||||
updateRole(isUntrustworthy, IsUntrustworthy)
|
||||
updateRole(trustStatus, TrustStatus)
|
||||
|
||||
if preferredDisplayNameChanged:
|
||||
roles.add(ModelRole.PreferredDisplayName.int)
|
||||
|
||||
if trustStatusChanged:
|
||||
roles.add(ModelRole.IsUntrustworthy.int)
|
||||
roles.add(ModelRole.IsVerified.int)
|
||||
|
||||
if roles.len == 0:
|
||||
return
|
||||
|
||||
|
@ -339,50 +337,36 @@ QtObject:
|
|||
self.dataChanged(index, index, roles)
|
||||
self.itemChanged(pubKey)
|
||||
|
||||
proc updateIncomingRequestStatus*(
|
||||
self: Model,
|
||||
pubKey: string,
|
||||
requestStatus: VerificationRequestStatus
|
||||
) =
|
||||
proc updateTrustStatus*(self: Model, pubKey: string, trustStatus: TrustStatus) =
|
||||
let ind = self.findIndexByPubKey(pubKey)
|
||||
if(ind == -1):
|
||||
if ind == -1:
|
||||
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)
|
||||
defer: index.delete
|
||||
self.dataChanged(index, index, @[
|
||||
ModelRole.IncomingVerificationStatus.int
|
||||
])
|
||||
self.dataChanged(index, index, @[ModelRole.TrustStatus.int, ModelRole.IsUntrustworthy.int, ModelRole.IsVerified.int])
|
||||
self.itemChanged(pubKey)
|
||||
|
||||
proc updateTrustStatus*(self: Model, pubKey: string, isUntrustworthy: bool) =
|
||||
proc setOnlineStatus*(self: Model, pubKey: string, onlineStatus: OnlineStatus) =
|
||||
let ind = self.findIndexByPubKey(pubKey)
|
||||
if(ind == -1):
|
||||
if ind == -1:
|
||||
return
|
||||
|
||||
let first = self.createIndex(ind, 0, nil)
|
||||
let last = self.createIndex(ind, 0, nil)
|
||||
defer: first.delete
|
||||
defer: last.delete
|
||||
self.items[ind].isUntrustworthy = isUntrustworthy
|
||||
self.dataChanged(first, last, @[ModelRole.IsUntrustworthy.int])
|
||||
if self.items[ind].onlineStatus == onlineStatus:
|
||||
return
|
||||
|
||||
self.items[ind].onlineStatus = onlineStatus
|
||||
|
||||
let index = self.createIndex(ind, 0, nil)
|
||||
defer: index.delete
|
||||
self.dataChanged(index, index, @[ModelRole.OnlineStatus.int])
|
||||
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
|
||||
proc removeItemById*(self: Model, pubKey: string) =
|
||||
|
|
|
@ -97,3 +97,8 @@ type RequestToJoinState* {.pure.} = enum
|
|||
None = 0
|
||||
InProgress
|
||||
Requested
|
||||
|
||||
type TrustStatus* {.pure.}= enum
|
||||
Unknown = 0,
|
||||
Trusted = 1,
|
||||
Untrustworthy = 2
|
||||
|
|
|
@ -64,7 +64,6 @@ type ActivityCenterNotificationDto* = ref object of RootObj
|
|||
chatId*: string
|
||||
communityId*: string
|
||||
membershipStatus*: ActivityCenterMembershipStatus
|
||||
verificationStatus*: VerificationStatus
|
||||
name*: string
|
||||
author*: string
|
||||
installationId*: string
|
||||
|
@ -85,7 +84,6 @@ proc `$`*(self: ActivityCenterNotificationDto): string =
|
|||
chatId: {self.chatId},
|
||||
communityId: {self.communityId},
|
||||
membershipStatus: {self.membershipStatus},
|
||||
contactVerificationStatus: {self.verificationStatus},
|
||||
author: {self.author},
|
||||
installationId: {self.installationId},
|
||||
notificationType: {$self.notificationType.int},
|
||||
|
@ -113,13 +111,6 @@ proc toActivityCenterNotificationDto*(jsonObj: JsonNode): ActivityCenterNotifica
|
|||
membershipStatusInt <= ord(high(ActivityCenterMembershipStatus)))):
|
||||
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("installationId", result.installationId)
|
||||
|
||||
|
|
|
@ -10,11 +10,6 @@ type
|
|||
thumbnail*: string
|
||||
large*: string
|
||||
|
||||
type TrustStatus* {.pure.}= enum
|
||||
Unknown = 0,
|
||||
Trusted = 1,
|
||||
Untrustworthy = 2
|
||||
|
||||
type ContactRequestState* {.pure.} = enum
|
||||
None = 0
|
||||
Mutual = 1
|
||||
|
@ -22,25 +17,6 @@ type ContactRequestState* {.pure.} = enum
|
|||
Received = 3
|
||||
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
|
||||
id*: string
|
||||
name*: string
|
||||
|
@ -59,7 +35,6 @@ type ContactsDto* = object
|
|||
removed*: bool
|
||||
trustStatus*: TrustStatus
|
||||
contactRequestState*: ContactRequestState
|
||||
verificationStatus*: VerificationStatus
|
||||
|
||||
proc `$`(self: Images): string =
|
||||
result = fmt"""Images(
|
||||
|
@ -87,7 +62,6 @@ proc `$`*(self: ContactsDto): string =
|
|||
removed:{self.removed},
|
||||
trustStatus:{self.trustStatus},
|
||||
contactRequestState:{self.contactRequestState},
|
||||
verificationStatus:{self.verificationStatus},
|
||||
)"""
|
||||
|
||||
proc toImages(jsonObj: JsonNode): Images =
|
||||
|
@ -111,24 +85,6 @@ proc toTrustStatus*(value: int): TrustStatus =
|
|||
if value >= ord(low(TrustStatus)) or value <= ord(high(TrustStatus)):
|
||||
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 =
|
||||
result = ContactsDto()
|
||||
discard jsonObj.getProp("id", result.id)
|
||||
|
@ -153,10 +109,6 @@ proc toContactsDto*(jsonObj: JsonNode): ContactsDto =
|
|||
discard jsonObj.getProp("trustStatus", trustStatusInt)
|
||||
result.trustStatus = trustStatusInt.toTrustStatus()
|
||||
|
||||
var verificationStatusInt: int
|
||||
discard jsonObj.getProp("verificationStatus", verificationStatusInt)
|
||||
result.verificationStatus = verificationStatusInt.toVerificationStatus()
|
||||
|
||||
var imageObj: JsonNode
|
||||
if(jsonObj.getProp("images", imageObj)):
|
||||
result.image = toImages(imageObj)
|
||||
|
@ -215,7 +167,7 @@ proc trustStatus*(self: ContactsDto): TrustStatus =
|
|||
result = self.trustStatus
|
||||
|
||||
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 =
|
||||
return self.trustStatus == TrustStatus.Untrustworthy
|
||||
|
|
|
@ -37,7 +37,7 @@ type
|
|||
|
||||
TrustArgs* = ref object of Args
|
||||
publicKey*: string
|
||||
isUntrustworthy*: bool
|
||||
trustStatus*: TrustStatus
|
||||
|
||||
ResolvedContactArgs* = ref object of Args
|
||||
pubkey*: string
|
||||
|
@ -48,9 +48,6 @@ type
|
|||
ContactsStatusUpdatedArgs* = ref object of Args
|
||||
statusUpdates*: seq[StatusUpdateDto]
|
||||
|
||||
VerificationRequestArgs* = ref object of Args
|
||||
verificationRequest*: VerificationRequest
|
||||
|
||||
ContactInfoRequestArgs* = ref object of Args
|
||||
publicKey*: string
|
||||
ok*: bool
|
||||
|
@ -83,13 +80,6 @@ const SIGNAL_LOGGEDIN_USER_IMAGE_CHANGED* = "loggedInUserImageChanged"
|
|||
const SIGNAL_REMOVED_TRUST_STATUS* = "removedTrustStatus"
|
||||
const SIGNAL_CONTACT_UNTRUSTWORTHY* = "contactUntrustworthy"
|
||||
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_APPEND_CHAT_MESSAGES* = "appendChatMessages"
|
||||
|
||||
|
@ -114,7 +104,6 @@ QtObject:
|
|||
settingsService: settings_service.Service
|
||||
contacts: Table[string, ContactDetails] # [contact_id, ContactDetails]
|
||||
contactsStatus: Table[string, StatusUpdateDto] # [contact_id, StatusUpdateDto]
|
||||
receivedIdentityRequests: Table[string, VerificationRequest] # [from_id, VerificationRequest]
|
||||
events: EventEmitter
|
||||
closingApp: bool
|
||||
imageServerUrl: string
|
||||
|
@ -122,7 +111,6 @@ QtObject:
|
|||
# Forward declaration
|
||||
proc getContactById*(self: Service, id: string): ContactsDto
|
||||
proc saveContact(self: Service, contact: ContactsDto)
|
||||
proc fetchReceivedVerificationRequests*(self: Service) : seq[VerificationRequest]
|
||||
proc requestContactInfo*(self: Service, pubkey: string)
|
||||
proc constructContactDetails(self: Service, contactDto: ContactsDto): ContactDetails
|
||||
|
||||
|
@ -130,7 +118,6 @@ QtObject:
|
|||
self.closingApp = true
|
||||
self.contacts.clear
|
||||
self.contactsStatus.clear
|
||||
self.receivedIdentityRequests.clear
|
||||
self.QObject.delete
|
||||
|
||||
proc newService*(
|
||||
|
@ -148,7 +135,6 @@ QtObject:
|
|||
result.threadpool = threadpool
|
||||
result.contacts = initTable[string, ContactDetails]()
|
||||
result.contactsStatus = initTable[string, StatusUpdateDto]()
|
||||
result.receivedIdentityRequests = initTable[string, VerificationRequest]()
|
||||
|
||||
proc addContact(self: Service, contact: ContactDetails) =
|
||||
# Private proc, used for adding contacts only.
|
||||
|
@ -164,10 +150,6 @@ QtObject:
|
|||
for contact in contacts:
|
||||
self.addContact(self.constructContactDetails(contact))
|
||||
|
||||
# Identity verifications
|
||||
for request in self.fetchReceivedVerificationRequests():
|
||||
self.receivedIdentityRequests[request.fromId] = request
|
||||
|
||||
except Exception as e:
|
||||
let errDesription = e.msg
|
||||
error "error fetching contacts: ", errDesription
|
||||
|
@ -207,35 +189,6 @@ QtObject:
|
|||
let data = ContactArgs(contactId: c.id)
|
||||
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):
|
||||
let receivedData = MessageSignal(e)
|
||||
if receivedData.updatedProfileShowcaseContactIDs.len > 0:
|
||||
|
@ -650,7 +603,7 @@ QtObject:
|
|||
self.contacts[publicKey].dto.trustStatus = TrustStatus.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) =
|
||||
let response = status_contacts.markUntrustworthy(publicKey)
|
||||
|
@ -662,57 +615,7 @@ QtObject:
|
|||
self.contacts[publicKey].dto.trustStatus = TrustStatus.Untrustworthy
|
||||
|
||||
self.events.emit(SIGNAL_CONTACT_UNTRUSTWORTHY,
|
||||
TrustArgs(publicKey: publicKey, isUntrustworthy: true))
|
||||
|
||||
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
|
||||
TrustArgs(publicKey: publicKey, trustStatus: self.contacts[publicKey].dto.trustStatus))
|
||||
|
||||
proc removeTrustStatus*(self: Service, publicKey: string) =
|
||||
try:
|
||||
|
@ -726,141 +629,11 @@ QtObject:
|
|||
if self.contacts.hasKey(publicKey):
|
||||
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:
|
||||
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.} =
|
||||
let rpcResponseObj = pubkeyAndRpcResponse.parseJson
|
||||
let publicKey = rpcResponseObj{"publicKey"}.getStr
|
||||
|
|
|
@ -62,7 +62,6 @@ QtObject:
|
|||
proc getNotifSettingGlobalMentions*(self: Service): string
|
||||
proc getNotifSettingAllMessages*(self: Service): string
|
||||
proc getNotifSettingContactRequests*(self: Service): string
|
||||
proc getNotifSettingIdentityVerificationRequests*(self: Service): string
|
||||
proc getNotificationSoundsEnabled*(self: Service): bool
|
||||
proc getNotificationVolume*(self: Service): int
|
||||
proc getNotificationMessagePreview*(self: Service): int
|
||||
|
@ -126,7 +125,6 @@ QtObject:
|
|||
discard self.getNotifSettingGlobalMentions()
|
||||
discard self.getNotifSettingAllMessages()
|
||||
discard self.getNotifSettingContactRequests()
|
||||
discard self.getNotifSettingIdentityVerificationRequests()
|
||||
discard self.getNotificationSoundsEnabled()
|
||||
discard self.getNotificationVolume()
|
||||
discard self.getNotificationMessagePreview()
|
||||
|
@ -781,40 +779,6 @@ QtObject:
|
|||
write = setNotifSettingContactRequests
|
||||
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 getNotificationSoundsEnabled*(self: Service): bool {.slot.} =
|
||||
if self.initialized:
|
||||
|
|
|
@ -79,58 +79,14 @@ proc markUntrustworthy*(pubkey: string): RpcResponse[JsonNode] =
|
|||
let payload = %* [pubkey]
|
||||
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] =
|
||||
let payload = %* [pubkey]
|
||||
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] =
|
||||
let payload = %* [pubkey]
|
||||
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] =
|
||||
let payload = %*[{
|
||||
"id": pubkey
|
||||
|
|
|
@ -52,12 +52,6 @@ proc getContactRequests*(): RpcResponse[JsonNode] =
|
|||
proc setContactRequests*(value: string): RpcResponse[JsonNode] =
|
||||
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] =
|
||||
return core.callPrivateRPC("settings_notificationsGetSoundEnabled")
|
||||
|
||||
|
|
|
@ -96,7 +96,6 @@ SplitView {
|
|||
removed: false,
|
||||
trustStatus: Constants.trustStatus.unknown,
|
||||
verificationStatus: Constants.verificationStatus.unverified,
|
||||
incomingVerificationStatus: Constants.verificationStatus.unverified
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -96,14 +96,6 @@ SplitView {
|
|||
Layout.fillWidth: true
|
||||
text: "contactRequestState: " + contactDetails.contactRequestState
|
||||
}
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
text: "incomingVerificationStatus: " + contactDetails.incomingVerificationStatus
|
||||
}
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
text: "outgoingVerificationStatus: " + contactDetails.outgoingVerificationStatus
|
||||
}
|
||||
|
||||
Pane {
|
||||
contentItem: RowLayout {
|
||||
|
@ -168,8 +160,6 @@ SplitView {
|
|||
isUntrustworthy: false,
|
||||
isBlocked: false,
|
||||
contactRequestState: 3,
|
||||
incomingVerificationStatus: 3,
|
||||
outgoingVerificationStatus: 2,
|
||||
defaaaultDisplayName: "defaultDisplayName",
|
||||
optionalName: "optionalName",
|
||||
lastUpdated: 1234567890,
|
||||
|
|
|
@ -157,7 +157,6 @@ SplitView {
|
|||
removed: false,
|
||||
trustStatus: Constants.trustStatus.unknown,
|
||||
verificationStatus: Constants.verificationStatus.unverified,
|
||||
incomingVerificationStatus: Constants.verificationStatus.unverified
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,6 @@ SplitView {
|
|||
isSyncing: false,
|
||||
trustStatus: ctrlTrustStatus.currentValue,
|
||||
verificationStatus: ctrlVerificationStatus.currentValue,
|
||||
incomingVerificationStatus: ctrlIncomingVerificationStatus.currentValue,
|
||||
contactRequestState: ctrlContactRequestState.currentValue,
|
||||
bio: bio.text,
|
||||
onlineStatus: ctrlOnlineStatus.currentValue
|
||||
|
@ -319,7 +318,6 @@ SplitView {
|
|||
implicitWidth: 640
|
||||
|
||||
readOnly: ctrlReadOnly.checked
|
||||
idVerificationFlowsEnabled: true // enabled in SB
|
||||
publicKey: switchOwnProfile.checked ? "0xdeadbeef" : "0xrandomguy"
|
||||
|
||||
onCloseRequested: logs.logEvent("closeRequested()")
|
||||
|
@ -537,38 +535,6 @@ SplitView {
|
|||
RowLayout {
|
||||
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 {
|
||||
text: "Send ID request"
|
||||
onClicked: {
|
||||
|
|
|
@ -46,8 +46,6 @@ Item {
|
|||
isUntrustworthy: false,
|
||||
isBlocked: false,
|
||||
contactRequest: 3,
|
||||
incomingVerificationStatus: 3,
|
||||
outgoingVerificationStatus: 2,
|
||||
defaultDisplayName: "defaultDisplayName",
|
||||
optionalName: "optionalName",
|
||||
lastUpdated: 1234567890,
|
||||
|
@ -151,8 +149,6 @@ Item {
|
|||
compare(contactDetails.isUntrustworthy, false, "Expected the isUntrustworthy 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.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.optionalName, "optionalName", "Expected the optionalName to be set")
|
||||
compare(contactDetails.lastUpdated, 1234567890, "Expected the lastUpdated to be set")
|
||||
|
@ -260,8 +256,6 @@ Item {
|
|||
isUntrustworthy: true,
|
||||
isBlocked: true,
|
||||
contactRequest: 2,
|
||||
incomingVerificationStatus: 2,
|
||||
outgoingVerificationStatus: 1,
|
||||
defaultDisplayName: "newDefaultDisplayName",
|
||||
optionalName: "newOptionalName",
|
||||
lastUpdated: 1234567891,
|
||||
|
@ -295,8 +289,6 @@ Item {
|
|||
compare(contactDetails.isUntrustworthy, true, "Expected the isUntrustworthy 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.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.optionalName, "newOptionalName", "Expected the optionalName to be set")
|
||||
compare(contactDetails.lastUpdated, 1234567891, "Expected the lastUpdated to be set")
|
||||
|
|
|
@ -13,7 +13,7 @@ proc createTestMemberItem(pubKey: string): MemberItem =
|
|||
alias = "",
|
||||
icon = "",
|
||||
colorId = 0,
|
||||
isVerified = false,
|
||||
trustStatus = TrustStatus.Unknown,
|
||||
)
|
||||
|
||||
let memberA = createTestMemberItem("0xa")
|
||||
|
@ -44,10 +44,9 @@ suite "updating member items":
|
|||
alias = "",
|
||||
icon = "",
|
||||
isContact = false,
|
||||
isVerified = false,
|
||||
memberRole = MemberRole.None,
|
||||
joined = false,
|
||||
isUntrustworthy = false,
|
||||
trustStatus = TrustStatus.Unknown,
|
||||
callDataChanged = false,
|
||||
)
|
||||
# Two updated roles, because preferredDisplayName gets updated too
|
||||
|
@ -65,10 +64,9 @@ suite "updating member items":
|
|||
alias = "",
|
||||
icon = "icon",
|
||||
isContact = true,
|
||||
isVerified = false,
|
||||
memberRole = MemberRole.None,
|
||||
joined = false,
|
||||
isUntrustworthy = false,
|
||||
trustStatus = TrustStatus.Unknown,
|
||||
callDataChanged = false,
|
||||
)
|
||||
check(updatedRoles.len() == 2)
|
||||
|
|
|
@ -83,7 +83,7 @@ Row {
|
|||
return qsTr("Blocked")
|
||||
if (root.isContact) {
|
||||
if (root.trustIndicator === StatusContactVerificationIcons.TrustedType.Verified)
|
||||
return qsTr("ID verified contact")
|
||||
return qsTr("Trusted contact")
|
||||
if (root.trustIndicator === StatusContactVerificationIcons.TrustedType.Untrustworthy)
|
||||
return qsTr("Untrusted contact")
|
||||
return qsTr("Contact")
|
||||
|
|
|
@ -108,7 +108,7 @@ ItemDelegate {
|
|||
userName: ProfileUtils.displayName("", root.contactDetails.ensName, root.contactDetails.displayName, root.contactDetails.alias)
|
||||
pubKey: root.contactDetails.isEnsVerified ? "" : Utils.getCompressedPk(root.contactId)
|
||||
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
|
||||
isAdmin: root.contactDetails.memberRole === Constants.memberRole.owner
|
||||
status: root.contactDetails.onlineStatus
|
||||
|
|
|
@ -318,7 +318,7 @@ StatusScrollView {
|
|||
userName: ProfileUtils.displayName("", model.ensName, model.displayName, model.alias)
|
||||
pubKey: model.isEnsVerified ? "" : Utils.getCompressedPk(model.pubKey)
|
||||
isContact: model.isContact
|
||||
isVerified: model.verificationStatus === Constants.verificationStatus.verified
|
||||
isVerified: model.trustStatus === Constants.trustStatus.trusted
|
||||
isUntrustworthy: model.trustStatus === Constants.trustStatus.untrustworthy
|
||||
status: model.onlineStatus
|
||||
icon.name: model.icon
|
||||
|
|
|
@ -113,11 +113,6 @@ StatusDraggableListItem {
|
|||
showcaseVisibility: Constants.ShowcaseVisibility.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 {}
|
||||
|
||||
|
|
|
@ -32,8 +32,6 @@ QObject {
|
|||
readonly property bool isUntrustworthy: d.contactDetails.isUntrustworthy ?? false
|
||||
readonly property bool isBlocked: d.contactDetails.isBlocked ?? false
|
||||
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 optionalName: d.contactDetails.optionalName ?? ""
|
||||
readonly property int lastUpdated: d.contactDetails.lastUpdated ?? 0
|
||||
|
@ -50,11 +48,9 @@ QObject {
|
|||
// Backwards compatibility properties - Don't use in new code
|
||||
// TODO: #14965 - Try to remove these properties
|
||||
readonly property string name: ensName
|
||||
readonly property int verificationStatus: outgoingVerificationStatus
|
||||
|
||||
// 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
|
||||
//readonly property int verificationStatus: d.contactDetails.verificationStatus ?? Constants.verificationStatus.unverified
|
||||
//readonly property var socialLinks: d.contactDetails.socialLinks ?? []
|
||||
|
||||
ModelEntry {
|
||||
|
@ -91,8 +87,6 @@ QObject {
|
|||
readonly property bool isUntrustworthy: false
|
||||
readonly property bool isBlocked: false
|
||||
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 optionalName: defaultDisplayName
|
||||
readonly property string name: defaultDisplayName
|
||||
|
|
|
@ -69,18 +69,6 @@ StatusListItem {
|
|||
}
|
||||
|
||||
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 {
|
||||
objectName: "chatBtn"
|
||||
visible: showSendMessageButton
|
||||
|
|
|
@ -114,7 +114,6 @@ Item {
|
|||
isBlocked: model.isBlocked
|
||||
isVerified: model.isVerified
|
||||
isUntrustworthy: model.isUntrustworthy
|
||||
verificationRequestStatus: model.incomingVerificationStatus
|
||||
|
||||
showSendMessageButton: isContact && !isBlocked
|
||||
onOpenContactContextMenu: function (publicKey, name, icon) {
|
||||
|
|
|
@ -262,8 +262,7 @@ DoubleFlickableWithFolding {
|
|||
(d.isAnyHiddenDragActive ||
|
||||
parent.containsDrag ||
|
||||
everyoneContainsDrag ||
|
||||
contactsContainsDrag ||
|
||||
verifiedContainsDrag)
|
||||
contactsContainsDrag)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -414,7 +413,6 @@ DoubleFlickableWithFolding {
|
|||
|
||||
readonly property bool everyoneContainsDrag: dropAreaEveryone.containsDrag
|
||||
readonly property bool contactsContainsDrag: dropAreaContacts.containsDrag
|
||||
readonly property bool verifiedContainsDrag: dropAreaVerified.containsDrag
|
||||
property int margins: Theme.halfPadding
|
||||
|
||||
RowLayout {
|
||||
|
@ -439,15 +437,6 @@ DoubleFlickableWithFolding {
|
|||
text: qsTr("Contacts")
|
||||
dropAreaKeys: d.dragHiddenItemKey
|
||||
}
|
||||
|
||||
VisibilityDropAreaButton {
|
||||
id: dropAreaVerified
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
showcaseVisibility: Constants.ShowcaseVisibility.IdVerifiedContacts
|
||||
text: qsTr("Verified")
|
||||
dropAreaKeys: d.dragHiddenItemKey
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -127,46 +127,6 @@ QtObject {
|
|||
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) {
|
||||
root.contactsModule.requestContactInfo(publicKey)
|
||||
}
|
||||
|
|
|
@ -165,7 +165,7 @@ SettingsContentBase {
|
|||
ContactsListPanel {
|
||||
id: verifiedContacts
|
||||
Layout.fillWidth: true
|
||||
title: qsTr("Identity Verified Contacts")
|
||||
title: qsTr("Trusted Contacts")
|
||||
visible: !noFriendsItem.visible && count > 0
|
||||
contactsModel: root.contactsStore.myContactsModel
|
||||
searchString: searchBox.text
|
||||
|
@ -246,10 +246,6 @@ SettingsContentBase {
|
|||
onContactRequestRejected: {
|
||||
root.contactsStore.dismissContactRequest(publicKey, "")
|
||||
}
|
||||
|
||||
onShowVerificationRequest: {
|
||||
Global.openIncomingIDRequestPopup(publicKey, null, null)
|
||||
}
|
||||
}
|
||||
|
||||
ContactsListPanel {
|
||||
|
|
|
@ -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 {
|
||||
Layout.preferredWidth: root.contentWidth
|
||||
Layout.preferredHeight: Theme.bigPadding
|
||||
|
|
|
@ -61,11 +61,8 @@ QtObject {
|
|||
property var activePopupComponents: []
|
||||
|
||||
Component.onCompleted: {
|
||||
Global.openSendIDRequestPopup.connect(openSendIDRequestPopup)
|
||||
Global.openMarkAsIDVerifiedPopup.connect(openMarkAsIDVerifiedPopup)
|
||||
Global.openRemoveIDVerificationDialog.connect(openRemoveIDVerificationDialog)
|
||||
Global.openOutgoingIDRequestPopup.connect(openOutgoingIDRequestPopup)
|
||||
Global.openIncomingIDRequestPopup.connect(openIncomingIDRequestPopup)
|
||||
Global.openInviteFriendsToCommunityPopup.connect(openInviteFriendsToCommunityPopup)
|
||||
Global.openInviteFriendsToCommunityByIdPopup.connect(openInviteFriendsToCommunityByIdPopup)
|
||||
Global.openContactRequestPopup.connect(openContactRequestPopup)
|
||||
|
@ -185,17 +182,6 @@ QtObject {
|
|||
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) {
|
||||
openPopup(markAsIDVerifiedPopupComponent, {publicKey, contactDetails}, cb)
|
||||
}
|
||||
|
@ -204,32 +190,6 @@ QtObject {
|
|||
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) {
|
||||
openPopup(inviteFriendsToCommunityPopup, { community: community, communitySectionModule: communitySectionModule }, cb)
|
||||
}
|
||||
|
@ -421,7 +381,7 @@ QtObject {
|
|||
onAccepted: {
|
||||
rootStore.contactStore.removeContact(publicKey)
|
||||
if (removeIDVerification)
|
||||
rootStore.contactStore.removeTrustVerificationStatus(publicKey)
|
||||
rootStore.contactStore.removeTrustStatus(publicKey)
|
||||
if (markAsUntrusted) {
|
||||
rootStore.contactStore.markUntrustworthy(publicKey)
|
||||
Global.displaySuccessToastMessage(qsTr("%1 removed from contacts and marked as untrusted").arg(mainDisplayName))
|
||||
|
@ -433,52 +393,6 @@ QtObject {
|
|||
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 {
|
||||
id: markAsIDVerifiedPopupComponent
|
||||
|
@ -487,7 +401,7 @@ QtObject {
|
|||
|
||||
onAccepted: {
|
||||
rootStore.contactStore.markAsTrusted(publicKey)
|
||||
Global.displaySuccessToastMessage(qsTr("%1 ID verified").arg(mainDisplayName))
|
||||
Global.displaySuccessToastMessage(qsTr("%1 marked as trusted").arg(mainDisplayName))
|
||||
close()
|
||||
}
|
||||
onClosed: destroy()
|
||||
|
@ -500,20 +414,20 @@ QtObject {
|
|||
utilsStore: root.utilsStore
|
||||
|
||||
onAccepted: {
|
||||
rootStore.contactStore.removeTrustVerificationStatus(publicKey)
|
||||
rootStore.contactStore.removeTrustStatus(publicKey)
|
||||
|
||||
if (markAsUntrusted && removeContact) {
|
||||
rootStore.contactStore.markUntrustworthy(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) {
|
||||
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) {
|
||||
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 {
|
||||
Global.displaySuccessToastMessage(qsTr("%1 ID verification removed").arg(mainDisplayName))
|
||||
Global.displaySuccessToastMessage(qsTr("%1 trust mark removed").arg(mainDisplayName))
|
||||
}
|
||||
close()
|
||||
}
|
||||
|
@ -732,7 +646,7 @@ QtObject {
|
|||
onAccepted: {
|
||||
rootStore.contactStore.blockContact(publicKey)
|
||||
if (removeIDVerification)
|
||||
rootStore.contactStore.removeTrustVerificationStatus(publicKey)
|
||||
rootStore.contactStore.removeTrustStatus(publicKey)
|
||||
if (removeContact)
|
||||
rootStore.contactStore.removeContact(publicKey)
|
||||
Global.displaySuccessToastMessage(qsTr("%1 blocked").arg(mainDisplayName))
|
||||
|
|
|
@ -19,7 +19,6 @@ Item {
|
|||
property bool hasMentions: false
|
||||
property bool hasReplies: false
|
||||
property bool hasContactRequests: false
|
||||
property bool hasIdentityVerification: false
|
||||
property bool hasMembership: false
|
||||
|
||||
property bool hideReadNotifications: false
|
||||
|
@ -55,8 +54,6 @@ Item {
|
|||
{ 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("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("Membership"), group: ActivityCenterStore.ActivityCenterGroup.Membership, visible: true, enabled: root.hasMembership },
|
||||
{ text: qsTr("System"), group: ActivityCenterStore.ActivityCenterGroup.System, visible: false, enabled: true } ]
|
||||
|
|
|
@ -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()
|
||||
}
|
|
@ -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()
|
||||
}
|
|
@ -82,7 +82,6 @@ Popup {
|
|||
hasReplies: activityCenterStore.repliesCount > 0
|
||||
hasMentions: activityCenterStore.mentionsCount > 0
|
||||
hasContactRequests: activityCenterStore.contactRequestsCount > 0
|
||||
hasIdentityVerification: activityCenterStore.identityVerificationCount > 0
|
||||
hasMembership: activityCenterStore.membershipCount > 0
|
||||
hideReadNotifications: activityCenterStore.activityCenterReadType === ActivityCenterStore.ActivityCenterReadType.Unread
|
||||
activeGroup: activityCenterStore.activeNotificationGroup
|
||||
|
@ -121,8 +120,6 @@ Popup {
|
|||
return replyNotificationComponent
|
||||
case ActivityCenterStore.ActivityCenterNotificationType.ContactRequest:
|
||||
return contactRequestNotificationComponent
|
||||
case ActivityCenterStore.ActivityCenterNotificationType.ContactVerification:
|
||||
return verificationRequestNotificationComponent
|
||||
case ActivityCenterStore.ActivityCenterNotificationType.CommunityInvitation:
|
||||
return communityInvitationNotificationComponent
|
||||
case ActivityCenterStore.ActivityCenterNotificationType.CommunityMembershipRequest:
|
||||
|
@ -195,17 +192,6 @@ Popup {
|
|||
onCloseActivityCenter: root.close()
|
||||
}
|
||||
}
|
||||
Component {
|
||||
id: verificationRequestNotificationComponent
|
||||
|
||||
ActivityNotificationContactVerification {
|
||||
filteredIndex: parent.filteredIndex
|
||||
notification: parent.notification
|
||||
store: root.store
|
||||
activityCenterStore: root.activityCenterStore
|
||||
onCloseActivityCenter: root.close()
|
||||
}
|
||||
}
|
||||
Component {
|
||||
id: communityInvitationNotificationComponent
|
||||
|
||||
|
|
|
@ -78,7 +78,6 @@ QtObject {
|
|||
readonly property int mentionsCount: activityCenterModuleInst.mentionsCount
|
||||
readonly property int repliesCount: activityCenterModuleInst.repliesCount
|
||||
readonly property int contactRequestsCount: activityCenterModuleInst.contactRequestsCount
|
||||
readonly property int identityVerificationCount: activityCenterModuleInst.identityVerificationCount
|
||||
readonly property int membershipCount: activityCenterModuleInst.membershipCount
|
||||
|
||||
function markAllActivityCenterNotificationsRead() {
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -57,7 +57,7 @@ StatusButton {
|
|||
}
|
||||
ShowcaseVisibilityAction {
|
||||
showcaseVisibility: Constants.ShowcaseVisibility.IdVerifiedContacts
|
||||
text: qsTr("ID verified contact")
|
||||
text: qsTr("Trusted contact")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,12 +17,6 @@ CommonContactDialog {
|
|||
|
||||
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 {
|
||||
objectName: "youWillNotSeeText"
|
||||
Layout.fillWidth: true
|
||||
|
@ -57,10 +51,10 @@ CommonContactDialog {
|
|||
|
||||
StatusCheckBox {
|
||||
id: ctrlRemoveIDVerification
|
||||
visible: (contactDetails.isContact && d.isTrusted) || contactDetails.trustStatus === Constants.trustStatus.trusted
|
||||
visible: contactDetails.trustStatus === Constants.trustStatus.trusted
|
||||
checked: visible
|
||||
enabled: false
|
||||
text: qsTr("Remove ID verification")
|
||||
text: qsTr("Remove trust mark")
|
||||
}
|
||||
|
||||
rightButtons: ObjectModel {
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -8,12 +8,12 @@ import StatusQ.Controls 0.1
|
|||
CommonContactDialog {
|
||||
id: root
|
||||
|
||||
title: qsTr("Mark as ID verified")
|
||||
title: qsTr("Mark as trusted")
|
||||
|
||||
StatusBaseText {
|
||||
Layout.fillWidth: true
|
||||
wrapMode: Text.WordWrap
|
||||
text: qsTr("Mark users as ID verified only if you’re 100% sure who they are. Otherwise, it’s 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 {
|
||||
|
@ -22,7 +22,7 @@ CommonContactDialog {
|
|||
onClicked: root.close()
|
||||
}
|
||||
StatusButton {
|
||||
text: qsTr("Mark as ID verified")
|
||||
text: qsTr("Mark as trusted")
|
||||
onClicked: root.accepted()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,14 +17,6 @@ CommonContactDialog {
|
|||
|
||||
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 {
|
||||
Layout.fillWidth: true
|
||||
Layout.bottomMargin: Theme.halfPadding
|
||||
|
@ -34,10 +26,10 @@ CommonContactDialog {
|
|||
|
||||
StatusCheckBox {
|
||||
id: ctrlRemoveIDVerification
|
||||
visible: (contactDetails.isContact && d.isTrusted) || contactDetails.trustStatus === Constants.trustStatus.trusted
|
||||
visible: contactDetails.trustStatus === Constants.trustStatus.trusted
|
||||
checked: visible
|
||||
enabled: false
|
||||
text: qsTr("Remove ID verification")
|
||||
text: qsTr("Remove trust mark")
|
||||
}
|
||||
|
||||
StatusCheckBox {
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -17,12 +17,6 @@ CommonContactDialog {
|
|||
|
||||
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 {
|
||||
Layout.fillWidth: true
|
||||
Layout.bottomMargin: Theme.halfPadding
|
||||
|
@ -32,10 +26,10 @@ CommonContactDialog {
|
|||
|
||||
StatusCheckBox {
|
||||
id: ctrlRemoveIDVerification
|
||||
visible: d.isTrusted || contactDetails.trustStatus === Constants.trustStatus.trusted
|
||||
visible: contactDetails.trustStatus === Constants.trustStatus.trusted
|
||||
checked: visible
|
||||
enabled: false
|
||||
text: qsTr("Remove ID verification")
|
||||
text: qsTr("Remove trust mark")
|
||||
}
|
||||
|
||||
StatusCheckBox {
|
||||
|
|
|
@ -14,13 +14,13 @@ CommonContactDialog {
|
|||
readonly property bool markAsUntrusted: ctrlMarkAsUntrusted.checked
|
||||
readonly property bool removeContact: ctrlRemoveContact.checked
|
||||
|
||||
title: qsTr("Remove ID verification")
|
||||
title: qsTr("Remove trust mark")
|
||||
|
||||
StatusBaseText {
|
||||
Layout.fillWidth: true
|
||||
Layout.bottomMargin: Theme.halfPadding
|
||||
wrapMode: Text.WordWrap
|
||||
text: qsTr("%1’s 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 {
|
||||
|
@ -40,7 +40,7 @@ CommonContactDialog {
|
|||
}
|
||||
StatusButton {
|
||||
type: StatusBaseButton.Type.Danger
|
||||
text: qsTr("Remove ID verification")
|
||||
text: qsTr("Remove trust mark")
|
||||
onClicked: root.accepted()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@ Pane {
|
|||
id: root
|
||||
|
||||
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
|
||||
readonly property alias isCurrentUser: d.isCurrentUser
|
||||
|
@ -88,19 +87,6 @@ Pane {
|
|||
|
||||
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 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 {
|
||||
id: btnShareProfile
|
||||
StatusFlatButton {
|
||||
|
@ -292,22 +245,8 @@ Pane {
|
|||
Loader {
|
||||
Layout.alignment: Qt.AlignTop
|
||||
Layout.preferredHeight: menuButton.visible ? menuButton.height : -1
|
||||
sourceComponent: {
|
||||
if (d.isCurrentUser && !root.readOnly)
|
||||
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
|
||||
}
|
||||
}
|
||||
active: d.isCurrentUser && !root.readOnly
|
||||
sourceComponent: btnShareProfile
|
||||
}
|
||||
|
||||
// primary action button
|
||||
|
@ -338,12 +277,6 @@ Pane {
|
|||
return txtPendingContactRequestComponent
|
||||
case Constants.ContactRequestState.Received:
|
||||
break // handled above
|
||||
case Constants.ContactRequestState.Mutual: {
|
||||
if (d.outgoingVerificationStatus === Constants.verificationStatus.declined) {
|
||||
return btnBlockUserComponent
|
||||
}
|
||||
break
|
||||
}
|
||||
case Constants.ContactRequestState.None:
|
||||
case Constants.ContactRequestState.Dismissed:
|
||||
return btnSendContactRequestComponent
|
||||
|
@ -378,9 +311,9 @@ Pane {
|
|||
}
|
||||
}
|
||||
StatusAction {
|
||||
text: qsTr("Mark as ID verified")
|
||||
text: qsTr("Mark as trusted")
|
||||
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)
|
||||
}
|
||||
StatusAction {
|
||||
|
@ -408,10 +341,10 @@ Pane {
|
|||
}
|
||||
StatusMenuSeparator {}
|
||||
StatusAction {
|
||||
text: qsTr("Remove ID verification")
|
||||
text: qsTr("Remove trusted mark")
|
||||
icon.name: "delete"
|
||||
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)
|
||||
}
|
||||
StatusAction {
|
||||
|
@ -431,13 +364,6 @@ Pane {
|
|||
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 {
|
||||
text: qsTr("Remove untrusted mark")
|
||||
icon.name: "warning"
|
||||
|
|
|
@ -494,16 +494,6 @@ QtObject {
|
|||
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 int unknownPosition: -1
|
||||
readonly property int mutualContacts: 0
|
||||
|
|
|
@ -35,7 +35,6 @@ QtObject {
|
|||
signal openVideoPopup(string url)
|
||||
signal openProfilePopupRequested(string publicKey, var parentPopup, var cb)
|
||||
signal openActivityCenterPopupRequested()
|
||||
signal openSendIDRequestPopup(string publicKey, var contactDetails, var cb)
|
||||
signal openMarkAsIDVerifiedPopup(string publicKey, var contactDetails, var cb)
|
||||
signal openRemoveIDVerificationDialog(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 openInviteFriendsToCommunityPopup(var community, var communitySectionModule, 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 openDownloadImageDialog(string imageSource)
|
||||
signal openExportControlNodePopup(var community)
|
||||
|
|
|
@ -739,8 +739,6 @@ QtObject {
|
|||
removed: false,
|
||||
trustStatus: Constants.trustStatus.unknown,
|
||||
contactRequestState: Constants.ContactRequestState.None,
|
||||
verificationStatus: Constants.verificationStatus.unverified,
|
||||
incomingVerificationStatus: Constants.verificationStatus.unverified,
|
||||
socialLinks: [],
|
||||
bio: "",
|
||||
onlineStatus: Constants.onlineStatus.inactive
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 132ea05fc8735b91922a440009efdbc7f1b8b8ce
|
||||
Subproject commit d99fdf1b672c2f8207371e7e2386a403196341b9
|
Loading…
Reference in New Issue