chore(contacts): remove useless and duplicated contact properties

OptionalName and isSyncing were never used.
DefaultDisplayName was not really used and is actually a duplication of preferredDisplayName, so I replaced the limited usages of DefaultDisplayName by preferredDisplayName
This commit is contained in:
Jonathan Rainville 2024-10-30 12:17:15 -04:00 committed by Michał Cieślak
parent 9315dd26e0
commit f09acd1a70
11 changed files with 17 additions and 101 deletions

View File

@ -331,7 +331,7 @@ method toggleReactionFromOthers*(self: Module, messageId: string, emojiId: int,
if(item.shouldAddReaction(emojiIdAsEnum, reactionFrom)): if(item.shouldAddReaction(emojiIdAsEnum, reactionFrom)):
let userWhoAddedThisReaction = self.controller.getContactById(reactionFrom) let userWhoAddedThisReaction = self.controller.getContactById(reactionFrom)
self.view.pinnedModel().addReaction(messageId, emojiIdAsEnum, didIReactWithThisEmoji = false, self.view.pinnedModel().addReaction(messageId, emojiIdAsEnum, didIReactWithThisEmoji = false,
userWhoAddedThisReaction.id, userWhoAddedThisReaction.userDefaultDisplayName(), reactionId) userWhoAddedThisReaction.id, userWhoAddedThisReaction.userDefaultDisplayName(), reactionId)
else: else:
self.view.pinnedModel().removeReaction(messageId, emojiIdAsEnum, reactionId, didIRemoveThisReaction = false) self.view.pinnedModel().removeReaction(messageId, emojiIdAsEnum, reactionId, didIRemoveThisReaction = false)
else: else:

View File

@ -1188,8 +1188,6 @@ method getContactDetailsAsJson*[T](self: Module[T], publicKey: string, getVerifi
let jsonObj = %* { let jsonObj = %* {
# contact details props # contact details props
"defaultDisplayName": contactDetails.defaultDisplayName,
"optionalName": contactDetails.optionalName,
"icon": contactDetails.icon, "icon": contactDetails.icon,
"isCurrentUser": contactDetails.isCurrentUser, "isCurrentUser": contactDetails.isCurrentUser,
"colorId": contactDetails.colorId, "colorId": contactDetails.colorId,
@ -1210,7 +1208,6 @@ method getContactDetailsAsJson*[T](self: Module[T], publicKey: string, getVerifi
"isBlocked": contactDetails.dto.isBlocked, "isBlocked": contactDetails.dto.isBlocked,
"isContactRequestReceived": contactDetails.dto.isContactRequestReceived, "isContactRequestReceived": contactDetails.dto.isContactRequestReceived,
"isContactRequestSent": contactDetails.dto.isContactRequestSent, "isContactRequestSent": contactDetails.dto.isContactRequestSent,
"isSyncing": contactDetails.dto.isSyncing,
"removed": contactDetails.dto.removed, "removed": contactDetails.dto.removed,
"trustStatus": contactDetails.dto.trustStatus.int, "trustStatus": contactDetails.dto.trustStatus.int,
"contactRequestState": contactDetails.dto.contactRequestState.int, "contactRequestState": contactDetails.dto.contactRequestState.int,

View File

@ -87,8 +87,6 @@ proc createItemFromPublicKey(self: Module, publicKey: string): UserItem =
isBlocked = contactDetails.dto.isBlocked(), isBlocked = contactDetails.dto.isBlocked(),
isCurrentUser = contactDetails.isCurrentUser, isCurrentUser = contactDetails.isCurrentUser,
contactRequest = toContactStatus(contactDetails.dto.contactRequestState), contactRequest = toContactStatus(contactDetails.dto.contactRequestState),
defaultDisplayName = contactDetails.defaultDisplayName,
optionalName = contactDetails.optionalName,
lastUpdated = contactDetails.dto.lastUpdated, lastUpdated = contactDetails.dto.lastUpdated,
lastUpdatedLocally = contactDetails.dto.lastUpdatedLocally, lastUpdatedLocally = contactDetails.dto.lastUpdatedLocally,
bio = contactDetails.dto.bio, bio = contactDetails.dto.bio,
@ -96,7 +94,6 @@ proc createItemFromPublicKey(self: Module, publicKey: string): UserItem =
largeImage = contactDetails.dto.image.large, largeImage = contactDetails.dto.image.large,
isContactRequestReceived = contactDetails.dto.isContactRequestReceived, isContactRequestReceived = contactDetails.dto.isContactRequestReceived,
isContactRequestSent = contactDetails.dto.isContactRequestSent, isContactRequestSent = contactDetails.dto.isContactRequestSent,
isSyncing = contactDetails.dto.isSyncing,
isRemoved = contactDetails.dto.removed, isRemoved = contactDetails.dto.removed,
trustStatus = contactDetails.dto.trustStatus, trustStatus = contactDetails.dto.trustStatus,
) )

View File

@ -37,8 +37,6 @@ type
contactRequest: ContactRequest contactRequest: ContactRequest
#Contact extra details #Contact extra details
isCurrentUser: bool isCurrentUser: bool
defaultDisplayName: string
optionalName: string
lastUpdated: int64 lastUpdated: int64
lastUpdatedLocally: int64 lastUpdatedLocally: int64
bio: string bio: string
@ -46,7 +44,6 @@ type
largeImage: string largeImage: string
isContactRequestReceived: bool isContactRequestReceived: bool
isContactRequestSent: bool isContactRequestSent: bool
isSyncing: bool
isRemoved: bool isRemoved: bool
trustStatus: TrustStatus trustStatus: TrustStatus
@ -66,8 +63,6 @@ proc setup*(self: UserItem,
contactRequest: ContactRequest, contactRequest: ContactRequest,
#TODO: #14964 - remove defaults #TODO: #14964 - remove defaults
isCurrentUser: bool = false, isCurrentUser: bool = false,
defaultDisplayName: string = "",
optionalName: string = "",
lastUpdated: int64 = 0, lastUpdated: int64 = 0,
lastUpdatedLocally: int64 = 0, lastUpdatedLocally: int64 = 0,
bio: string = "", bio: string = "",
@ -75,7 +70,6 @@ proc setup*(self: UserItem,
largeImage: string = "", largeImage: string = "",
isContactRequestReceived: bool = false, isContactRequestReceived: bool = false,
isContactRequestSent: bool = false, isContactRequestSent: bool = false,
isSyncing: bool = false,
isRemoved: bool = false, isRemoved: bool = false,
trustStatus: TrustStatus = TrustStatus.Unknown, trustStatus: TrustStatus = TrustStatus.Unknown,
) = ) =
@ -93,8 +87,6 @@ proc setup*(self: UserItem,
self.isBlocked = isBlocked self.isBlocked = isBlocked
self.contactRequest = contactRequest self.contactRequest = contactRequest
self.isCurrentUser = isCurrentUser self.isCurrentUser = isCurrentUser
self.defaultDisplayName = defaultDisplayName
self.optionalName = optionalName
self.lastUpdated = lastUpdated self.lastUpdated = lastUpdated
self.lastUpdatedLocally = lastUpdatedLocally self.lastUpdatedLocally = lastUpdatedLocally
self.bio = bio self.bio = bio
@ -102,7 +94,6 @@ proc setup*(self: UserItem,
self.largeImage = largeImage self.largeImage = largeImage
self.isContactRequestReceived = isContactRequestReceived self.isContactRequestReceived = isContactRequestReceived
self.isContactRequestSent = isContactRequestSent self.isContactRequestSent = isContactRequestSent
self.isSyncing = isSyncing
self.isRemoved = isRemoved self.isRemoved = isRemoved
self.trustStatus = trustStatus self.trustStatus = trustStatus
@ -123,8 +114,6 @@ proc initUserItem*(
isBlocked: bool, isBlocked: bool,
contactRequest: ContactRequest = ContactRequest.None, contactRequest: ContactRequest = ContactRequest.None,
isCurrentUser: bool = false, isCurrentUser: bool = false,
defaultDisplayName: string = "",
optionalName: string = "",
lastUpdated: int64 = 0, lastUpdated: int64 = 0,
lastUpdatedLocally: int64 = 0, lastUpdatedLocally: int64 = 0,
bio: string = "", bio: string = "",
@ -132,7 +121,6 @@ proc initUserItem*(
largeImage: string = "", largeImage: string = "",
isContactRequestReceived: bool = false, isContactRequestReceived: bool = false,
isContactRequestSent: bool = false, isContactRequestSent: bool = false,
isSyncing: bool = false,
isRemoved: bool = false, isRemoved: bool = false,
trustStatus: TrustStatus = TrustStatus.Unknown, trustStatus: TrustStatus = TrustStatus.Unknown,
): UserItem = ): UserItem =
@ -152,8 +140,6 @@ proc initUserItem*(
isBlocked = isBlocked, isBlocked = isBlocked,
contactRequest = contactRequest, contactRequest = contactRequest,
isCurrentUser = isCurrentUser, isCurrentUser = isCurrentUser,
defaultDisplayName = defaultDisplayName,
optionalName = optionalName,
lastUpdated = lastUpdated, lastUpdated = lastUpdated,
lastUpdatedLocally = lastUpdatedLocally, lastUpdatedLocally = lastUpdatedLocally,
bio = bio, bio = bio,
@ -161,7 +147,6 @@ proc initUserItem*(
largeImage = largeImage, largeImage = largeImage,
isContactRequestReceived = isContactRequestReceived, isContactRequestReceived = isContactRequestReceived,
isContactRequestSent = isContactRequestSent, isContactRequestSent = isContactRequestSent,
isSyncing = isSyncing,
isRemoved = isRemoved, isRemoved = isRemoved,
trustStatus = trustStatus, trustStatus = trustStatus,
) )
@ -182,8 +167,6 @@ proc `$`*(self: UserItem): string =
isBlocked: {self.isBlocked}, isBlocked: {self.isBlocked},
contactRequest: {$self.contactRequest.int}, contactRequest: {$self.contactRequest.int},
isCurrentUser: {self.isCurrentUser}, isCurrentUser: {self.isCurrentUser},
defaultDisplayName: {self.defaultDisplayName},
optionalName: {self.optionalName},
lastUpdated: {self.lastUpdated}, lastUpdated: {self.lastUpdated},
lastUpdatedLocally: {self.lastUpdatedLocally}, lastUpdatedLocally: {self.lastUpdatedLocally},
bio: {self.bio}, bio: {self.bio},
@ -191,7 +174,6 @@ proc `$`*(self: UserItem): string =
largeImage: {self.largeImage}, largeImage: {self.largeImage},
isContactRequestReceived: {self.isContactRequestReceived}, isContactRequestReceived: {self.isContactRequestReceived},
isContactRequestSent: {self.isContactRequestSent}, isContactRequestSent: {self.isContactRequestSent},
isSyncing: {self.isSyncing},
isRemoved: {self.isRemoved}, isRemoved: {self.isRemoved},
trustStatus: {$self.trustStatus.int}, trustStatus: {$self.trustStatus.int},
]""" ]"""
@ -277,18 +259,6 @@ proc isCurrentUser*(self: UserItem): bool {.inline.} =
proc `isCurrentUser=`*(self: UserItem, value: bool) {.inline.} = proc `isCurrentUser=`*(self: UserItem, value: bool) {.inline.} =
self.isCurrentUser = value self.isCurrentUser = value
proc defaultDisplayName*(self: UserItem): string {.inline.} =
self.defaultDisplayName
proc `defaultDisplayName=`*(self: UserItem, value: string) {.inline.} =
self.defaultDisplayName = value
proc optionalName*(self: UserItem): string {.inline.} =
self.optionalName
proc `optionalName=`*(self: UserItem, value: string) {.inline.} =
self.optionalName = value
proc lastUpdated*(self: UserItem): int64 {.inline.} = proc lastUpdated*(self: UserItem): int64 {.inline.} =
self.lastUpdated self.lastUpdated
@ -331,12 +301,6 @@ proc isContactRequestSent*(self: UserItem): bool {.inline.} =
proc `isContactRequestSent=`*(self: UserItem, value: bool) {.inline.} = proc `isContactRequestSent=`*(self: UserItem, value: bool) {.inline.} =
self.isContactRequestSent = value self.isContactRequestSent = value
proc isSyncing*(self: UserItem): bool {.inline.} =
self.isSyncing
proc `isSyncing=`*(self: UserItem, value: bool) {.inline.} =
self.isSyncing = value
proc isRemoved*(self: UserItem): bool {.inline.} = proc isRemoved*(self: UserItem): bool {.inline.} =
self.isRemoved self.isRemoved

View File

@ -26,8 +26,6 @@ type
IsBlocked IsBlocked
ContactRequest ContactRequest
IsCurrentUser IsCurrentUser
DefaultDisplayName
OptionalName
LastUpdated LastUpdated
LastUpdatedLocally LastUpdatedLocally
Bio Bio
@ -35,7 +33,6 @@ type
LargeImage LargeImage
IsContactRequestReceived IsContactRequestReceived
IsContactRequestSent IsContactRequestSent
IsSyncing
IsRemoved IsRemoved
TrustStatus TrustStatus
@ -102,8 +99,6 @@ QtObject:
ModelRole.IsBlocked.int: "isBlocked", ModelRole.IsBlocked.int: "isBlocked",
ModelRole.ContactRequest.int: "contactRequest", ModelRole.ContactRequest.int: "contactRequest",
ModelRole.IsCurrentUser.int: "isCurrentUser", ModelRole.IsCurrentUser.int: "isCurrentUser",
ModelRole.DefaultDisplayName.int: "defaultDisplayName",
ModelRole.OptionalName.int: "optionalName",
ModelRole.LastUpdated.int: "lastUpdated", ModelRole.LastUpdated.int: "lastUpdated",
ModelRole.LastUpdatedLocally.int: "lastUpdatedLocally", ModelRole.LastUpdatedLocally.int: "lastUpdatedLocally",
ModelRole.Bio.int: "bio", ModelRole.Bio.int: "bio",
@ -111,7 +106,6 @@ QtObject:
ModelRole.LargeImage.int: "largeImage", ModelRole.LargeImage.int: "largeImage",
ModelRole.IsContactRequestReceived.int: "isContactRequestReceived", ModelRole.IsContactRequestReceived.int: "isContactRequestReceived",
ModelRole.IsContactRequestSent.int: "isContactRequestSent", ModelRole.IsContactRequestSent.int: "isContactRequestSent",
ModelRole.IsSyncing.int: "isSyncing",
ModelRole.IsRemoved.int: "isRemoved", ModelRole.IsRemoved.int: "isRemoved",
ModelRole.TrustStatus.int: "trustStatus", ModelRole.TrustStatus.int: "trustStatus",
}.toTable }.toTable
@ -164,12 +158,6 @@ QtObject:
result = newQVariant(item.contactRequest.int) result = newQVariant(item.contactRequest.int)
of ModelRole.IsCurrentUser: of ModelRole.IsCurrentUser:
result = newQVariant(item.isCurrentUser) result = newQVariant(item.isCurrentUser)
of ModelRole.DefaultDisplayName:
# TODO this is the same as preferred name
result = newQVariant(item.defaultDisplayName)
of ModelRole.OptionalName:
# This seems useless
result = newQVariant(item.optionalName)
of ModelRole.LastUpdated: of ModelRole.LastUpdated:
result = newQVariant(item.lastUpdated) result = newQVariant(item.lastUpdated)
of ModelRole.LastUpdatedLocally: of ModelRole.LastUpdatedLocally:
@ -184,9 +172,6 @@ QtObject:
result = newQVariant(item.isContactRequestReceived) result = newQVariant(item.isContactRequestReceived)
of ModelRole.IsContactRequestSent: of ModelRole.IsContactRequestSent:
result = newQVariant(item.isContactRequestSent) result = newQVariant(item.isContactRequestSent)
of ModelRole.IsSyncing:
# TODO not sure what that is and it's never used
result = newQVariant(item.isSyncing)
of ModelRole.IsRemoved: of ModelRole.IsRemoved:
result = newQVariant(item.isRemoved) result = newQVariant(item.isRemoved)
of ModelRole.TrustStatus: of ModelRole.TrustStatus:

View File

@ -31,7 +31,6 @@ type ContactsDto* = object
added*: bool added*: bool
blocked*: bool blocked*: bool
hasAddedUs*: bool hasAddedUs*: bool
isSyncing*: bool
removed*: bool removed*: bool
trustStatus*: TrustStatus trustStatus*: TrustStatus
contactRequestState*: ContactRequestState contactRequestState*: ContactRequestState
@ -58,7 +57,6 @@ proc `$`*(self: ContactsDto): string =
added:{self.added}, added:{self.added},
blocked:{self.blocked}, blocked:{self.blocked},
hasAddedUs:{self.hasAddedUs}, hasAddedUs:{self.hasAddedUs},
isSyncing:{self.isSyncing},
removed:{self.removed}, removed:{self.removed},
trustStatus:{self.trustStatus}, trustStatus:{self.trustStatus},
contactRequestState:{self.contactRequestState}, contactRequestState:{self.contactRequestState},
@ -116,7 +114,6 @@ proc toContactsDto*(jsonObj: JsonNode): ContactsDto =
discard jsonObj.getProp("added", result.added) discard jsonObj.getProp("added", result.added)
discard jsonObj.getProp("blocked", result.blocked) discard jsonObj.getProp("blocked", result.blocked)
discard jsonObj.getProp("hasAddedUs", result.hasAddedUs) discard jsonObj.getProp("hasAddedUs", result.hasAddedUs)
discard jsonObj.getProp("IsSyncing", result.isSyncing)
discard jsonObj.getProp("Removed", result.removed) discard jsonObj.getProp("Removed", result.removed)
proc userExtractedName(contact: ContactsDto): string = proc userExtractedName(contact: ContactsDto): string =

View File

@ -1,22 +1,14 @@
import QtQml 2.15 import QtTest 1.15
import QtQuick 2.15 import QtQuick 2.15
import QtQuick.Controls 2.15 import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15 import QtQuick.Layouts 1.15
import SortFilterProxyModel 0.2
import StatusQ.Components 0.1
import StatusQ.Controls 0.1
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Core.Utils 0.1 import StatusQ.Core.Utils 0.1
import Storybook 1.0
import utils 1.0
import Models 1.0 import Models 1.0
import AppLayouts.Profile.helpers 1.0 import AppLayouts.Profile.helpers 1.0
import AppLayouts.Profile.stores 1.0 import AppLayouts.Profile.stores 1.0
import QtTest 1.15
SplitView { SplitView {
id: root id: root
@ -160,15 +152,13 @@ SplitView {
isUntrustworthy: false, isUntrustworthy: false,
isBlocked: false, isBlocked: false,
contactRequestState: 3, contactRequestState: 3,
defaaaultDisplayName: "defaultDisplayName", preferredDisplayName: "preferredDisplayName",
optionalName: "optionalName",
lastUpdated: 1234567890, lastUpdated: 1234567890,
lastUpdatedLocally: 1234567890, lastUpdatedLocally: 1234567890,
thumbnailImage: "thumbnailImage", thumbnailImage: "thumbnailImage",
largeImage: "largeImage", largeImage: "largeImage",
isContactRequestReceived: false, isContactRequestReceived: false,
isContactRequestSent: false, isContactRequestSent: false,
isSyncing: false,
removed: false, removed: false,
trustStatus: 1, trustStatus: 1,
bio: "bio" bio: "bio"
@ -185,7 +175,7 @@ SplitView {
readonly property int colorId: 1 readonly property int colorId: 1
readonly property var colorHash: {} readonly property var colorHash: {}
readonly property int currentUserStatus: 1 readonly property int currentUserStatus: 1
readonly property string defaultDisplayName: "myDefaultDisplayName" readonly property string preferredDisplayName: "myPreferredDisplayName"
readonly property string thumbnailImage: "myThumbnailImage" readonly property string thumbnailImage: "myThumbnailImage"
readonly property string largeImage: "myLargeImage" readonly property string largeImage: "myLargeImage"
readonly property string bio: "myBio" readonly property string bio: "myBio"
@ -199,3 +189,6 @@ SplitView {
} }
} }
// category: Contacts // category: Contacts
// Page is working in general but throwing multiple "Cannot read property" when changing id via combo box
// status: decent

View File

@ -46,15 +46,13 @@ Item {
isUntrustworthy: false, isUntrustworthy: false,
isBlocked: false, isBlocked: false,
contactRequest: 3, contactRequest: 3,
defaultDisplayName: "defaultDisplayName", preferredDisplayName: "preferredDisplayName",
optionalName: "optionalName",
lastUpdated: 1234567890, lastUpdated: 1234567890,
lastUpdatedLocally: 1234567890, lastUpdatedLocally: 1234567890,
thumbnailImage: "thumbnailImage", thumbnailImage: "thumbnailImage",
largeImage: "largeImage", largeImage: "largeImage",
isContactRequestReceived: false, isContactRequestReceived: false,
isContactRequestSent: false, isContactRequestSent: false,
isSyncing: false,
isRemoved: false, isRemoved: false,
trustStatus: 1, trustStatus: 1,
bio: "bio" bio: "bio"
@ -74,7 +72,7 @@ Item {
readonly property int colorId: 1 readonly property int colorId: 1
readonly property var colorHash: {1} readonly property var colorHash: {1}
readonly property int currentUserStatus: 1 readonly property int currentUserStatus: 1
readonly property string defaultDisplayName: "myDefaultDisplayName" readonly property string preferredDisplayName: "myPreferredDisplayName"
readonly property string thumbnailImage: "myThumbnailImage" readonly property string thumbnailImage: "myThumbnailImage"
readonly property string largeImage: "myLargeImage" readonly property string largeImage: "myLargeImage"
readonly property string bio: "myBio" readonly property string bio: "myBio"
@ -149,13 +147,11 @@ Item {
compare(contactDetails.isUntrustworthy, false, "Expected the isUntrustworthy flag to be set") compare(contactDetails.isUntrustworthy, false, "Expected the isUntrustworthy flag to be set")
compare(contactDetails.isBlocked, false, "Expected the isBlocked flag to be set") compare(contactDetails.isBlocked, false, "Expected the isBlocked flag to be set")
compare(contactDetails.contactRequestState, 3, "Expected the contactRequestState flag to be set") compare(contactDetails.contactRequestState, 3, "Expected the contactRequestState flag to be set")
compare(contactDetails.defaultDisplayName, "defaultDisplayName", "Expected the defaultDisplayName to be set") compare(contactDetails.preferredDisplayName, "preferredDisplayName", "Expected the preferredDisplayName to be set")
compare(contactDetails.optionalName, "optionalName", "Expected the optionalName to be set")
compare(contactDetails.lastUpdated, 1234567890, "Expected the lastUpdated to be set") compare(contactDetails.lastUpdated, 1234567890, "Expected the lastUpdated to be set")
compare(contactDetails.lastUpdatedLocally, 1234567890, "Expected the lastUpdatedLocally to be set") compare(contactDetails.lastUpdatedLocally, 1234567890, "Expected the lastUpdatedLocally to be set")
compare(contactDetails.isContactRequestReceived, false, "Expected the isContactRequestReceived flag to be set") compare(contactDetails.isContactRequestReceived, false, "Expected the isContactRequestReceived flag to be set")
compare(contactDetails.isContactRequestSent, false, "Expected the isContactRequestSent flag to be set") compare(contactDetails.isContactRequestSent, false, "Expected the isContactRequestSent flag to be set")
compare(contactDetails.isSyncing, false, "Expected the isSyncing to be set")
compare(contactDetails.removed, false, "Expected the removed flag to be set") compare(contactDetails.removed, false, "Expected the removed flag to be set")
compare(contactDetails.trustStatus, 1, "Expected the trustStatus flag to be set") compare(contactDetails.trustStatus, 1, "Expected the trustStatus flag to be set")
} }
@ -256,15 +252,13 @@ Item {
isUntrustworthy: true, isUntrustworthy: true,
isBlocked: true, isBlocked: true,
contactRequest: 2, contactRequest: 2,
defaultDisplayName: "newDefaultDisplayName", preferredDisplayName: "newPreferredDisplayName",
optionalName: "newOptionalName",
lastUpdated: 1234567891, lastUpdated: 1234567891,
lastUpdatedLocally: 1234567891, lastUpdatedLocally: 1234567891,
thumbnailImage: "newThumbnailImage", thumbnailImage: "newThumbnailImage",
largeImage: "newLargeImage", largeImage: "newLargeImage",
isContactRequestReceived: true, isContactRequestReceived: true,
isContactRequestSent: true, isContactRequestSent: true,
isSyncing: true,
isRemoved: true, isRemoved: true,
trustStatus: 2, trustStatus: 2,
bio: "newBio" bio: "newBio"
@ -289,13 +283,11 @@ Item {
compare(contactDetails.isUntrustworthy, true, "Expected the isUntrustworthy flag to be set") compare(contactDetails.isUntrustworthy, true, "Expected the isUntrustworthy flag to be set")
compare(contactDetails.isBlocked, true, "Expected the isBlocked flag to be set") compare(contactDetails.isBlocked, true, "Expected the isBlocked flag to be set")
compare(contactDetails.contactRequestState, 2, "Expected the contactRequestState flag to be set") compare(contactDetails.contactRequestState, 2, "Expected the contactRequestState flag to be set")
compare(contactDetails.defaultDisplayName, "newDefaultDisplayName", "Expected the defaultDisplayName to be set") compare(contactDetails.preferredDisplayName, "newPreferredDisplayName", "Expected the preferredDisplayName to be set")
compare(contactDetails.optionalName, "newOptionalName", "Expected the optionalName to be set")
compare(contactDetails.lastUpdated, 1234567891, "Expected the lastUpdated to be set") compare(contactDetails.lastUpdated, 1234567891, "Expected the lastUpdated to be set")
compare(contactDetails.lastUpdatedLocally, 1234567891, "Expected the lastUpdatedLocally to be set") compare(contactDetails.lastUpdatedLocally, 1234567891, "Expected the lastUpdatedLocally to be set")
compare(contactDetails.isContactRequestReceived, true, "Expected the isContactRequestReceived flag to be set") compare(contactDetails.isContactRequestReceived, true, "Expected the isContactRequestReceived flag to be set")
compare(contactDetails.isContactRequestSent, true, "Expected the isContactRequestSent flag to be set") compare(contactDetails.isContactRequestSent, true, "Expected the isContactRequestSent flag to be set")
compare(contactDetails.isSyncing, true, "Expected the isSyncing to be set")
compare(contactDetails.removed, true, "Expected the removed flag to be set") compare(contactDetails.removed, true, "Expected the removed flag to be set")
compare(contactDetails.trustStatus, 2, "Expected the trustStatus flag to be set") compare(contactDetails.trustStatus, 2, "Expected the trustStatus flag to be set")
} }
@ -325,4 +317,4 @@ Item {
compare(contactDetails.localNickname, "localNickname", "Expected the local nickname to be set") compare(contactDetails.localNickname, "localNickname", "Expected the local nickname to be set")
} }
} }
} }

