Merge pull request #6428 from ornicar/fix-streamer-form
Update streamer form for Twitch URLs and names with 25 chars
This commit is contained in:
commit
f577e39ba8
|
@ -176,7 +176,7 @@ object edit extends Context.ToLang {
|
|||
form3.group(
|
||||
form("name"),
|
||||
streamerName(),
|
||||
help = keepItShort(20).some,
|
||||
help = keepItShort(25).some,
|
||||
half = true
|
||||
)(form3.input(_)),
|
||||
form3.checkbox(
|
||||
|
|
|
@ -80,8 +80,8 @@ object Streamer {
|
|||
def minUrl = s"twitch.tv/$userId"
|
||||
}
|
||||
object Twitch {
|
||||
private val UserIdRegex = """([\w-]{2,24}+)""".r
|
||||
private val UrlRegex = """twitch\.tv/([\w-]{2,24}+)""".r.unanchored
|
||||
private val UserIdRegex = """([\w-]{2,25}+)""".r
|
||||
private val UrlRegex = """twitch\.tv/([\w-]{2,25}+)""".r.unanchored
|
||||
// https://www.twitch.tv/chessnetwork
|
||||
def parseUserId(str: String): Option[String] = str match {
|
||||
case UserIdRegex(u) => u.some
|
||||
|
|
|
@ -20,7 +20,7 @@ object StreamerForm {
|
|||
text
|
||||
.verifying(
|
||||
Constraints.minLength(2),
|
||||
Constraints.maxLength(24)
|
||||
Constraints.maxLength(47)
|
||||
)
|
||||
.verifying("Invalid Twitch username", s => Streamer.Twitch.parseUserId(s).isDefined)
|
||||
),
|
||||
|
@ -111,6 +111,6 @@ object StreamerForm {
|
|||
implicit private val nameFormat = formatter.stringFormatter[Name](_.value, Name.apply)
|
||||
private def nameField = of[Name].verifying(
|
||||
constraint.minLength[Name](_.value)(3),
|
||||
constraint.maxLength[Name](_.value)(20)
|
||||
constraint.maxLength[Name](_.value)(25)
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue