rename all DataForm
parent
a51f6b7f72
commit
0ba2c7cafd
|
@ -6,7 +6,7 @@ import scala.annotation.nowarn
|
|||
|
||||
import lila.api.Context
|
||||
import lila.app._
|
||||
import lila.security.DataForm.Reopen
|
||||
import lila.security.SecurityForm.Reopen
|
||||
import lila.user.{ User => UserModel, TotpSecret }
|
||||
import views.html
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ import scala.util.Try
|
|||
import lila.api.Context
|
||||
import lila.app._
|
||||
import lila.common.{ EmailAddress, HTTPRequest }
|
||||
import lila.security.DataForm.{ MagicLink, PasswordReset }
|
||||
import lila.security.SecurityForm.{ MagicLink, PasswordReset }
|
||||
import lila.security.{ FingerPrint, Signup }
|
||||
import lila.user.{ User => UserModel, PasswordHasher }
|
||||
import UserModel.ClearPassword
|
||||
|
|
|
@ -189,7 +189,7 @@ final class Challenge(
|
|||
if (isMine(c))
|
||||
Form(
|
||||
single(
|
||||
"username" -> lila.user.DataForm.historicalUsernameField
|
||||
"username" -> lila.user.UserForm.historicalUsernameField
|
||||
)
|
||||
).bindFromRequest()
|
||||
.fold(
|
||||
|
|
|
@ -168,7 +168,7 @@ final class Mod(
|
|||
def setTitle(username: String) =
|
||||
SecureBody(_.SetTitle) { implicit ctx => me =>
|
||||
implicit def req = ctx.body
|
||||
lila.user.DataForm.title
|
||||
lila.user.UserForm.title
|
||||
.bindFromRequest()
|
||||
.fold(
|
||||
_ => fuccess(redirect(username, mod = true)),
|
||||
|
|
|
@ -199,7 +199,7 @@ final class Plan(env: Env)(implicit system: akka.actor.ActorSystem) extends Lila
|
|||
def payPalIpn =
|
||||
Action.async { implicit req =>
|
||||
import lila.plan.Patron.PayPal
|
||||
lila.plan.DataForm.ipn
|
||||
lila.plan.PlanForm.ipn
|
||||
.bindFromRequest()
|
||||
.fold(
|
||||
err => {
|
||||
|
|
|
@ -9,7 +9,7 @@ import views._
|
|||
final class Pref(env: Env) extends LilaController(env) {
|
||||
|
||||
private def api = env.pref.api
|
||||
private def forms = lila.pref.DataForm
|
||||
private def forms = lila.pref.PrefForm
|
||||
|
||||
def apiGet =
|
||||
Scoped(_.Preference.Read) { _ => me =>
|
||||
|
@ -33,7 +33,7 @@ final class Pref(env: Env) extends LilaController(env) {
|
|||
|
||||
def formApply =
|
||||
AuthBody { implicit ctx => _ =>
|
||||
def onSuccess(data: lila.pref.DataForm.PrefData) = api.setPref(data(ctx.pref)) inject Ok("saved")
|
||||
def onSuccess(data: lila.pref.PrefForm.PrefData) = api.setPref(data(ctx.pref)) inject Ok("saved")
|
||||
implicit val req = ctx.body
|
||||
forms.pref
|
||||
.bindFromRequest()
|
||||
|
|
|
@ -266,7 +266,7 @@ final class Study(
|
|||
def createAs =
|
||||
AuthBody { implicit ctx => me =>
|
||||
implicit val req = ctx.body
|
||||
lila.study.DataForm.importGame.form
|
||||
lila.study.StudyForm.importGame.form
|
||||
.bindFromRequest()
|
||||
.fold(
|
||||
_ => Redirect(routes.Study.byOwnerDefault(me.username)).fuccess,
|
||||
|
@ -284,7 +284,7 @@ final class Study(
|
|||
def create =
|
||||
AuthBody { implicit ctx => me =>
|
||||
implicit val req = ctx.body
|
||||
lila.study.DataForm.importGame.form
|
||||
lila.study.StudyForm.importGame.form
|
||||
.bindFromRequest()
|
||||
.fold(
|
||||
_ => Redirect(routes.Study.byOwnerDefault(me.username)).fuccess,
|
||||
|
@ -292,7 +292,7 @@ final class Study(
|
|||
)
|
||||
}
|
||||
|
||||
private def createStudy(data: lila.study.DataForm.importGame.Data, me: lila.user.User)(implicit
|
||||
private def createStudy(data: lila.study.StudyForm.importGame.Data, me: lila.user.User)(implicit
|
||||
ctx: Context
|
||||
) =
|
||||
env.study.api.importGame(lila.study.StudyMaker.ImportGame(data), me) flatMap {
|
||||
|
@ -319,7 +319,7 @@ final class Study(
|
|||
AuthBody { implicit ctx => me =>
|
||||
implicit val req = ctx.body
|
||||
get("sri") ?? { sri =>
|
||||
lila.study.DataForm.importPgn.form
|
||||
lila.study.StudyForm.importPgn.form
|
||||
.bindFromRequest()
|
||||
.fold(
|
||||
jsonFormError,
|
||||
|
@ -507,7 +507,7 @@ final class Study(
|
|||
env.study.topicApi.popular(50) zip
|
||||
ctx.me.??(u => env.study.topicApi.userTopics(u.id) dmap some) map {
|
||||
case (popular, mine) =>
|
||||
val form = mine map lila.study.DataForm.topicsForm
|
||||
val form = mine map lila.study.StudyForm.topicsForm
|
||||
Ok(html.study.topic.index(popular, mine, form))
|
||||
}
|
||||
}
|
||||
|
@ -515,7 +515,7 @@ final class Study(
|
|||
def setTopics =
|
||||
AuthBody { implicit ctx => me =>
|
||||
implicit val req = ctx.body
|
||||
lila.study.DataForm.topicsForm
|
||||
lila.study.StudyForm.topicsForm
|
||||
.bindFromRequest()
|
||||
.fold(
|
||||
_ => Redirect(routes.Study.topics()).fuccess,
|
||||
|
|
|
@ -13,7 +13,7 @@ object create {
|
|||
submitButton(name := "as", value := s.id.value, cls := "submit button")(s.name.value)
|
||||
|
||||
def apply(
|
||||
data: lila.study.DataForm.importGame.Data,
|
||||
data: lila.study.StudyForm.importGame.Data,
|
||||
owner: List[Study.IdName],
|
||||
contrib: List[Study.IdName]
|
||||
)(implicit ctx: Context) =
|
||||
|
|
|
@ -5,7 +5,7 @@ import play.api.data.Form
|
|||
import controllers.routes
|
||||
import lila.api.Context
|
||||
import lila.app.templating.Environment._
|
||||
import lila.tournament.{ DataForm => TourForm }
|
||||
import lila.tournament.TournamentForm
|
||||
import lila.swiss.{ Swiss, SwissForm }
|
||||
import lila.app.ui.ScalatagsTemplate._
|
||||
import lila.hub.LightTeam.TeamID
|
||||
|
@ -134,7 +134,7 @@ final private class SwissFields(form: Form[_])(implicit ctx: Context) {
|
|||
form3.select(_, SwissForm.clockLimitChoices)
|
||||
),
|
||||
form3.group(form("clock.increment"), trans.clockIncrement(), half = true)(
|
||||
form3.select(_, TourForm.clockIncrementChoices)
|
||||
form3.select(_, TournamentForm.clockIncrementChoices)
|
||||
)
|
||||
)
|
||||
def roundInterval =
|
||||
|
|
|
@ -8,7 +8,7 @@ import lila.app.templating.Environment._
|
|||
import lila.app.ui.ScalatagsTemplate._
|
||||
import lila.common.paginator.Paginator
|
||||
import lila.tournament.crud.CrudForm
|
||||
import lila.tournament.{ DataForm, Tournament }
|
||||
import lila.tournament.{ TournamentForm, Tournament }
|
||||
|
||||
import controllers.routes
|
||||
|
||||
|
@ -104,10 +104,10 @@ object crud {
|
|||
),
|
||||
form3.split(
|
||||
form3.group(form("clockTime"), raw("Clock time"), half = true)(
|
||||
form3.select(_, DataForm.clockTimeChoices)
|
||||
form3.select(_, TournamentForm.clockTimeChoices)
|
||||
),
|
||||
form3.group(form("clockIncrement"), raw("Clock increment"), half = true)(
|
||||
form3.select(_, DataForm.clockIncrementChoices)
|
||||
form3.select(_, TournamentForm.clockIncrementChoices)
|
||||
)
|
||||
),
|
||||
form3.split(
|
||||
|
|
|
@ -8,7 +8,7 @@ import lila.api.Context
|
|||
import lila.app.templating.Environment._
|
||||
import lila.app.ui.ScalatagsTemplate._
|
||||
import lila.hub.LeaderTeam
|
||||
import lila.tournament.{ Condition, DataForm, Tournament }
|
||||
import lila.tournament.{ Condition, TournamentForm, Tournament }
|
||||
|
||||
object form {
|
||||
|
||||
|
@ -73,7 +73,7 @@ object form {
|
|||
fields.startPosition,
|
||||
fields.clock,
|
||||
form3.split(
|
||||
if (DataForm.minutes contains tour.minutes) form3.split(fields.minutes)
|
||||
if (TournamentForm.minutes contains tour.minutes) form3.split(fields.minutes)
|
||||
else
|
||||
form3.group(form("minutes"), trans.duration(), half = true)(
|
||||
form3.input(_)(tpe := "number")
|
||||
|
@ -258,19 +258,19 @@ final private class TourFields(form: Form[_], tour: Option[Tournament])(implicit
|
|||
def clock =
|
||||
form3.split(
|
||||
form3.group(form("clockTime"), trans.clockInitialTime(), half = true)(
|
||||
form3.select(_, DataForm.clockTimeChoices, disabled = disabledAfterStart)
|
||||
form3.select(_, TournamentForm.clockTimeChoices, disabled = disabledAfterStart)
|
||||
),
|
||||
form3.group(form("clockIncrement"), trans.clockIncrement(), half = true)(
|
||||
form3.select(_, DataForm.clockIncrementChoices, disabled = disabledAfterStart)
|
||||
form3.select(_, TournamentForm.clockIncrementChoices, disabled = disabledAfterStart)
|
||||
)
|
||||
)
|
||||
def minutes =
|
||||
form3.group(form("minutes"), trans.duration(), half = true)(
|
||||
form3.select(_, DataForm.minuteChoices)
|
||||
form3.select(_, TournamentForm.minuteChoices)
|
||||
)
|
||||
def waitMinutes =
|
||||
form3.group(form("waitMinutes"), trans.timeBeforeTournamentStarts(), half = true)(
|
||||
form3.select(_, DataForm.waitMinuteChoices)
|
||||
form3.select(_, TournamentForm.waitMinuteChoices)
|
||||
)
|
||||
def description =
|
||||
form3.group(
|
||||
|
|
|
@ -156,7 +156,7 @@ object mod {
|
|||
isGranted(_.SetTitle) option {
|
||||
postForm(cls := "fide_title", action := routes.Mod.setTitle(u.username))(
|
||||
form3.select(
|
||||
lila.user.DataForm.title.fill(u.title.map(_.value))("title"),
|
||||
lila.user.UserForm.title.fill(u.title.map(_.value))("title"),
|
||||
lila.user.Title.acronyms.map(t => t -> t),
|
||||
"".some
|
||||
)
|
||||
|
|
|
@ -9,7 +9,7 @@ import lila.user.User
|
|||
|
||||
final class ClasForm(
|
||||
lightUserAsync: lila.common.LightUser.Getter,
|
||||
securityForms: lila.security.DataForm,
|
||||
securityForms: lila.security.SecurityForm,
|
||||
nameGenerator: NameGenerator
|
||||
)(implicit ec: scala.concurrent.ExecutionContext) {
|
||||
|
||||
|
@ -69,7 +69,7 @@ final class ClasForm(
|
|||
def invite(c: Clas) =
|
||||
Form(
|
||||
mapping(
|
||||
"username" -> lila.user.DataForm.historicalUsernameField
|
||||
"username" -> lila.user.UserForm.historicalUsernameField
|
||||
.verifying("Unknown username", { blockingFetchUser(_).isDefined })
|
||||
.verifying("This is a teacher", u => !c.teachers.toList.contains(u.toLowerCase)),
|
||||
"realName" -> clean(nonEmptyText)
|
||||
|
|
|
@ -13,7 +13,7 @@ final class Env(
|
|||
puzzleRoundRepo: lila.puzzle.RoundRepo,
|
||||
msgApi: lila.msg.MsgApi,
|
||||
lightUserAsync: lila.common.LightUser.Getter,
|
||||
securityForms: lila.security.DataForm,
|
||||
securityForms: lila.security.SecurityForm,
|
||||
authenticator: lila.user.Authenticator,
|
||||
cacheApi: lila.memo.CacheApi,
|
||||
baseUrl: BaseUrl
|
||||
|
|
|
@ -3,7 +3,7 @@ package lila.coordinate
|
|||
import play.api.data._
|
||||
import play.api.data.Forms._
|
||||
|
||||
object DataForm {
|
||||
object CoordinateForm {
|
||||
|
||||
val color = Form(
|
||||
single(
|
|
@ -14,5 +14,5 @@ final class Env(
|
|||
|
||||
lazy val api = wire[CoordinateApi]
|
||||
|
||||
lazy val forms = DataForm
|
||||
lazy val forms = CoordinateForm
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ object EventForm {
|
|||
"startsAt" -> utcDate,
|
||||
"finishesAt" -> utcDate,
|
||||
"hostedBy" -> optional {
|
||||
lila.user.DataForm.historicalUsernameField
|
||||
lila.user.UserForm.historicalUsernameField
|
||||
.transform[User.ID](_.toLowerCase, identity)
|
||||
}
|
||||
)(Data.apply)(Data.unapply)
|
||||
|
|
|
@ -61,7 +61,7 @@ final class Env(
|
|||
}
|
||||
|
||||
lazy val mentionNotifier: MentionNotifier = wire[MentionNotifier]
|
||||
lazy val forms = wire[DataForm]
|
||||
lazy val forms = wire[ForumForm]
|
||||
lazy val recent = wire[Recent]
|
||||
|
||||
lila.common.Bus.subscribeFun("team", "gdprErase") {
|
||||
|
|
|
@ -5,13 +5,13 @@ import play.api.data._
|
|||
import play.api.data.Forms._
|
||||
import lila.user.User
|
||||
|
||||
final private[forum] class DataForm(
|
||||
final private[forum] class ForumForm(
|
||||
promotion: lila.security.PromotionApi,
|
||||
val captcher: lila.hub.actors.Captcher
|
||||
)(implicit ec: scala.concurrent.ExecutionContext)
|
||||
extends lila.hub.CaptchedForm {
|
||||
|
||||
import DataForm._
|
||||
import ForumForm._
|
||||
|
||||
def postMapping(user: User) =
|
||||
mapping(
|
||||
|
@ -49,7 +49,7 @@ final private[forum] class DataForm(
|
|||
)
|
||||
}
|
||||
|
||||
object DataForm {
|
||||
object ForumForm {
|
||||
|
||||
case class PostData(
|
||||
text: String,
|
|
@ -31,7 +31,7 @@ final class PostApi(
|
|||
def makePost(
|
||||
categ: Categ,
|
||||
topic: Topic,
|
||||
data: DataForm.PostData,
|
||||
data: ForumForm.PostData,
|
||||
me: User
|
||||
): Fu[Post] =
|
||||
lastNumberOf(topic) flatMap { number =>
|
||||
|
|
|
@ -48,7 +48,7 @@ final private[forum] class TopicApi(
|
|||
|
||||
def makeTopic(
|
||||
categ: Categ,
|
||||
data: DataForm.TopicData,
|
||||
data: ForumForm.TopicData,
|
||||
me: User
|
||||
): Fu[Topic] =
|
||||
env.topicRepo.nextSlug(categ, data.name) zip detectLanguage(data.post.text) flatMap {
|
||||
|
|
|
@ -34,7 +34,7 @@ final class Env(
|
|||
|
||||
lazy val paginator = wire[PaginatorBuilder[lila.game.Game, Query]]
|
||||
|
||||
lazy val forms = wire[DataForm]
|
||||
lazy val forms = wire[GameSearchForm]
|
||||
|
||||
lazy val userGameSearch = wire[UserGameSearch]
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import play.api.data.Forms._
|
|||
import lila.common.Form._
|
||||
import lila.search.Range
|
||||
|
||||
final private[gameSearch] class DataForm {
|
||||
final private[gameSearch] class GameSearchForm {
|
||||
|
||||
val search = Form(
|
||||
mapping(
|
||||
|
@ -39,8 +39,8 @@ final private[gameSearch] class DataForm {
|
|||
"incMin" -> optional(numberIn(Query.clockIncs)),
|
||||
"incMax" -> optional(numberIn(Query.clockIncs))
|
||||
)(SearchClock.apply)(SearchClock.unapply),
|
||||
"dateMin" -> DataForm.dateField,
|
||||
"dateMax" -> DataForm.dateField,
|
||||
"dateMin" -> GameSearchForm.dateField,
|
||||
"dateMax" -> GameSearchForm.dateField,
|
||||
"status" -> optional(numberIn(Query.statuses)),
|
||||
"analysed" -> optional(number),
|
||||
"sort" -> optional(
|
||||
|
@ -53,7 +53,7 @@ final private[gameSearch] class DataForm {
|
|||
) fill SearchData()
|
||||
}
|
||||
|
||||
private[gameSearch] object DataForm {
|
||||
private[gameSearch] object GameSearchForm {
|
||||
val dateField = optional(ISODateOrTimestamp.isoDateOrTimestamp)
|
||||
}
|
||||
|
|
@ -4,7 +4,7 @@ import lila.game.Game
|
|||
import play.api.mvc.Request
|
||||
|
||||
final class UserGameSearch(
|
||||
forms: DataForm,
|
||||
forms: GameSearchForm,
|
||||
paginator: lila.search.PaginatorBuilder[Game, Query]
|
||||
) {
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import com.softwaremill.macwire._
|
|||
@Module
|
||||
final class Env(gameRepo: lila.game.GameRepo)(implicit ec: scala.concurrent.ExecutionContext) {
|
||||
|
||||
lazy val forms = wire[DataForm]
|
||||
lazy val forms = wire[ImporterForm]
|
||||
|
||||
lazy val importer = wire[Importer]
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import scala.util.chaining._
|
|||
|
||||
import lila.game._
|
||||
|
||||
final class DataForm {
|
||||
final class ImporterForm {
|
||||
|
||||
lazy val importForm = Form(
|
||||
mapping(
|
|
@ -65,7 +65,7 @@ final class MsgCompat(
|
|||
def create(me: User)(implicit req: play.api.mvc.Request[_]): Either[Form[_], Fu[User.ID]] =
|
||||
Form(
|
||||
mapping(
|
||||
"username" -> lila.user.DataForm.historicalUsernameField
|
||||
"username" -> lila.user.UserForm.historicalUsernameField
|
||||
.verifying("Unknown username", { blockingFetchUser(_).isDefined })
|
||||
.verifying(
|
||||
"Sorry, this player doesn't accept new messages",
|
||||
|
|
|
@ -4,7 +4,7 @@ import cats.implicits._
|
|||
import play.api.data._
|
||||
import play.api.data.Forms._
|
||||
|
||||
object DataForm {
|
||||
object PlanForm {
|
||||
|
||||
private val txnTypes = Set("express_checkout", "web_accept", "recurring_payment", "subscr_payment")
|
||||
// ignored types = subscr_cancel, ...
|
|
@ -3,7 +3,7 @@ package lila.pref
|
|||
import play.api.data._
|
||||
import play.api.data.Forms._
|
||||
|
||||
object DataForm {
|
||||
object PrefForm {
|
||||
|
||||
private def containedIn(choices: Seq[(Int, String)]): Int => Boolean =
|
||||
choice => choices.exists(_._1 == choice)
|
|
@ -84,7 +84,7 @@ final class Env(
|
|||
currentPuzzleId = api.head.currentPuzzleId
|
||||
)
|
||||
|
||||
lazy val forms = DataForm
|
||||
lazy val forms = PuzzleForm
|
||||
|
||||
lazy val daily = new Daily(
|
||||
puzzleColl,
|
||||
|
|
|
@ -3,7 +3,7 @@ package lila.puzzle
|
|||
import play.api.data._
|
||||
import play.api.data.Forms._
|
||||
|
||||
object DataForm {
|
||||
object PuzzleForm {
|
||||
|
||||
val round = Form(
|
||||
single(
|
|
@ -60,7 +60,7 @@ final class Env(
|
|||
slack = slackScoreThresholdSetting.get _
|
||||
)
|
||||
|
||||
lazy val forms = wire[DataForm]
|
||||
lazy val forms = wire[ReportForm]
|
||||
|
||||
private lazy val autoAnalysis = wire[AutoAnalysis]
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import scala.concurrent.duration._
|
|||
import lila.common.LightUser
|
||||
import lila.user.User
|
||||
|
||||
final private[report] class DataForm(
|
||||
final private[report] class ReportForm(
|
||||
lightUserAsync: LightUser.Getter,
|
||||
val captcher: lila.hub.actors.Captcher,
|
||||
domain: lila.common.config.NetDomain
|
||||
|
@ -23,7 +23,7 @@ final private[report] class DataForm(
|
|||
|
||||
val create = Form(
|
||||
mapping(
|
||||
"username" -> lila.user.DataForm.historicalUsernameField.verifying(
|
||||
"username" -> lila.user.UserForm.historicalUsernameField.verifying(
|
||||
"Unknown username", {
|
||||
blockingFetchUser(_).isDefined
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ final private[report] class DataForm(
|
|||
|
||||
val flag = Form(
|
||||
mapping(
|
||||
"username" -> lila.user.DataForm.historicalUsernameField,
|
||||
"username" -> lila.user.UserForm.historicalUsernameField,
|
||||
"resource" -> nonEmptyText,
|
||||
"text" -> text(minLength = 3, maxLength = 140)
|
||||
)(ReportFlag.apply)(ReportFlag.unapply)
|
|
@ -52,7 +52,7 @@ final class Env(
|
|||
if (config.recaptcha.enabled) wire[RecaptchaGoogle]
|
||||
else RecaptchaSkip
|
||||
|
||||
lazy val forms = wire[DataForm]
|
||||
lazy val forms = wire[SecurityForm]
|
||||
|
||||
lazy val geoIP: GeoIP = wire[GeoIP]
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ import lila.common.{ EmailAddress, LameName, Form => LilaForm }
|
|||
import lila.user.{ TotpSecret, User, UserRepo }
|
||||
import User.{ ClearPassword, TotpToken }
|
||||
|
||||
final class DataForm(
|
||||
final class SecurityForm(
|
||||
userRepo: UserRepo,
|
||||
authenticator: lila.user.Authenticator,
|
||||
emailValidator: EmailAddressValidator,
|
||||
|
@ -17,7 +17,7 @@ final class DataForm(
|
|||
recaptchaPublicConfig: RecaptchaPublicConfig
|
||||
)(implicit ec: scala.concurrent.ExecutionContext) {
|
||||
|
||||
import DataForm._
|
||||
import SecurityForm._
|
||||
|
||||
private val recaptchaField = "g-recaptcha-response" -> optional(nonEmptyText)
|
||||
|
||||
|
@ -232,7 +232,7 @@ final class DataForm(
|
|||
text.verifying("incorrectPassword", p => candidate.check(ClearPassword(p)))
|
||||
}
|
||||
|
||||
object DataForm {
|
||||
object SecurityForm {
|
||||
|
||||
case class AgreementData(
|
||||
assistance: Boolean,
|
|
@ -15,7 +15,7 @@ final class Signup(
|
|||
store: Store,
|
||||
api: SecurityApi,
|
||||
ipTrust: IpTrust,
|
||||
forms: DataForm,
|
||||
forms: SecurityForm,
|
||||
emailAddressValidator: EmailAddressValidator,
|
||||
emailConfirm: EmailConfirm,
|
||||
recaptcha: Recaptcha,
|
||||
|
|
|
@ -104,14 +104,14 @@ final class StudyApi(
|
|||
|
||||
def importGame(data: StudyMaker.ImportGame, user: User): Fu[Option[Study.WithChapter]] =
|
||||
(data.form.as match {
|
||||
case DataForm.importGame.AsNewStudy =>
|
||||
case StudyForm.importGame.AsNewStudy =>
|
||||
studyMaker(data, user) flatMap { res =>
|
||||
studyRepo.insert(res.study) >>
|
||||
chapterRepo.insert(res.chapter) >>-
|
||||
indexStudy(res.study) >>-
|
||||
scheduleTimeline(res.study.id) inject res.some
|
||||
}
|
||||
case DataForm.importGame.AsChapterOf(studyId) =>
|
||||
case StudyForm.importGame.AsChapterOf(studyId) =>
|
||||
byId(studyId) flatMap {
|
||||
case Some(study) if study.canContribute(user.id) =>
|
||||
addChapter(
|
||||
|
|
|
@ -5,7 +5,7 @@ import play.api.data.Forms._
|
|||
|
||||
import lila.common.Form.clean
|
||||
|
||||
object DataForm {
|
||||
object StudyForm {
|
||||
|
||||
object importGame {
|
||||
|
|
@ -79,7 +79,7 @@ final private class StudyMaker(
|
|||
object StudyMaker {
|
||||
|
||||
case class ImportGame(
|
||||
form: DataForm.importGame.Data = DataForm.importGame.Data(),
|
||||
form: StudyForm.importGame.Data = StudyForm.importGame.Data(),
|
||||
id: Option[Study.Id] = None,
|
||||
name: Option[Study.Name] = None,
|
||||
settings: Option[Settings] = None,
|
||||
|
|
|
@ -31,7 +31,7 @@ final class Env(
|
|||
lazy val memberRepo = new MemberRepo(db(CollName("team_member")))
|
||||
lazy val requestRepo = new RequestRepo(db(CollName("team_request")))
|
||||
|
||||
lazy val forms = wire[DataForm]
|
||||
lazy val forms = wire[TeamForm]
|
||||
|
||||
lazy val memberStream = wire[TeamMemberStream]
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import scala.concurrent.duration._
|
|||
import lila.db.dsl._
|
||||
import lila.common.Form.{ clean, numberIn }
|
||||
|
||||
final private[team] class DataForm(
|
||||
final private[team] class TeamForm(
|
||||
teamRepo: TeamRepo,
|
||||
lightUserApi: lila.user.LightUserApi,
|
||||
val captcher: lila.hub.actors.Captcher
|
||||
|
@ -76,7 +76,7 @@ final private[team] class DataForm(
|
|||
|
||||
val selectMember = Form(
|
||||
single(
|
||||
"userId" -> lila.user.DataForm.historicalUsernameField
|
||||
"userId" -> lila.user.UserForm.historicalUsernameField
|
||||
)
|
||||
)
|
||||
|
|
@ -49,7 +49,7 @@ final class Env(
|
|||
|
||||
private def scheduler = system.scheduler
|
||||
|
||||
lazy val forms = wire[DataForm]
|
||||
lazy val forms = wire[TournamentForm]
|
||||
|
||||
lazy val tournamentRepo = new TournamentRepo(db(config.tournamentColl), config.playerColl)
|
||||
lazy val pairingRepo = new PairingRepo(db(config.pairingColl))
|
||||
|
|
|
@ -68,13 +68,13 @@ final class TournamentApi(
|
|||
name = setup.name,
|
||||
clock = setup.clockConfig,
|
||||
minutes = setup.minutes,
|
||||
waitMinutes = setup.waitMinutes | DataForm.waitMinuteDefault,
|
||||
waitMinutes = setup.waitMinutes | TournamentForm.waitMinuteDefault,
|
||||
startDate = setup.startDate,
|
||||
mode = setup.realMode,
|
||||
password = setup.password,
|
||||
variant = setup.realVariant,
|
||||
position =
|
||||
DataForm.startingPosition(setup.position | chess.StartingPosition.initial.fen, setup.realVariant),
|
||||
TournamentForm.startingPosition(setup.position | chess.StartingPosition.initial.fen, setup.realVariant),
|
||||
berserkable = setup.berserkable | true,
|
||||
streakable = setup.streakable | true,
|
||||
teamBattle = setup.teamBattleByTeam map TeamBattle.init,
|
||||
|
@ -114,7 +114,7 @@ final class TournamentApi(
|
|||
password = data.password,
|
||||
position =
|
||||
if (old.isCreated || !old.position.initial)
|
||||
DataForm.startingPosition(position | chess.StartingPosition.initial.fen, realVariant)
|
||||
TournamentForm.startingPosition(position | chess.StartingPosition.initial.fen, realVariant)
|
||||
else old.position,
|
||||
noBerserk = !(~berserkable),
|
||||
noStreak = !(~streakable),
|
||||
|
|
|
@ -13,9 +13,9 @@ import lila.hub.LeaderTeam
|
|||
import lila.hub.LightTeam._
|
||||
import lila.user.User
|
||||
|
||||
final class DataForm {
|
||||
final class TournamentForm {
|
||||
|
||||
import DataForm._
|
||||
import TournamentForm._
|
||||
|
||||
def create(user: User, leaderTeams: List[LeaderTeam], teamBattleId: Option[TeamID] = None) =
|
||||
form(user, leaderTeams) fill TournamentSetup(
|
||||
|
@ -104,7 +104,7 @@ final class DataForm {
|
|||
)
|
||||
}
|
||||
|
||||
object DataForm {
|
||||
object TournamentForm {
|
||||
|
||||
import chess.variant._
|
||||
|
||||
|
@ -172,7 +172,7 @@ private[tournament] case class TournamentSetup(
|
|||
|
||||
def realMode = Mode(rated.orElse(mode.map(Mode.Rated.id ==)) | true)
|
||||
|
||||
def realVariant = variant.flatMap(DataForm.guessVariant) | chess.variant.Standard
|
||||
def realVariant = variant.flatMap(TournamentForm.guessVariant) | chess.variant.Standard
|
||||
|
||||
def clockConfig = chess.Clock.Config((clockTime * 60).toInt, clockIncrement)
|
||||
|
|
@ -105,7 +105,7 @@ final class CrudApi(tournamentRepo: TournamentRepo) {
|
|||
iconFont = none,
|
||||
iconImg = image.some.filter(_.nonEmpty)
|
||||
).some,
|
||||
position = DataForm.startingPosition(data.position, realVariant),
|
||||
position = TournamentForm.startingPosition(data.position, realVariant),
|
||||
noBerserk = !data.berserkable,
|
||||
noStreak = !data.streakable,
|
||||
teamBattle = data.teamBattle option (tour.teamBattle | TeamBattle(Set.empty, 10)),
|
||||
|
|
|
@ -11,7 +11,7 @@ import lila.common.Form._
|
|||
|
||||
object CrudForm {
|
||||
|
||||
import DataForm._
|
||||
import TournamentForm._
|
||||
import lila.common.Form.UTCDate._
|
||||
|
||||
val maxHomepageHours = 72
|
||||
|
@ -24,7 +24,7 @@ object CrudForm {
|
|||
"clockIncrement" -> numberIn(clockIncrementChoices),
|
||||
"minutes" -> number(min = 20, max = 1440),
|
||||
"variant" -> number.verifying(Variant exists _),
|
||||
"position" -> text.verifying(DataForm.positions contains _),
|
||||
"position" -> text.verifying(TournamentForm.positions contains _),
|
||||
"date" -> utcDate,
|
||||
"image" -> stringIn(imageChoices),
|
||||
"headline" -> text(minLength = 5, maxLength = 30),
|
||||
|
|
|
@ -70,7 +70,7 @@ final class Env(
|
|||
|
||||
lazy val authenticator = wire[Authenticator]
|
||||
|
||||
lazy val forms = wire[DataForm]
|
||||
lazy val forms = wire[UserForm]
|
||||
|
||||
lila.common.Bus.subscribeFuns(
|
||||
"adjustCheater" -> {
|
||||
|
|
|
@ -7,7 +7,7 @@ import play.api.data.Forms._
|
|||
import User.ClearPassword
|
||||
import lila.common.Form.clean
|
||||
|
||||
final class DataForm(authenticator: Authenticator) {
|
||||
final class UserForm(authenticator: Authenticator) {
|
||||
|
||||
val note = Form(
|
||||
mapping(
|
||||
|
@ -69,7 +69,7 @@ final class DataForm(authenticator: Authenticator) {
|
|||
}
|
||||
}
|
||||
|
||||
object DataForm {
|
||||
object UserForm {
|
||||
|
||||
val title = Form(single("title" -> optional(nonEmptyText)))
|
||||
|
Loading…
Reference in New Issue