fix(EditCommunityToken): prevent using already existing symbols
Closes #10784
This commit is contained in:
parent
a6494bfe33
commit
ce06fc3a99
|
@ -35,6 +35,11 @@ SplitView {
|
|||
allNetworks: enabledNetworks
|
||||
accounts: WalletAccountsModel {}
|
||||
tokensModel: MintedTokensModel {}
|
||||
tokensModelWallet: ListModel {
|
||||
ListElement {
|
||||
symbol: "MAI"
|
||||
}
|
||||
}
|
||||
onPreviewClicked: logs.logEvent("EditCommunityTokenView::previewClicked")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,11 @@ SplitView {
|
|||
enabledNetworks: NetworksModel.enabledNetworks
|
||||
allNetworks: enabledNetworks
|
||||
accounts: WalletAccountsModel {}
|
||||
|
||||
tokensModelWallet: ListModel {
|
||||
ListElement {
|
||||
symbol: "MAI"
|
||||
}
|
||||
}
|
||||
onMintCollectible: logs.logEvent("CommunityMintTokensSettingsPanel::mintCollectible")
|
||||
onMintAsset: logs.logEvent("CommunityMintTokensSettingsPanel::mintAssets")
|
||||
onDeleteToken: logs.logEvent("CommunityMintTokensSettingsPanel::deleteToken: " + tokenKey)
|
||||
|
|
|
@ -24,6 +24,7 @@ StackView {
|
|||
|
||||
// Models:
|
||||
property var tokensModel
|
||||
property var tokensModelWallet
|
||||
property var accounts // Expected roles: address, name, color, emoji, walletType
|
||||
|
||||
// Transaction related properties:
|
||||
|
@ -183,6 +184,7 @@ StackView {
|
|||
allNetworks: root.allNetworks
|
||||
accounts: root.accounts
|
||||
tokensModel: root.tokensModel
|
||||
tokensModelWallet: root.tokensModelWallet
|
||||
|
||||
referenceName: newTokenPage.referenceName
|
||||
referenceSymbol: newTokenPage.referenceSymbol
|
||||
|
|
|
@ -295,13 +295,13 @@ StatusSectionLayout {
|
|||
mintPanel.isFeeLoading = true
|
||||
return
|
||||
}
|
||||
|
||||
mintPanel.errorText = qsTr("Unknown error")
|
||||
mintPanel.isFeeLoading = true
|
||||
}
|
||||
|
||||
communityName: root.community.name
|
||||
tokensModel: root.community.communityTokens
|
||||
tokensModelWallet: root.rootStore.tokensModelWallet
|
||||
layer1Networks: communityTokensStore.layer1Networks
|
||||
layer2Networks: communityTokensStore.layer2Networks
|
||||
testNetworks: communityTokensStore.testNetworks
|
||||
|
|
|
@ -24,6 +24,7 @@ StatusScrollView {
|
|||
property bool isAssetView: false
|
||||
property int validationMode: StatusInput.ValidationMode.OnlyWhenDirty
|
||||
property var tokensModel
|
||||
property var tokensModelWallet
|
||||
|
||||
|
||||
property TokenObject collectible: TokenObject {
|
||||
|
@ -197,9 +198,11 @@ StatusScrollView {
|
|||
return true
|
||||
|
||||
// Otherwise, no repeated names allowed:
|
||||
return !SQUtils.ModelUtils.contains(root.tokensModel, "symbol", symbolInput.text)
|
||||
return (!SQUtils.ModelUtils.contains(root.tokensModel, "symbol", symbolInput.text) &&
|
||||
!SQUtils.ModelUtils.contains(root.tokensModelWallet, "symbol", symbolInput.text))
|
||||
}
|
||||
extraValidator.errorMessage: qsTr("You have used this token symbol before")
|
||||
extraValidator.errorMessage: SQUtils.ModelUtils.contains(root.tokensModelWallet, "symbol", symbolInput.text) ?
|
||||
qsTr("This token symbol is already in use") : qsTr("You have used this token symbol before")
|
||||
|
||||
onTextChanged: {
|
||||
const cursorPos = input.edit.cursorPosition
|
||||
|
@ -395,6 +398,9 @@ StatusScrollView {
|
|||
},
|
||||
StatusValidator {
|
||||
id: extraValidatorItem
|
||||
onErrorMessageChanged: {
|
||||
customInput.validate();
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -54,6 +54,7 @@ QtObject {
|
|||
property var accounts: walletSectionSendInst.accounts
|
||||
// Not Refactored Yet
|
||||
// property var profileModelInst: profileModel
|
||||
property var tokensModelWallet//TODO this is not available yet
|
||||
|
||||
property var contactStore: profileSectionStore.contactsStore
|
||||
property var privacyStore: profileSectionStore.privacyStore
|
||||
|
|
Loading…
Reference in New Issue