Merge pull request #9910 from kraktus/show_deleted_post_username

Show erased's post author to forum mods
pull/9913/head
Thibault Duplessis 2021-10-02 11:52:58 +02:00 committed by GitHub
commit 99ab44b585
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -5,6 +5,7 @@ import play.api.i18n.Lang
import lila.api.Context
import lila.app.ui.ScalatagsTemplate._
import lila.security.{ Permission, Granter => Master }
import lila.forum.Post
trait ForumHelper { self: UserHelper with StringHelper with HasEnv =>
@ -25,7 +26,8 @@ trait ForumHelper { self: UserHelper with StringHelper with HasEnv =>
post: Post,
cssClass: Option[String] = None,
withOnline: Boolean = true
)(implicit lang: Lang): Frag =
if (post.erased) span(cls := "author")("<erased>")
else userIdLink(post.userId, cssClass = cssClass, withOnline = withOnline, modIcon = ~post.modIcon)
)(implicit ctx: Context): Frag =
if (!(ctx.me ?? Master(Permission.ModerateForum)) && post.erased) span(cls := "author")("<erased>")
else
userIdLink(post.userId, cssClass = cssClass, withOnline = withOnline, modIcon = ~post.modIcon)(ctx.lang)
}