Prevent duplicate challenge notifications

This commit is contained in:
urkerab
2015-11-02 10:41:39 +00:00
parent 24bc13d037
commit 900fe9b107

View File

@@ -384,14 +384,16 @@
if (this.info.isStarted && this.info.isJoined) {
// Update the challenges
if ('challenges' in this.updates) {
this.$challenge.toggleClass('active', this.info.challenges.length > 0);
if (this.info.challenges.length > 0) {
this.$challengeUser.text("vs. " + this.info.challenges[0]);
this.$challengeUserMenu.toggle(this.info.challenges.length > 1);
this.$challengeUserMenu.html(this.renderChallengeUsers());
this.toggleBoxVisibility(true);
this.room.notifyOnce("Tournament challenges available", "Room: " + this.room.title, 'tournament-challenges');
if (!this.$challenge.hasClass('active')) {
this.room.notifyOnce("Tournament challenges available", "Room: " + this.room.title, 'tournament-challenges');
}
}
this.$challenge.toggleClass('active', this.info.challenges.length > 0);
}
if ('challengeBys' in this.updates) {
@@ -408,12 +410,14 @@
}
if ('challenged' in this.updates) {
this.$challenged.toggleClass('active', !!this.info.challenged);
if (this.info.challenged) {
this.$challengedMessage.text("vs. " + this.info.challenged);
this.toggleBoxVisibility(true);
this.room.notifyOnce("Tournament challenge from " + this.info.challenged, "Room: " + this.room.title, 'tournament-challenged');
if (!this.$challenged.hasClass('active')) {
this.room.notifyOnce("Tournament challenge from " + this.info.challenged, "Room: " + this.room.title, 'tournament-challenged');
}
}
this.$challenged.toggleClass('active', !!this.info.challenged);
}
this.$noMatches.toggleClass('active',