fix ublog post submission

pull/9747/head
Thibault Duplessis 2021-09-07 09:30:03 +02:00
parent e0655398a7
commit 995983fe2a
1 changed files with 4 additions and 4 deletions

View File

@ -20,7 +20,7 @@ final class UblogForm(markup: UblogMarkup, val captcher: lila.hub.actors.Captche
"title" -> cleanNonEmptyText(minLength = 3, maxLength = 100),
"intro" -> cleanNonEmptyText(minLength = 0, maxLength = 2_000),
"markdown" -> cleanNonEmptyText(minLength = 0, maxLength = 100_000).verifying(markdownImage.constraint),
"language" -> stringIn(LangList.popularNoRegion.map(_.code).toSet),
"language" -> optional(stringIn(LangList.popularNoRegion.map(_.code).toSet)),
"live" -> boolean,
"gameId" -> text,
"move" -> text
@ -36,7 +36,7 @@ final class UblogForm(markup: UblogMarkup, val captcher: lila.hub.actors.Captche
title = post.title,
intro = post.intro,
markdown = post.markdown,
language = post.language.code,
language = post.language.code.some,
live = post.live,
gameId = "",
move = ""
@ -50,13 +50,13 @@ object UblogForm {
title: String,
intro: String,
markdown: String,
language: String,
language: Option[String],
live: Boolean,
gameId: String,
move: String
) {
def realLanguage = Lang.get(language)
def realLanguage = language flatMap Lang.get
def create(user: User) = {
val now = DateTime.now