View File

@ -32,15 +32,13 @@ QObject {
readonly property bool isUntrustworthy: d.contactDetails.isUntrustworthy ?? false readonly property bool isUntrustworthy: d.contactDetails.isUntrustworthy ?? false
readonly property bool isBlocked: d.contactDetails.isBlocked ?? false readonly property bool isBlocked: d.contactDetails.isBlocked ?? false
readonly property int contactRequestState: d.contactDetails.contactRequest ?? Constants.ContactRequestState.None readonly property int contactRequestState: d.contactDetails.contactRequest ?? Constants.ContactRequestState.None
readonly property string defaultDisplayName: d.contactDetails.defaultDisplayName ?? "" readonly property string preferredDisplayName: d.contactDetails.preferredDisplayName ?? ""
readonly property string optionalName: d.contactDetails.optionalName ?? ""
readonly property int lastUpdated: d.contactDetails.lastUpdated ?? 0 readonly property int lastUpdated: d.contactDetails.lastUpdated ?? 0
readonly property int lastUpdatedLocally: d.contactDetails.lastUpdatedLocally ?? 0 readonly property int lastUpdatedLocally: d.contactDetails.lastUpdatedLocally ?? 0
readonly property string thumbnailImage: d.contactDetails.thumbnailImage ?? "" readonly property string thumbnailImage: d.contactDetails.thumbnailImage ?? ""
readonly property string largeImage: d.contactDetails.largeImage ?? "" readonly property string largeImage: d.contactDetails.largeImage ?? ""
readonly property bool isContactRequestReceived: d.contactDetails.isContactRequestReceived ?? false readonly property bool isContactRequestReceived: d.contactDetails.isContactRequestReceived ?? false
readonly property bool isContactRequestSent: d.contactDetails.isContactRequestSent ?? false readonly property bool isContactRequestSent: d.contactDetails.isContactRequestSent ?? false
readonly property bool isSyncing: d.contactDetails.isSyncing ?? false
readonly property bool removed: d.contactDetails.isRemoved ?? false readonly property bool removed: d.contactDetails.isRemoved ?? false
readonly property int trustStatus: d.contactDetails.trustStatus ?? Constants.trustStatus.unknown readonly property int trustStatus: d.contactDetails.trustStatus ?? Constants.trustStatus.unknown
readonly property string bio: d.contactDetails.bio ?? "" readonly property string bio: d.contactDetails.bio ?? ""
@ -76,6 +74,8 @@ QObject {
readonly property string ensName: root.profileStore.name readonly property string ensName: root.profileStore.name
readonly property bool isEnsVerified: root.profileStore.name !== "" && Utils.isValidEns(root.profileStore.name) readonly property bool isEnsVerified: root.profileStore.name !== "" && Utils.isValidEns(root.profileStore.name)
readonly property string localNickname: "" readonly property string localNickname: ""
readonly property string preferredDisplayName: root.profileStore.preferredDisplayName
readonly property string name: preferredDisplayName
readonly property string alias: root.profileStore.username readonly property string alias: root.profileStore.username
readonly property string icon: root.profileStore.icon readonly property string icon: root.profileStore.icon
readonly property int colorId: root.profileStore.colorId readonly property int colorId: root.profileStore.colorId
@ -87,16 +87,12 @@ QObject {
readonly property bool isUntrustworthy: false readonly property bool isUntrustworthy: false
readonly property bool isBlocked: false readonly property bool isBlocked: false
readonly property int contactRequestState: Constants.ContactRequestState.None readonly property int contactRequestState: Constants.ContactRequestState.None
readonly property string defaultDisplayName: root.profileStore.defaultDisplayName
readonly property string optionalName: defaultDisplayName
readonly property string name: defaultDisplayName
readonly property int lastUpdated: 0 readonly property int lastUpdated: 0
readonly property int lastUpdatedLocally: 0 readonly property int lastUpdatedLocally: 0
readonly property string thumbnailImage: root.profileStore.thumbnailImage readonly property string thumbnailImage: root.profileStore.thumbnailImage
readonly property string largeImage: root.profileStore.largeImage readonly property string largeImage: root.profileStore.largeImage
readonly property bool isContactRequestReceived: Constants.ContactRequestState.None readonly property bool isContactRequestReceived: Constants.ContactRequestState.None
readonly property bool isContactRequestSent: Constants.ContactRequestState.None readonly property bool isContactRequestSent: Constants.ContactRequestState.None
readonly property bool isSyncing: false
readonly property bool removed: false readonly property bool removed: false
readonly property int trustStatus: Constants.trustStatus.unknown readonly property int trustStatus: Constants.trustStatus.unknown
readonly property string bio: root.profileStore.bio readonly property string bio: root.profileStore.bio

View File

@ -24,9 +24,7 @@ QtObject {
readonly property var thumbnailImage: userProfile.thumbnailImage readonly property var thumbnailImage: userProfile.thumbnailImage
readonly property var largeImage: userProfile.largeImage readonly property var largeImage: userProfile.largeImage
readonly property int colorId: Utils.colorIdForPubkey(root.pubkey) readonly property int colorId: Utils.colorIdForPubkey(root.pubkey)
readonly property var colorHash: Utils.getColorHashAsJson(root.pubkey) readonly property var colorHash: Utils.getColorHashAsJson(root.pubkey)
readonly property string defaultDisplayName: ProfileUtils.displayName("", name, displayName, username)
readonly property string bio: profileModule.bio readonly property string bio: profileModule.bio
readonly property string socialLinksJson: profileModule.socialLinksJson readonly property string socialLinksJson: profileModule.socialLinksJson

View File

@ -738,8 +738,6 @@ QtObject {
function getContactDetailsAsJson(publicKey, getVerificationRequest=true, getOnlineStatus=false, includeDetails=false) { function getContactDetailsAsJson(publicKey, getVerificationRequest=true, getOnlineStatus=false, includeDetails=false) {
const defaultValue = { const defaultValue = {
defaultDisplayName: "",
optionalName: "",
icon: "", icon: "",
isCurrentUser: "", isCurrentUser: "",
colorId: "", colorId: "",
@ -759,7 +757,6 @@ QtObject {
isBlocked: false, isBlocked: false,
isContactRequestReceived: false, isContactRequestReceived: false,
isContactRequestSent: false, isContactRequestSent: false,
isSyncing: false,
removed: false, removed: false,
trustStatus: Constants.trustStatus.unknown, trustStatus: Constants.trustStatus.unknown,
contactRequestState: Constants.ContactRequestState.None, contactRequestState: Constants.ContactRequestState.None,