Merge branch 'master' into 2fa

* master:
  fix game export analysed flag
  inc assets version
  New Crowdin translations (#4321)
  show streamer notes - closes #4257
  show streamer notes - closes #4257
  improve 429 error message - closes #4265
  upgrade scalachess to 8.6.10 - closes #4332
  upgrade scalachess
  update dictionary
This commit is contained in:
Thibault Duplessis 2018-05-06 16:36:45 +02:00
commit 9583c1b0ae
10 changed files with 34 additions and 15 deletions

View file

@ -343,7 +343,7 @@ object Api extends LilaController {
js(req) map toHttp
}
private[controllers] val tooManyRequests = TooManyRequest(jsonError("Try again later"))
private[controllers] val tooManyRequests = TooManyRequest(jsonError("Error 429: Too many requests! Try again later."))
private def toHttp(result: ApiResult): Result = result match {
case Limited => tooManyRequests

View file

@ -46,6 +46,7 @@ object Game extends LilaController {
rated = getBoolOpt("rated", req),
perfType = ~get("perfType", req) split "," flatMap { lila.rating.PerfType(_) } toSet,
color = get("color", req) flatMap chess.Color.apply,
analysed = getBoolOpt("analysed", req),
flags = lila.game.PgnDump.WithFlags(
moves = getBoolOpt("moves", req) | true,
tags = getBoolOpt("tags", req) | true,

View file

@ -55,11 +55,16 @@ object Streamer extends LilaController {
}
}
private def modData(user: lila.user.User)(implicit ctx: Context) = isGranted(_.ModLog) ?? {
Env.mod.logApi.userHistory(user.id) zip
Env.user.noteApi.forMod(user.id) map some
}
def edit = Auth { implicit ctx => me =>
AsStreamer { s =>
Env.streamer.liveStreamApi of s flatMap { sws =>
isGranted(_.ModLog).??(Env.mod.logApi.userHistory(s.user.id) map some) map { modLog =>
NoCache(Ok(html.streamer.edit(sws, StreamerForm userForm sws.streamer, modLog)))
modData(s.user) map { forMod =>
NoCache(Ok(html.streamer.edit(sws, StreamerForm userForm sws.streamer, forMod)))
}
}
}
@ -70,10 +75,9 @@ object Streamer extends LilaController {
Env.streamer.liveStreamApi of s flatMap { sws =>
implicit val req = ctx.body
StreamerForm.userForm(sws.streamer).bindFromRequest.fold(
error =>
isGranted(_.ModLog).??(Env.mod.logApi.userHistory(s.user.id) map some) map { modLog =>
BadRequest(html.streamer.edit(sws, error, modLog))
},
error => modData(s.user) map { forMod =>
BadRequest(html.streamer.edit(sws, error, forMod))
},
data => api.update(sws.streamer, data, isGranted(_.Streamers)) map { change =>
change.list foreach { Env.mod.logApi.streamerList(lila.report.Mod(me), s.user.id, _) }
change.feature foreach { Env.mod.logApi.streamerFeature(lila.report.Mod(me), s.user.id, _) }

View file

@ -1,4 +1,4 @@
@(s: lila.streamer.Streamer.WithUserAndStream, form: Form[_], modLog: Option[List[lila.mod.Modlog]])(implicit ctx: Context)
@(s: lila.streamer.Streamer.WithUserAndStream, form: Form[_], modData: Option[(List[lila.mod.Modlog], List[lila.user.Note])])(implicit ctx: Context)
@import play.api.data.Field
@ -71,7 +71,8 @@ menu = menu("edit", s.withoutStream.some).some) {
<strong>If your stream is in another language than English</strong>, include the correct language tag (<a class="blue" href="https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes">2-letter ISO 639-1 code</a> enclosed in square brackets) at the start of your stream title. As examples, include "[RU]" for Russian, "[TR]" for Turkish, "[FR]" for French, etc. If your stream is in English, there is no need to include a language tag.
</div>
}
@modLog.map { log =>
@modData.map {
case (log, notes) => {
<div class="mod_log status">
<strong class="text" data-icon="!">Moderation history@if(log.isEmpty){: nothing to show.}</strong>
@if(log.nonEmpty) {
@ -81,8 +82,21 @@ menu = menu("edit", s.withoutStream.some).some) {
}
</ul>
}
<br />
<strong class="text" data-icon="!">Moderator notes@if(notes.isEmpty){: nothing to show.}</strong>
@if(notes.nonEmpty) {
<ul>
@notes.map { note =>
<li>
<p class="meta">@userIdLink(note.from.some) @momentFromNow(note.date)</p>
<p class="text">@richText(note.text)</p>
</li>
}
</ul>
}
</div>
}
}
<form class="content_box_content material form" action="@routes.Streamer.edit@if(!ctx.is(s.user)){?u=@s.user.id}" method="POST">
@errMsgMaterial(form.errors)
@if(isGranted(_.Streamers)) {

View file

@ -11,7 +11,7 @@ net {
ip = "5.196.91.160"
asset {
domain = "lichess-assets.local"
version = 2055
version = 2056
}
email = "contact@lichess.org"
crawlable = false

View file

@ -175,5 +175,5 @@ pid(a|o)r
private def dict(words: String) = words.lines.filter(_.nonEmpty)
val youtubeIds = List("7UpltimWY_E")
val youtubeIds = List("7UpltimWY_E", "J_bzfjZZnjU")
}

View file

@ -50,7 +50,7 @@ final class NoteApi(
.list[Note](20)
def forMod(ids: List[User.ID]): Fu[List[Note]] =
coll.find($doc("to" -> $doc("$in" -> ids)))
coll.find($doc("to" $in ids))
.sort($doc("date" -> -1))
.list[Note](50)

View file

@ -28,7 +28,7 @@ object Dependencies {
val findbugs = "com.google.code.findbugs" % "jsr305" % "3.0.1"
val hasher = "com.roundeights" %% "hasher" % "1.2.0"
val jodaTime = "joda-time" % "joda-time" % "2.9.9"
val chess = "org.lichess" %% "scalachess" % "8.6.8"
val chess = "org.lichess" %% "scalachess" % "8.6.10"
val compression = "org.lichess" %% "compression" % "1.4"
val maxmind = "com.sanoma.cda" %% "maxmind-geoip2-scala" % "1.2.3-THIB"
val prismic = "io.prismic" %% "scala-kit" % "1.2.11-THIB"

View file

@ -52,7 +52,7 @@ Mas às vezes um cavalo pode ser útil!</string>
<string name="captureThenPromote">Capture, e então promova!</string>
<string name="useAllThePawns">Use todos os peões!
Não é necessário promover.</string>
<string name="aPawnOnTheSecondRank">Um peão na segunda fileira pode mover-se duas posições de uma vez!</string>
<string name="aPawnOnTheSecondRank">Um peão na segunda fileira pode mover-se duas casas de uma vez!</string>
<string name="grabAllTheStarsNoNeedToPromote">Pegue todas as estrelas!
Não é necessário promover.</string>
<string name="pawnComplete">Parabéns! Peões não têm segredos para você.</string>

View file

@ -5,7 +5,7 @@
<string name="playWithTheMachine">Xogar contra a máquina</string>
<string name="toInviteSomeoneToPlayGiveThisUrl">Para invitar a alguén a xogar, dálle este URL</string>
<string name="gameOver">Partida rematada</string>
<string name="waitingForOpponent">Agardando ó rival</string>
<string name="waitingForOpponent">Agardando un rival</string>
<string name="waiting">Agardando</string>
<string name="yourTurn">A túa quenda</string>
<string name="aiNameLevelAiLevel">%1$s nivel %2$s</string>