diff --git a/app/mashup/UserInfo.scala b/app/mashup/UserInfo.scala index 130e9ad8b4..0baf5ba7fa 100644 --- a/app/mashup/UserInfo.scala +++ b/app/mashup/UserInfo.scala @@ -131,7 +131,7 @@ object UserInfo { playbanApi: lila.playban.PlaybanApi )(implicit ec: scala.concurrent.ExecutionContext) { def apply(user: User, nbs: NbGames, ctx: Context): Fu[UserInfo] = - (ctx.noBlind ?? ratingChartApi(user)).mon(_.user segment "ratingChart") zip + ((ctx.noBlind && ctx.pref.showRatings) ?? ratingChartApi(user)).mon(_.user segment "ratingChart") zip relationApi.countFollowers(user.id).mon(_.user segment "nbFollowers") zip !(user.is(User.lichessId) || user.isBot) ?? postApi.nbByUser(user.id).mon(_.user segment "nbForumPosts") zip diff --git a/app/views/activity.scala b/app/views/activity.scala index 59a1bfe851..42145bd090 100644 --- a/app/views/activity.scala +++ b/app/views/activity.scala @@ -362,8 +362,8 @@ object activity { )}""" } - private def ratingProgFrag(r: RatingProg) = - ratingTag(r.after.value, ratingProgress(r.diff)) + private def ratingProgFrag(r: RatingProg)(implicit ctx: Context) = + ctx.pref.showRatings option ratingTag(r.after.value, ratingProgress(r.diff)) private def scoreStr(tag: String, p: Int, name: lila.i18n.I18nKey)(implicit ctx: Context) = if (p == 0) "" diff --git a/app/views/game/widgets.scala b/app/views/game/widgets.scala index 21ae7ccaed..521bcae356 100644 --- a/app/views/game/widgets.scala +++ b/app/views/game/widgets.scala @@ -132,18 +132,22 @@ object widgets { userIdLink(playerUser.id.some, withOnline = false), br, player.berserk option berserkIconSpan, - playerUser.rating, - player.provisional option "?", - playerUser.ratingDiff map { d => - frag(" ", showRatingDiff(d)) - } + ctx.pref.showRatings option frag( + playerUser.rating, + player.provisional option "?", + playerUser.ratingDiff map { d => + frag(" ", showRatingDiff(d)) + } + ) ) } getOrElse { player.aiLevel map { level => frag( span(aiName(level, withRating = false)), - br, - aiRating(level) + ctx.pref.showRatings option frag( + br, + aiRating(level) + ) ) } getOrElse { (player.nameSplit.fold[Frag](anonSpan) { case (name, rating) => diff --git a/app/views/user/mini.scala b/app/views/user/mini.scala index be2b2655fc..fa4849165c 100644 --- a/app/views/user/mini.scala +++ b/app/views/user/mini.scala @@ -39,7 +39,9 @@ object mini { if (u.lame && !ctx.me.has(u) && !isGranted(_.UserModView)) div(cls := "upt__info__warning")(trans.thisAccountViolatedTos()) else - div(cls := "upt__info__ratings")(u.best8Perfs map { showPerfRating(u, _) }) + ctx.pref.showRatings option div(cls := "upt__info__ratings")(u.best8Perfs map { + showPerfRating(u, _) + }) ), ctx.userId map { myId => frag( diff --git a/app/views/user/show/header.scala b/app/views/user/show/header.scala index e741f88f44..80495e169f 100644 --- a/app/views/user/show/header.scala +++ b/app/views/user/show/header.scala @@ -186,7 +186,7 @@ object header { if (info.ratingChart.isDefined && (!u.lame || ctx.is(u) || isGranted(_.UserModView))) div(cls := "rating-history")(spinner) else - ctx.is(u) option newPlayer(u), + (ctx.is(u) && u.count.game < 10) option newPlayer(u), div(cls := "profile-side")( div(cls := "user-infos")( !ctx.is(u) option frag( diff --git a/app/views/user/show/side.scala b/app/views/user/show/side.scala index f468b795cd..23a7402e8d 100644 --- a/app/views/user/show/side.scala +++ b/app/views/user/show/side.scala @@ -29,36 +29,38 @@ object side { "empty" -> perf.isEmpty, "active" -> active.has(perfType) ), - href := { + href := ctx.pref.showRatings.?? { if (isPuzzle) ctx.is(u) option routes.Puzzle.dashboard(30, "home").url else routes.User.perfStat(u.username, perfType.key).url.some }, span( h3(perfType.trans), - if (isPuzzle && u.perfs.dubiousPuzzle && !ctx.is(u)) st.rating(strong("?")) + if (isPuzzle && u.perfs.dubiousPuzzle && !ctx.is(u) && ctx.pref.showRatings) st.rating(strong("?")) else st.rating( - if (perf.glicko.clueless) strong("?") - else - strong( - perf.glicko.intRating, - perf.provisional option "?" - ), - " ", - ratingProgress(perf.progress), - " ", + ctx.pref.showRatings option frag( + if (perf.glicko.clueless) strong("?") + else + strong( + perf.glicko.intRating, + perf.provisional option "?" + ), + " ", + ratingProgress(perf.progress), + " " + ), span( if (perfType.key == "puzzle") trans.nbPuzzles.plural(perf.nb, perf.nb.localize) else trans.nbGames.plural(perf.nb, perf.nb.localize) ) ), - rankMap get perfType map { rank => + rankMap get perfType ifTrue ctx.pref.showRatings map { rank => span(cls := "rank", title := trans.rankIsUpdatedEveryNbMinutes.pluralSameTxt(15))( trans.rankX(rank.localize) ) } ), - iconTag("") + ctx.pref.showRatings option iconTag("") ) } diff --git a/modules/pref/src/main/PrefHandlers.scala b/modules/pref/src/main/PrefHandlers.scala index 7f42f98ffe..b6cde0823d 100644 --- a/modules/pref/src/main/PrefHandlers.scala +++ b/modules/pref/src/main/PrefHandlers.scala @@ -91,6 +91,7 @@ private object PrefHandlers { "insightShare" -> o.insightShare, "keyboardMove" -> o.keyboardMove, "zen" -> o.zen, + "ratings" -> o.ratings, "rookCastle" -> o.rookCastle, "moveEvent" -> o.moveEvent, "pieceNotation" -> o.pieceNotation, diff --git a/ui/site/css/user/_sub-rating.scss b/ui/site/css/user/_sub-rating.scss index 5214e40e35..d542ab5b98 100644 --- a/ui/site/css/user/_sub-rating.scss +++ b/ui/site/css/user/_sub-rating.scss @@ -19,7 +19,7 @@ @include transition; } - &:hover { + &[href]:hover { background: mix($c-bg-box, $c-bg-page, 50%); &::before {