fix(@chat): channel/category name max length

fixes #5634
This commit is contained in:
Anthony Laibe 2022-05-09 10:40:27 +02:00 committed by Iuri Matias
parent 044fe38bda
commit a78fc0ded6
2 changed files with 9 additions and 7 deletions

View File

@ -23,7 +23,7 @@ StatusModal {
property bool isEdit: false property bool isEdit: false
readonly property int maxCategoryNameLength: 30 readonly property int maxCategoryNameLength: 24
readonly property var categoryNameValidator: Utils.Validate.NoEmpty readonly property var categoryNameValidator: Utils.Validate.NoEmpty
| Utils.Validate.TextLength | Utils.Validate.TextLength

View File

@ -26,7 +26,7 @@ StatusModal {
readonly property var communityColorValidator: Utils.Validate.NoEmpty readonly property var communityColorValidator: Utils.Validate.NoEmpty
| Utils.Validate.TextHexColor | Utils.Validate.TextHexColor
readonly property int maxChannelNameLength: 30 readonly property int maxChannelNameLength: 24
readonly property int maxChannelDescLength: 140 readonly property int maxChannelDescLength: 140
signal createCommunityChannel(string chName, string chDescription, string chEmoji, signal createCommunityChannel(string chName, string chDescription, string chEmoji,
@ -109,7 +109,7 @@ StatusModal {
id: nameInput id: nameInput
label: qsTr("Channel name") label: qsTr("Channel name")
charLimit: popup.maxChannelNameLength charLimit: popup.maxChannelNameLength
input.placeholderText: qsTr("Name the channel") input.placeholderText: qsTr("# Name the channel")
input.onTextChanged: { input.onTextChanged: {
input.text = Utils.convertSpacesToDashesAndUpperToLowerCase(input.text); input.text = Utils.convertSpacesToDashesAndUpperToLowerCase(input.text);
input.cursorPosition = input.text.length input.cursorPosition = input.text.length
@ -123,10 +123,12 @@ StatusModal {
popup.emojiPopup.y = popup.y + nameInput.height + 2*Style.current.xlPadding popup.emojiPopup.y = popup.y + nameInput.height + 2*Style.current.xlPadding
} }
validationMode: StatusInput.ValidationMode.Always validationMode: StatusInput.ValidationMode.Always
validators: [StatusMinLengthValidator { validators: [
StatusMinLengthValidator {
minLength: 1 minLength: 1
errorMessage: Utils.getErrorMessage(nameInput.errors, qsTr("channel name")) errorMessage: Utils.getErrorMessage(nameInput.errors, qsTr("channel name"))
}] }
]
} }
Item { Item {