From bd6b758c4d9cbf256fe8f4ded14d63f0073f6cff Mon Sep 17 00:00:00 2001 From: Thibault Duplessis Date: Mon, 10 Jun 2013 12:34:30 +0200 Subject: [PATCH] show rated games to anon --- app/mashup/Preload.scala | 4 ++-- modules/i18n/src/main/JsDump.scala | 3 ++- modules/lobby/src/main/HookRepo.scala | 2 -- modules/lobby/src/main/Lobby.scala | 1 - modules/lobby/src/main/actorApi.scala | 1 - public/javascripts/big.js | 11 +++++++---- todo | 2 -- 7 files changed, 11 insertions(+), 13 deletions(-) diff --git a/app/mashup/Preload.scala b/app/mashup/Preload.scala index 6468c42845..2a097fec9b 100644 --- a/app/mashup/Preload.scala +++ b/app/mashup/Preload.scala @@ -9,7 +9,7 @@ import play.api.mvc.Call import controllers.routes import lila.forum.PostLiteView import lila.game.{ Game, GameRepo, Featured } -import lila.lobby.actorApi.{ GetOpen, GetOpenCasual } +import lila.lobby.actorApi.GetOpen import lila.lobby.{ Hook, HookRepo } import lila.setup.FilterConfig import lila.socket.History @@ -32,7 +32,7 @@ final class Preload( posts: Fu[List[PostLiteView]], tours: Fu[List[Created]], filter: Fu[FilterConfig])(implicit ctx: Context): Fu[Response] = - ctx.isAuth.fold(lobby ? GetOpen, lobby ? GetOpenCasual).mapTo[List[Hook]] zip + (lobby ? GetOpen).mapTo[List[Hook]] zip recentGames() zip posts zip tours zip diff --git a/modules/i18n/src/main/JsDump.scala b/modules/i18n/src/main/JsDump.scala index ede19a5899..18f8deee0d 100644 --- a/modules/i18n/src/main/JsDump.scala +++ b/modules/i18n/src/main/JsDump.scala @@ -41,7 +41,8 @@ private[i18n] case class JsDump( keys.waitingForOpponent, keys.accept, keys.decline, - keys.challengeToPlay) + keys.challengeToPlay, + keys.youNeedAnAccountToDoThat) private val pathFile = new File(path) diff --git a/modules/lobby/src/main/HookRepo.scala b/modules/lobby/src/main/HookRepo.scala index 3e11cbefa4..7d1f1f6ef6 100644 --- a/modules/lobby/src/main/HookRepo.scala +++ b/modules/lobby/src/main/HookRepo.scala @@ -17,8 +17,6 @@ object HookRepo { def allOpen: List[Hook] = list.filter(_.open) - def allOpenCasual = list.filter(h ⇒ h.open && h.mode == 0) - def openNotInUids(uids: Set[String]): List[Hook] = allOpen.filterNot(h ⇒ uids(h.uid)) def save(hook: Hook) { diff --git a/modules/lobby/src/main/Lobby.scala b/modules/lobby/src/main/Lobby.scala index b238f780f5..5a49df26d2 100644 --- a/modules/lobby/src/main/Lobby.scala +++ b/modules/lobby/src/main/Lobby.scala @@ -19,7 +19,6 @@ private[lobby] final class Lobby( def receive = { case GetOpen ⇒ sender ! HookRepo.allOpen - case GetOpenCasual ⇒ sender ! HookRepo.allOpenCasual case msg @ AddHook(hook) ⇒ { HookRepo byUid hook.uid foreach remove diff --git a/modules/lobby/src/main/actorApi.scala b/modules/lobby/src/main/actorApi.scala index 1b8bf8a6f5..34b9793829 100644 --- a/modules/lobby/src/main/actorApi.scala +++ b/modules/lobby/src/main/actorApi.scala @@ -28,4 +28,3 @@ case class JoinHook(uid: String, hook: Hook, game: Game) case class Join(uid: String, user: Option[User]) case object GetOpen -case object GetOpenCasual diff --git a/public/javascripts/big.js b/public/javascripts/big.js index 8b517ff599..3215af474e 100644 --- a/public/javascripts/big.js +++ b/public/javascripts/big.js @@ -2084,8 +2084,8 @@ var lichess_sri = Math.random().toString(36).substring(5); // 8 chars } function addHook(hook) { - if (!isRegistered && hook.mode == "Rated") return; - hook.action = hook.uid == lichess_sri ? "cancel" : "join"; + if (!isRegistered && hook.mode == "Rated") hook.action = 'register'; + else hook.action = hook.uid == lichess_sri ? "cancel" : "join"; if (hook.action == 'join' && hook.emin && (myElo < parseInt(hook.emin) || myElo > parseInt(hook.emax))) return; pool.push(hook); drawHooks(); @@ -2251,9 +2251,12 @@ var lichess_sri = Math.random().toString(36).substring(5); // 8 chars }); $canvas.on('click', '>span.plot:not(.hiding)', function() { var hook = $(this).data('hook'); + if (hook.action == 'register') { + if (confirm($.trans('This game is rated') + '.\n' + $.trans('You need an account to do that') + '.')) location.href = '/signup'; + else return; + } if (confirm960(hook)) { - if (hook.action == 'cancel') lichess.socket.send('cancel'); - else lichess.socket.send('join', hook.id); + lichess.socket.send(hook.action, hook.id); } }); $noHook.click(function() { diff --git a/todo b/todo index 9c34f9c168..4445d951b5 100644 --- a/todo +++ b/todo @@ -62,7 +62,6 @@ IE10 no sound toggle http://en.lichess.org/forum/lichess-feedback/notification-o filter current games for watching http://en.lichess.org/forum/lichess-feedback/viewing-current-games-suggestion#2 declined challenge still appears no time data http://en.lichess.org/x9tls3mh/stats -show rated games to anon second realtime board on homepage (right) show friend games in homepage board allow to filter anon @@ -70,7 +69,6 @@ add fast tooltips to plots replace plot with watch plot when game starts real rematch against AI lobby table sort -graph x labels inside colorpicker does nothing on homepage ---