disable TV chat for anons

pull/83/head
Thibault Duplessis 2013-08-02 18:55:27 +02:00
parent 7a26aca881
commit c10a5f96bf
4 changed files with 13 additions and 2 deletions

View File

@ -44,7 +44,7 @@ private[round] final class SocketHandler(
member.playerIdOption.fold[Handler.Controller]({
case ("p", o) o int "v" foreach { v socket ! PingVersion(uid, v) }
case ("talk", o) watcherTalk(ref.gameId, o)
case ("talk-tv", o) watcherTalk("tv", o)
case ("talk-tv", o) if (member.isAuth) watcherTalk("tv", o)
}) { playerId
{
case ("p", o) o int "v" foreach { v socket ! PingVersion(uid, v) }

View File

@ -10,6 +10,8 @@ trait SocketMember {
def liveGames: Set[String] = privateLiveGames.toSet
def addLiveGames(ids: List[String]) { ids foreach privateLiveGames.+= }
def isAuth = userId.isDefined
}
object SocketMember {

View File

@ -799,8 +799,10 @@ var storage = {
self.initSquaresAndPieces();
self.initTable();
self.initClocks();
if (self.$chat) self.$chat.chat({
if (self.$chat) {
self.$chat.chat({
talkMessageType: self.options.tv ? 'talk-tv' : 'talk',
secure: self.options.tv,
resize: true,
render: function(u, t) {
if (self.options.player.spectator) {
@ -813,6 +815,7 @@ var storage = {
lichess.socket.send("toggle-chat", enabled);
}, 5000)
});
}
self.$watchers.watchers();
if (self.isMyTurn() && self.options.game.turns == 0) {
self.element.one('lichess.audio_ready', function() {
@ -1499,6 +1502,7 @@ var storage = {
// render: function(u, t) {},
onToggle: function(enabled) {},
talkMessageType: 'talk',
secure: false,
resize: false
}, this.options);
var self = this;
@ -1520,6 +1524,10 @@ var storage = {
alert('Max length: 140 chars. ' + text.length + ' chars used.');
return false;
}
if (self.options.secure && !$('#user_tag').length) {
if (confirm($.trans('You need an account to do that'))) location.href = '/signup';
return false;
}
$input.val('');
lichess.socket.send(self.options.talkMessageType, text);
return false;

1
todo
View File

@ -57,6 +57,7 @@ realtime computer analysis of TV game
show user win stats on TV page
embeddable tv iframe http://en.lichess.org/forum/lichess-feedback/new-feature-lichess-tv?page=3
many tv ideas (answer) http://en.lichess.org/forum/lichess-feedback/new-feature-lichess-tv?page=3
disable tv chat for anon
DB
--