-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backend-dependent content removed from Constants, userProfile removed…
… from Global Closes: #16459
- Loading branch information
Showing
12 changed files
with
91 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import QtQuick 2.15 | ||
|
||
import StatusQ.Controls.Validators 0.1 | ||
|
||
import AppLayouts.Communities.stores 1.0 | ||
import utils 1.0 | ||
|
||
QtObject { | ||
id: root | ||
|
||
/** | ||
* communitiesStore and myDisplayName are optional. When provided | ||
*/ | ||
property CommunitiesStore communitiesStore | ||
property string myDisplayName | ||
|
||
readonly property list<StatusValidator> validators: [ | ||
StatusValidator { | ||
name: "startsWithSpaceValidator" | ||
validate: t => !(t.startsWith(" ") || t.endsWith(" ")) | ||
errorMessage: qsTr("Display Names can’t start or end with a space") | ||
}, | ||
StatusRegularExpressionValidator { | ||
regularExpression: /^$|^[a-zA-Z0-9\-_\u0020]+$/ | ||
errorMessage: qsTr("Invalid characters (use A-Z and 0-9, hyphens and underscores only)") | ||
}, | ||
StatusMinLengthValidator { | ||
minLength: Constants.keypair.nameLengthMin | ||
errorMessage: qsTr("Display Names must be at least %n character(s) long", | ||
"", Constants.keypair.nameLengthMin) | ||
}, | ||
// TODO: Create `StatusMaxLengthValidator` in StatusQ | ||
StatusValidator { | ||
name: "maxLengthValidator" | ||
validate: t => t.length <= Constants.keypair.nameLengthMax | ||
errorMessage: qsTr("Display Names can’t be longer than %n character(s)", | ||
"", Constants.keypair.nameLengthMax) | ||
}, | ||
StatusValidator { | ||
name: "endsWith-ethValidator" | ||
validate: t => !(t.endsWith("-eth") || t.endsWith("_eth") || t.endsWith(".eth")) | ||
errorMessage: qsTr("Display Names can’t end in “.eth”, “_eth” or “-eth”") | ||
}, | ||
StatusValidator { | ||
name: "isAliasValidator" | ||
validate: function (t) { return !Utils.isAlias(t) } | ||
errorMessage: qsTr("Adjective-animal Display Name formats are not allowed") | ||
}, | ||
StatusValidator { | ||
name: "isDuplicateInComunitiesValidator" | ||
validate: displayName => { | ||
if (!root.communitiesStore || displayName === root.myDisplayName) | ||
return true | ||
|
||
return !communitiesStore.isDisplayNameDupeOfCommunityMember(displayName) | ||
} | ||
errorMessage: qsTr("This Display Name is already in use in one of your joined communities") | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DisplayNameValidators 1.0 DisplayNameValidators.qml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters