Rewrote using option

pull/8349/head
ralgun 2021-03-11 00:29:42 +01:00
parent f6caada2aa
commit 1f09d31fd0
3 changed files with 10 additions and 8 deletions

View File

@ -185,7 +185,9 @@ object show {
standardFlash(),
st.section(cls := "team-show__desc")(
markdownLinksOrRichText(t.description),
if (info.mine) frag(br, markdownLinksOrRichText(t.descPrivate)) else "",
if (info.mine) t.descPrivate.map { desc =>
frag(br, markdownLinksOrRichText(desc))
},
t.location.map { loc =>
frag(br, trans.location(), ": ", richText(loc))
}

View File

@ -12,7 +12,7 @@ case class Team(
location: Option[String],
password: Option[String],
description: String,
descPrivate: String,
descPrivate: Option[String],
nbMembers: Int,
enabled: Boolean,
open: Boolean,
@ -83,7 +83,7 @@ object Team {
location: Option[String],
password: Option[String],
description: String,
descPrivate: String,
descPrivate: Option[String],
open: Boolean,
createdBy: User
): Team =

View File

@ -26,7 +26,7 @@ final private[team] class TeamForm(
"message" -> optional(cleanText(minLength = 30, maxLength = 2000))
.verifying("Request message required", msg => msg.isDefined || team.open)
val description = "description" -> cleanText(minLength = 30, maxLength = 4000)
val descPrivate = "descPrivate" -> cleanText(minLength = 0, maxLength = 4000)
val descPrivate = "descPrivate" -> optional(cleanText(minLength = 0, maxLength = 4000))
val request = "request" -> boolean
val gameId = "gameId" -> text
val move = "move" -> text
@ -118,7 +118,7 @@ private[team] case class TeamSetup(
location: Option[String],
password: Option[String],
description: String,
descPrivate: String,
descPrivate: Option[String],
request: Boolean,
gameId: String,
move: String
@ -131,7 +131,7 @@ private[team] case class TeamSetup(
name = name.trim,
location = location map (_.trim) filter (_.nonEmpty),
description = description.trim,
descPrivate = descPrivate.trim
descPrivate = descPrivate map (_.trim) filter (_.nonEmpty)
)
}
@ -139,7 +139,7 @@ private[team] case class TeamEdit(
location: Option[String],
password: Option[String],
description: String,
descPrivate: String,
descPrivate: Option[String],
request: Boolean,
chat: Team.ChatFor
) {
@ -150,7 +150,7 @@ private[team] case class TeamEdit(
copy(
location = location map (_.trim) filter (_.nonEmpty),
description = description.trim,
descPrivate = descPrivate.trim
descPrivate = descPrivate map (_.trim) filter (_.nonEmpty)
)
}