start adding simul stuff
parent
a64f99d57a
commit
eed98b84fc
|
@ -11,6 +11,8 @@ import play.api.mvc.Results._
|
|||
|
||||
import lila.evaluation.{ PlayerAssessment }
|
||||
|
||||
import lila.simul.{Simul => SimulModel}
|
||||
|
||||
import lila.tournament.TournamentRepo
|
||||
import lila.tournament.{ Tournament => TournamentModel}
|
||||
|
||||
|
@ -44,10 +46,19 @@ object Mod extends LilaController {
|
|||
}
|
||||
}
|
||||
|
||||
private def fetchVisibleSimuls : Fu[List[SimulModel]] = {
|
||||
Env.simul.allCreated(true) zip
|
||||
Env.simul.repo.allStarted zip
|
||||
Env.simul.repo.allFinished(5) map {
|
||||
case ((created,started),finished) =>
|
||||
created ::: started ::: finished
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort the tournaments by the tournaments most likely to require moderation attention
|
||||
*/
|
||||
def sortTournamentsByRelevance(tournaments : List[TournamentModel]) : List[TournamentModel] =
|
||||
private def sortTournamentsByRelevance(tournaments : List[TournamentModel]) : List[TournamentModel] =
|
||||
tournaments.sortBy(-_.nbPlayers)
|
||||
|
||||
def booster(username: String) = Secure(_.MarkBooster) { _ =>
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
@if(isGranted(_.SeeReport)) {
|
||||
<a class="@active.active("report")" href="@routes.Report.list">Reports</a>
|
||||
}
|
||||
@if(isGranted(_.ChatTimeout)) {
|
||||
<a class="@active.active("public-chat")" href="@routes.Mod.publicChat">Public Chats</a>
|
||||
}
|
||||
@if(isGranted(_.SeeReport)) {
|
||||
<a class="@active.active("gamify")" href="@routes.Mod.gamify">Hall of fame</a>
|
||||
}
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
@(tourChats : List[(lila.tournament.Tournament, lila.chat.UserChat)])(implicit ctx: Context)
|
||||
|
||||
@moreCss = {
|
||||
@cssTag("mod-communication.css")
|
||||
@moreJs= {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@base.layout(
|
||||
title = "Public communications",
|
||||
moreCss = moreCss) {
|
||||
@mod.layout(
|
||||
title = "Public Chats",
|
||||
active = "public-chat",
|
||||
moreCss = cssTag("mod-communication.css"),
|
||||
moreJs = moreJs) {
|
||||
|
||||
<div id="communication" class="content_box">
|
||||
<h2>Public Chats</h2>
|
||||
|
@ -19,7 +20,7 @@ moreCss = moreCss) {
|
|||
@tournament.name
|
||||
</a>
|
||||
<div class="chat">
|
||||
@chat.lines.map { line =>
|
||||
@chat.lines.filter(_.isVisible).map { line =>
|
||||
<div class="line">
|
||||
@userIdLink(line.author.toLowerCase.some, withOnline = false, withTitle = false)
|
||||
@line.text
|
||||
|
|
|
@ -344,7 +344,7 @@ GET /mod/search controllers.Mod.search
|
|||
GET /mod/chat-user/:username controllers.Mod.chatUser(username: String)
|
||||
GET /mod/:username/powaaa controllers.Mod.powaaa(username: String)
|
||||
POST /mod/:username/powaaa controllers.Mod.savePowaaa(username: String)
|
||||
GET /mod/publichat controllers.Mod.publicChat
|
||||
GET /mod/public-chat controllers.Mod.publicChat
|
||||
|
||||
# Bookmark
|
||||
POST /bookmark/$gameId<\w{8}> controllers.Bookmark.toggle(gameId: String)
|
||||
|
|
|
@ -24,6 +24,8 @@ case class UserLine(
|
|||
def userId = User normalize username
|
||||
|
||||
def delete = copy(deleted = true)
|
||||
|
||||
def isVisible = !troll && !deleted
|
||||
}
|
||||
case class PlayerLine(
|
||||
color: Color,
|
||||
|
|
|
@ -53,6 +53,13 @@ private[simul] final class SimulApi(
|
|||
} inject simul
|
||||
}
|
||||
|
||||
def fetchVisibleSimuls : Fu[List[Simul]] = {
|
||||
repo.allCreated zip repo.allStarted zip repo.allFinished(5) map {
|
||||
case ((created,started),finished) =>
|
||||
created ::: started ::: finished
|
||||
}
|
||||
}
|
||||
|
||||
def addApplicant(simulId: Simul.ID, user: User, variantKey: String) {
|
||||
WithSimul(repo.findCreated, simulId) { simul =>
|
||||
if (simul.nbAccepted >= Game.maxPlayingRealtime) simul
|
||||
|
|
Loading…
Reference in New Issue