display user moderation history - closes #1379
This commit is contained in:
parent
b81e1bda95
commit
432fef0c71
|
@ -184,10 +184,11 @@ object User extends LilaController {
|
|||
(!isGranted(_.SetEmail, user) ?? UserRepo.email(user.id)) zip
|
||||
(Env.security userSpy user.id) zip
|
||||
(Env.mod.assessApi.getPlayerAggregateAssessmentWithGames(user.id)) zip
|
||||
Env.mod.logApi.userHistory(user.id) zip
|
||||
Env.mod.callNeural(user) flatMap {
|
||||
case (((email, spy), playerAggregateAssessment), neuralResult) =>
|
||||
case ((((email, spy), playerAggregateAssessment), history), neuralResult) =>
|
||||
(Env.playban.api bans spy.usersSharingIp.map(_.id)) map { bans =>
|
||||
html.user.mod(user, email, spy, playerAggregateAssessment, bans, neuralResult)
|
||||
html.user.mod(user, email, spy, playerAggregateAssessment, bans, history, neuralResult)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@(u: User, email: Option[String], spy: lila.security.UserSpy, optionAggregateAssessment: Option[lila.evaluation.PlayerAggregateAssessment.WithGames], bans: Map[String, Int], neural: Option[lila.mod.NeuralApi.Result])(implicit ctx: Context)
|
||||
@(u: User, email: Option[String], spy: lila.security.UserSpy, optionAggregateAssessment: Option[lila.evaluation.PlayerAggregateAssessment.WithGames], bans: Map[String, Int], history: List[lila.mod.Modlog], neural: Option[lila.mod.NeuralApi.Result])(implicit ctx: Context)
|
||||
|
||||
@import lila.evaluation.Display
|
||||
|
||||
|
@ -153,18 +153,6 @@
|
|||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@neural.map { n =>
|
||||
<div class="neural">
|
||||
[beta] Neural decision: <strong>@n.answer.decision</strong>.
|
||||
Cheating odds: @n.answer.cheatPercent% vs @n.answer.nonCheatPercent%.
|
||||
Took @n.millis ms.
|
||||
</div>
|
||||
}
|
||||
@if(isGranted(_.Admin) && u.roles.nonEmpty) {
|
||||
<div class="mod_roles">
|
||||
Mod permissions: @u.roles.mkString(", ")
|
||||
</div>
|
||||
}
|
||||
<table class="slist">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -235,6 +223,29 @@
|
|||
</table>
|
||||
</div>
|
||||
}
|
||||
@neural.map { n =>
|
||||
<div class="neural">
|
||||
[beta] Neural decision: <strong>@n.answer.decision</strong>.
|
||||
Cheating odds: @n.answer.cheatPercent% vs @n.answer.nonCheatPercent%.
|
||||
Took @n.millis ms.
|
||||
</div>
|
||||
}
|
||||
@if(isGranted(_.Admin) && u.roles.nonEmpty) {
|
||||
<div class="mod_roles">
|
||||
Mod permissions: @u.roles.mkString(", ")
|
||||
</div>
|
||||
}
|
||||
<div class="mod_log">
|
||||
<strong>Moderation history@if(history.isEmpty){: nothing to show.}</strong>
|
||||
@if(history.nonEmpty) {
|
||||
<ul>
|
||||
@history.map { e =>
|
||||
<li>@userIdLink(e.mod.some) <b>@e.showAction</b> @u.username @momentFromNow(e.date)</li>
|
||||
}
|
||||
</ul>
|
||||
<br />
|
||||
}
|
||||
</div>
|
||||
@if(spy.otherUsers.size < 1) {
|
||||
<strong>No similar user found</strong>
|
||||
} else {
|
||||
|
|
|
@ -90,6 +90,9 @@ final class ModlogApi {
|
|||
"action" -> Modlog.unbooster
|
||||
))
|
||||
|
||||
def userHistory(userId: String): Fu[List[Modlog]] =
|
||||
$find($query(Json.obj("user" -> userId)) sort $sort.desc("date"), 100)
|
||||
|
||||
private def add(m: Modlog): Funit = {
|
||||
play.api.Logger("ModApi").info(m.toString)
|
||||
$insert(m)
|
||||
|
|
Loading…
Reference in a new issue