fix(@desktop/communities): enforce alphanumerical characters in community name, description, channel name
This commit is contained in:
parent
3c4d97248e
commit
44cc6bbf83
|
@ -26,6 +26,10 @@ StatusInput {
|
|||
minLength: 1
|
||||
errorMessage: Utils.getErrorMessage(root.errors,
|
||||
qsTr("community description"))
|
||||
},
|
||||
StatusRegularExpressionValidator {
|
||||
regularExpression: Constants.regularExpressions.alphanumericalExpanded
|
||||
errorMessage: Constants.errorMessages.alphanumericalExpandedRegExp
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -13,11 +13,16 @@ StatusInput {
|
|||
label: qsTr("Name your community")
|
||||
charLimit: 30
|
||||
placeholderText: qsTr("A catchy name")
|
||||
|
||||
validators: [
|
||||
StatusMinLengthValidator {
|
||||
minLength: 1
|
||||
errorMessage: Utils.getErrorMessage(root.errors,
|
||||
qsTr("community name"))
|
||||
},
|
||||
StatusRegularExpressionValidator {
|
||||
regularExpression: Constants.regularExpressions.alphanumericalExpanded
|
||||
errorMessage: Constants.errorMessages.alphanumericalExpandedRegExp
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -46,7 +46,8 @@ StatusScrollView {
|
|||
property size bottomReservedSpace: Qt.size(0, 0)
|
||||
property bool bottomReservedSpaceActive: false
|
||||
|
||||
readonly property bool saveChangesButtonEnabled: true
|
||||
readonly property bool saveChangesButtonEnabled: !((nameInput.input.dirty && !nameInput.valid) ||
|
||||
(descriptionTextInput.input.dirty && !descriptionTextInput.valid))
|
||||
|
||||
ColumnLayout {
|
||||
id: layout
|
||||
|
|
|
@ -135,6 +135,10 @@ StatusDialog {
|
|||
StatusMinLengthValidator {
|
||||
minLength: 1
|
||||
errorMessage: Utils.getErrorMessage(nameInput.errors, qsTr("channel name"))
|
||||
},
|
||||
StatusRegularExpressionValidator {
|
||||
regularExpression: Constants.regularExpressions.alphanumericalExpanded
|
||||
errorMessage: Constants.errorMessages.alphanumericalExpandedRegExp
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ StatusScrollView {
|
|||
objectName: "communityColorPanelSelectColorButton"
|
||||
text: qsTr("Select Community Colour")
|
||||
onClicked: root.accepted()
|
||||
enabled: hexInput.valid
|
||||
}
|
||||
|
||||
property alias color: colorSpace.color
|
||||
|
|
|
@ -578,6 +578,14 @@ QtObject {
|
|||
readonly property int telegram: 6
|
||||
}
|
||||
|
||||
readonly property QtObject regularExpressions: QtObject {
|
||||
readonly property var alphanumericalExpanded: /^$|^[a-zA-Z0-9\-_ ]+$/
|
||||
}
|
||||
|
||||
readonly property QtObject errorMessages: QtObject {
|
||||
readonly property string alphanumericalExpandedRegExp: qsTr("Only letters, numbers, underscores, whitespaces and hyphens allowed")
|
||||
}
|
||||
|
||||
readonly property var socialLinkPrefixesByType: [ // NB order must match the "socialLinkType" enum above
|
||||
"",
|
||||
"https://twitter.com/",
|
||||
|
|
Loading…
Reference in New Issue