fix(DisplayNameValidation): Integrate duplicate display name in joined communities
This commit is contained in:
parent
2f7572a3f4
commit
4ca7e9b32d
|
@ -100,11 +100,6 @@ QtObject {
|
|||
return root.communitiesModuleInst.getCommunityPublicKeyFromPrivateKey(privateKey);
|
||||
}
|
||||
|
||||
// Returns true if the provided displayName occurs in community members
|
||||
function isDisplayNameDupeOfCommunityMember(displayName) {
|
||||
root.communitiesModuleInst.isDisplayNameDupeOfCommunityMember(displayName)
|
||||
}
|
||||
|
||||
function requestCommunityInfo(communityKey, shardCluster, shardIndex, importing = false) {
|
||||
const publicKey = Utils.isCompressedPubKey(communityKey)
|
||||
? Utils.changeCommunityKeyCompression(communityKey)
|
||||
|
|
|
@ -562,13 +562,12 @@ QtObject {
|
|||
name: "isAliasValidator"
|
||||
validate: function (t) { return !Utils.isAlias(t) }
|
||||
errorMessage: qsTr("Adjective-animal Display Name formats are not allowed")
|
||||
},
|
||||
StatusValidator {
|
||||
name: "isDuplicateInComunitiesValidator"
|
||||
validate: function(t) { return !Utils.isDisplayNameDupeOfCommunityMember(t) }
|
||||
errorMessage: qsTr("This Display Name is already in use in one of your joined communities")
|
||||
}
|
||||
// https://github.com/status-im/status-desktop/issues/13434
|
||||
// StatusValidator {
|
||||
// name: "isDuplicateInComunitiesValidator"
|
||||
// validate: function(t) { return !globalUtils.isDuplicatedInComunities(t) }
|
||||
// errorMessage: qsTr("This Display Name is already in use in one of your joined communities")
|
||||
// }
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
@ -962,4 +962,20 @@ QtObject {
|
|||
function addTimestampToURL(url) {
|
||||
return globalUtilsInst.addTimestampToURL(url)
|
||||
}
|
||||
|
||||
// Returns true if the provided displayName occurs in community members
|
||||
function isDisplayNameDupeOfCommunityMember(displayName) {
|
||||
if (!communitiesModuleInst)
|
||||
return false
|
||||
|
||||
if (displayName === "")
|
||||
return false
|
||||
|
||||
const myDisplayName = Global.userProfile ? Global.userProfile.name : ""
|
||||
|
||||
if (displayName === myDisplayName)
|
||||
return false
|
||||
|
||||
return communitiesModuleInst.isDisplayNameDupeOfCommunityMember(displayName)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue