Add current ban to account info

pull/4313/head
Vincent Velociter 2018-04-27 14:42:02 +02:00
parent 3d17926481
commit 60b9e15b7d
2 changed files with 7 additions and 2 deletions

View File

@ -35,8 +35,9 @@ object Account extends LilaController {
relationEnv.api.countFollowing(me.id) zip
Env.pref.api.getPref(me) zip
lila.game.GameRepo.urgentGames(me) zip
Env.challenge.api.countInFor.get(me.id) map {
case nbFollowers ~ nbFollowing ~ prefs ~ povs ~ nbChallenges =>
Env.challenge.api.countInFor.get(me.id) zip
Env.playban.api.currentBan(me.id) map {
case nbFollowers ~ nbFollowing ~ prefs ~ povs ~ nbChallenges ~ playban =>
Env.current.system.lilaBus.publish(lila.user.User.Active(me), 'userActive)
Ok {
import lila.pref.JsonView._
@ -48,6 +49,7 @@ object Account extends LilaController {
"nbChallenges" -> nbChallenges
).add("kid" -> me.kid)
.add("troll" -> me.troll)
.add("playban" -> playban)
}
}
)

View File

@ -1,5 +1,6 @@
package lila.playban
import play.api.libs.json._
import org.joda.time.DateTime
case class UserRecord(
@ -63,6 +64,8 @@ case class TempBan(
}
object TempBan {
implicit val tempbanWrites = Json.writes[TempBan]
private def make(minutes: Int) = TempBan(
DateTime.now,
minutes atMost 48 * 60