diff --git a/app/controllers/Round.scala b/app/controllers/Round.scala index 293e8b0357d5..33b2649b9585 100644 --- a/app/controllers/Round.scala +++ b/app/controllers/Round.scala @@ -307,7 +307,7 @@ final class Round( .flatMap: _.flatMap { Pov(_, me) }.so: pov => env.round.moretimer - .isAllowedIn(pov.game, Preload.none) + .isAllowedIn(pov.game, Preload.none, byAdmin = true) .map: if _ then env.round.roundApi.tell(pov.gameId, Moretime(pov.playerId, seconds.seconds)) diff --git a/modules/round/src/main/JsonView.scala b/modules/round/src/main/JsonView.scala index c4e0a96fcff7..52b17ca9d2dc 100644 --- a/modules/round/src/main/JsonView.scala +++ b/modules/round/src/main/JsonView.scala @@ -68,7 +68,7 @@ final class JsonView( flags: ExportOptions ): Fu[JsObject] = for takebackable <- takebacker.isAllowedIn(pov.game, Preload(prefs)) - moretimeable <- moretimer.isAllowedIn(pov.game, Preload(prefs)) + moretimeable <- moretimer.isAllowedIn(pov.game, Preload(prefs), byAdmin = false) socket <- getSocketStatus(pov.game) pref = prefs(pov.color) yield diff --git a/modules/round/src/main/Moretimer.scala b/modules/round/src/main/Moretimer.scala index 53961676fa8b..47ff1b1e726f 100644 --- a/modules/round/src/main/Moretimer.scala +++ b/modules/round/src/main/Moretimer.scala @@ -30,9 +30,10 @@ final class Moretimer( val p = correspondenceGiveTime(pov.game) p.game.correspondenceClock.map(Event.CorrespondenceClock.apply).fold(p)(p + _) - def isAllowedIn(game: Game, prefs: Preload[ByColor[Pref]]): Fu[Boolean] = - (game.canTakebackOrAddTime && game.playable && !game.metadata.hasRule(_.noGiveTime)) - .so(isAllowedByPrefs(game, prefs)) + def isAllowedIn(game: Game, prefs: Preload[ByColor[Pref]], byAdmin: Boolean): Fu[Boolean] = + (game.canTakebackOrAddTime && game.playable).so: + if byAdmin then fuccess(true) + else (!game.metadata.hasRule(_.noGiveTime)).so(isAllowedByPrefs(game, prefs)) private def correspondenceGiveTime(g: Game) = Progress(g, g.copy(movedAt = nowInstant)) diff --git a/modules/round/src/main/RoundMobile.scala b/modules/round/src/main/RoundMobile.scala index 2d916bcf55d5..6abb344f7d88 100644 --- a/modules/round/src/main/RoundMobile.scala +++ b/modules/round/src/main/RoundMobile.scala @@ -60,7 +60,7 @@ final class RoundMobile( users <- game.userIdPair.traverse(_.so(lightUserGet)) prefs <- prefApi.byId(game.userIdPair) takebackable <- takebacker.isAllowedIn(game, Preload(prefs)) - moretimeable <- moretimer.isAllowedIn(game, Preload(prefs)) + moretimeable <- moretimer.isAllowedIn(game, Preload(prefs), byAdmin = false) chat <- use.chat.so(getPlayerChat(game, myPlayer.exists(_.hasUser))) chatLines <- chat.map(_.chat).soFu(lila.chat.JsonView.asyncLines) bookmarked <- use.bookmark.so(bookmarkExists(game, myPlayer.flatMap(_.userId)))