restore previous irwin endpoint
parent
a13b4bfde3
commit
b268dbdf86
|
@ -81,7 +81,7 @@ object Mod extends LilaController {
|
|||
|
||||
import lila.irwin.JSONHandlers.reportReader
|
||||
|
||||
def irwin(username: String) = OpenBody(parse.json) { implicit ctx =>
|
||||
def irwin2(username: String) = OpenBody(parse.json) { implicit ctx =>
|
||||
Mod.ModExternalBot {
|
||||
OptionFuResult(UserRepo named username) { user =>
|
||||
UserRepo.irwin.flatten("Missing irwin user") flatMap { irwin =>
|
||||
|
@ -94,6 +94,29 @@ object Mod extends LilaController {
|
|||
}
|
||||
}
|
||||
|
||||
private case class Irwin(result: Boolean, reason: String)
|
||||
private implicit val IrwinReads = Json.reads[Irwin]
|
||||
|
||||
def irwin(username: String) = OpenBody(parse.json) { implicit ctx =>
|
||||
Mod.ModExternalBot {
|
||||
OptionFuResult(UserRepo named username) { user =>
|
||||
UserRepo.irwin.flatten("Missing irwin user") flatMap { irwin =>
|
||||
ctx.body.body.validate[Irwin].fold(
|
||||
err => fuccess(BadRequest(err.toString)),
|
||||
data => {
|
||||
val text =
|
||||
if (data.result) s"Irwin would mark as engine: ${data.reason}"
|
||||
else s"Irwin is indecise: ${data.reason}"
|
||||
(if (data.result) modApi.setEngine(irwin.id, username, true)
|
||||
else funit) >>
|
||||
Env.user.noteApi.write(user, text, irwin, true) inject Ok
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def setTitle(username: String) = SecureBody(_.SetTitle) { implicit ctx => me =>
|
||||
implicit def req = ctx.body
|
||||
lila.user.DataForm.title.bindFromRequest.fold(
|
||||
|
|
|
@ -10,7 +10,7 @@ net {
|
|||
ip = "5.196.91.160"
|
||||
asset {
|
||||
domain = ${net.domain}
|
||||
version = 1687
|
||||
version = 1688
|
||||
}
|
||||
email = "contact@lichess.org"
|
||||
crawlable = false
|
||||
|
|
|
@ -370,6 +370,7 @@ GET /mod/:username/permissions controllers.Mod.permissions(username: Str
|
|||
POST /mod/:username/permissions controllers.Mod.savePermissions(username: String)
|
||||
GET /mod/public-chat controllers.Mod.publicChat
|
||||
POST /mod/:username/irwin controllers.Mod.irwin(username: String)
|
||||
POST /mod/:username/irwin2 controllers.Mod.irwin2(username: String)
|
||||
GET /mod/:username/assessment controllers.Mod.assessment(username: String)
|
||||
GET /mod/users-mark-and-current-report controllers.Mod.usersMarkAndCurrentReport(ids: String)
|
||||
|
||||
|
|
Loading…
Reference in New Issue