simplify tournament controller

This commit is contained in:
Thibault Duplessis 2015-01-05 13:28:48 +01:00
parent f7d6d2ba98
commit a1ac30adf2

View file

@ -60,14 +60,12 @@ object Tournament extends LilaController {
implicit me =>
NoEngine {
negotiate(
html = OptionFuRedirect(repo enterableById id) { tour =>
if (tour.hasPassword) fuccess {
routes.Tournament.joinPassword(id)
}
else {
html = repo enterableById id map {
case None => tournamentNotFound
case Some(tour) if tour.hasPassword => Redirect(routes.Tournament.joinPassword(id))
case Some(tour) =>
env.api.join(tour, me, none)
fuccess(routes.Tournament.show(tour.id))
}
Redirect(routes.Tournament.show(tour.id))
},
api = _ => OptionFuOk(repo enterableById id) { tour =>
env.api.join(tour, me, none)