show rated games to anon

This commit is contained in:
Thibault Duplessis 2013-06-10 12:34:30 +02:00
parent 575f152fc2
commit bd6b758c4d
7 changed files with 11 additions and 13 deletions

View file

@ -9,7 +9,7 @@ import play.api.mvc.Call
import controllers.routes import controllers.routes
import lila.forum.PostLiteView import lila.forum.PostLiteView
import lila.game.{ Game, GameRepo, Featured } import lila.game.{ Game, GameRepo, Featured }
import lila.lobby.actorApi.{ GetOpen, GetOpenCasual } import lila.lobby.actorApi.GetOpen
import lila.lobby.{ Hook, HookRepo } import lila.lobby.{ Hook, HookRepo }
import lila.setup.FilterConfig import lila.setup.FilterConfig
import lila.socket.History import lila.socket.History
@ -32,7 +32,7 @@ final class Preload(
posts: Fu[List[PostLiteView]], posts: Fu[List[PostLiteView]],
tours: Fu[List[Created]], tours: Fu[List[Created]],
filter: Fu[FilterConfig])(implicit ctx: Context): Fu[Response] = 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 recentGames() zip
posts zip posts zip
tours zip tours zip

View file

@ -41,7 +41,8 @@ private[i18n] case class JsDump(
keys.waitingForOpponent, keys.waitingForOpponent,
keys.accept, keys.accept,
keys.decline, keys.decline,
keys.challengeToPlay) keys.challengeToPlay,
keys.youNeedAnAccountToDoThat)
private val pathFile = new File(path) private val pathFile = new File(path)

View file

@ -17,8 +17,6 @@ object HookRepo {
def allOpen: List[Hook] = list.filter(_.open) 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 openNotInUids(uids: Set[String]): List[Hook] = allOpen.filterNot(h uids(h.uid))
def save(hook: Hook) { def save(hook: Hook) {

View file

@ -19,7 +19,6 @@ private[lobby] final class Lobby(
def receive = { def receive = {
case GetOpen sender ! HookRepo.allOpen case GetOpen sender ! HookRepo.allOpen
case GetOpenCasual sender ! HookRepo.allOpenCasual
case msg @ AddHook(hook) { case msg @ AddHook(hook) {
HookRepo byUid hook.uid foreach remove HookRepo byUid hook.uid foreach remove

View file

@ -28,4 +28,3 @@ case class JoinHook(uid: String, hook: Hook, game: Game)
case class Join(uid: String, user: Option[User]) case class Join(uid: String, user: Option[User])
case object GetOpen case object GetOpen
case object GetOpenCasual

View file

@ -2084,8 +2084,8 @@ var lichess_sri = Math.random().toString(36).substring(5); // 8 chars
} }
function addHook(hook) { function addHook(hook) {
if (!isRegistered && hook.mode == "Rated") return; if (!isRegistered && hook.mode == "Rated") hook.action = 'register';
hook.action = hook.uid == lichess_sri ? "cancel" : "join"; else hook.action = hook.uid == lichess_sri ? "cancel" : "join";
if (hook.action == 'join' && hook.emin && (myElo < parseInt(hook.emin) || myElo > parseInt(hook.emax))) return; if (hook.action == 'join' && hook.emin && (myElo < parseInt(hook.emin) || myElo > parseInt(hook.emax))) return;
pool.push(hook); pool.push(hook);
drawHooks(); drawHooks();
@ -2251,9 +2251,12 @@ var lichess_sri = Math.random().toString(36).substring(5); // 8 chars
}); });
$canvas.on('click', '>span.plot:not(.hiding)', function() { $canvas.on('click', '>span.plot:not(.hiding)', function() {
var hook = $(this).data('hook'); 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 (confirm960(hook)) {
if (hook.action == 'cancel') lichess.socket.send('cancel'); lichess.socket.send(hook.action, hook.id);
else lichess.socket.send('join', hook.id);
} }
}); });
$noHook.click(function() { $noHook.click(function() {

2
todo
View file

@ -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 filter current games for watching http://en.lichess.org/forum/lichess-feedback/viewing-current-games-suggestion#2
declined challenge still appears declined challenge still appears
no time data http://en.lichess.org/x9tls3mh/stats no time data http://en.lichess.org/x9tls3mh/stats
show rated games to anon
second realtime board on homepage (right) second realtime board on homepage (right)
show friend games in homepage board show friend games in homepage board
allow to filter anon allow to filter anon
@ -70,7 +69,6 @@ add fast tooltips to plots
replace plot with watch plot when game starts replace plot with watch plot when game starts
real rematch against AI real rematch against AI
lobby table sort lobby table sort
graph x labels inside
colorpicker does nothing on homepage colorpicker does nothing on homepage
--- ---