Skip to content

Commit

Permalink
Merge branch 'master' into 2fa
Browse files Browse the repository at this point in the history
* master:
  fix game export analysed flag
  inc assets version
  New Crowdin translations (lichess-org#4321)
  show streamer notes - closes lichess-org#4257
  show streamer notes - closes lichess-org#4257
  improve 429 error message - closes lichess-org#4265
  upgrade scalachess to 8.6.10 - closes lichess-org#4332
  upgrade scalachess
  update dictionary
  • Loading branch information
ornicar committed May 6, 2018
2 parents 77ddaef + 392716e commit 9583c1b
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 15 deletions.
2 changes: 1 addition & 1 deletion app/controllers/Api.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions app/controllers/Game.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
16 changes: 10 additions & 6 deletions app/controllers/Streamer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
}
}
}
Expand All @@ -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, _) }
Expand Down
18 changes: 16 additions & 2 deletions app/views/streamer/edit.scala.html
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -71,7 +71,8 @@ <h1>@s.streamer.name</h1>
<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) {
Expand All @@ -81,8 +82,21 @@ <h1>@s.streamer.name</h1>
}
</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)){[email protected]}" method="POST">
@errMsgMaterial(form.errors)
@if(isGranted(_.Streamers)) {
Expand Down
2 changes: 1 addition & 1 deletion conf/base.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ net {
ip = "5.196.91.160"
asset {
domain = "lichess-assets.local"
version = 2055
version = 2056
}
email = "[email protected]"
crawlable = false
Expand Down
2 changes: 1 addition & 1 deletion modules/shutup/src/main/Dictionary.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
2 changes: 1 addition & 1 deletion modules/user/src/main/NoteApi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion translation/dest/learn/pt-BR.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion translation/dest/site/gl-ES.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 9583c1b

Please sign in to comment.