User.studyTv: if not found, redirect to routes.Study.byOwnerDefault

This commit is contained in:
ProgramFOX 2017-02-13 19:11:04 +01:00
parent f6bf1bc7f6
commit 872457a3d5

View file

@ -34,7 +34,7 @@ object User extends LilaController {
def studyTv(username: String) = Open { implicit ctx =>
OptionFuResult (UserRepo named username) { user =>
lila.relation.Env.current.onlineStudying.get(user.id) match {
case None => notFound
case None => fuccess(Redirect(routes.Study.byOwnerDefault(user.id)))
case Some(studyId) => fuccess(Redirect(routes.Study.show(studyId)))
}
}