<commit_before>package views.html.mod

import lila.api.Context
import lila.app.templating.Environment._
import lila.app.ui.ScalatagsTemplate._
import lila.common.String.html.richText
import lila.hub.actorApi.shutup.PublicSource

import controllers.routes

object communication {

  def apply(
    u: lila.user.User,
    players: List[(lila.game.Pov, lila.chat.MixedChat)],
    threads: List[lila.message.Thread],
    publicLines: List[lila.shutup.PublicLine],
    spy: lila.security.UserSpy,
    otherWithEmails: lila.security.UserSpy.WithMeSortedWithEmails,
    notes: List[lila.user.Note],
    history: List[lila.mod.Modlog],
    priv: Boolean
  )(implicit ctx: Context) =
    views.html.base.layout(
      title = u.username + " communications",
      moreCss = cssTag("mod.communication")
    ) {
        main(id := "communication", cls := "box box-pad")(
          h1(
            div(cls := "title")(userLink(u), " communications"),
            div(cls := "actions")(
              isGranted(_.ViewPrivateComms) option {
                if (priv) a(cls := "priv button active", href := routes.Mod.communicationPublic(u.username))("PMs")
                else a(
                  cls := "priv button",
                  href := routes.Mod.communicationPrivate(u.username),
                  title := "View private messages. This will be logged in #commlog"
                )("PMs")
              }
            )
          ),

          history.nonEmpty option frag(
            h2("Moderation history"),
            div(cls := "history")(
              history.map { e =>
                div(userIdLink(e.mod.some), " ", b(e.showAction), " ", u.username, " ", e.details, " ", momentFromNowOnce(e.date))
              }
            )
          ),

          notes.nonEmpty option frag(
            h2("Notes from other users"),
            div(cls := "notes")(
              notes.map { note =>
                div(userIdLink(note.from.some), " ", momentFromNowOnce(note.date), ": ", richText(note.text))
              }
            )
          ),

          h2("Dubious public chats"),
          if (publicLines.isEmpty) strong("None!")
          else ul(cls := "public_chats")(
            publicLines.reverse.map { line =>
              li(
                line.date.map(momentFromNowOnce(_)).getOrElse("[OLD]"),
                line.from.map {
                  case PublicSource.Tournament(id) => tournamentLink(id)
                  case PublicSource.Simul(id) => views.html.simul.bits.link(id)
                  case PublicSource.Watcher(id) => a(href := routes.Round.watcher(id, "white"))("Game #", id)
                  case PublicSource.Study(id) => a(href := routes.Study.show(id))("Study #", id)
                },
                line.text<commit_msg>mod UI spacing<commit_after>package views.html.mod

import lila.api.Context
import lila.app.templating.Environment._
import lila.app.ui.ScalatagsTemplate._
import lila.common.String.html.richText
import lila.hub.actorApi.shutup.PublicSource

import controllers.routes

object communication {

  def apply(
    u: lila.user.User,
    players: List[(lila.game.Pov, lila.chat.MixedChat)],
    threads: List[lila.message.Thread],
    publicLines: List[lila.shutup.PublicLine],
    spy: lila.security.UserSpy,
    otherWithEmails: lila.security.UserSpy.WithMeSortedWithEmails,
    notes: List[lila.user.Note],
    history: List[lila.mod.Modlog],
    priv: Boolean
  )(implicit ctx: Context) =
    views.html.base.layout(
      title = u.username + " communications",
      moreCss = cssTag("mod.communication")
    ) {
        main(id := "communication", cls := "box box-pad")(
          h1(
            div(cls := "title")(userLink(u), " communications"),
            div(cls := "actions")(
              isGranted(_.ViewPrivateComms) option {
                if (priv) a(cls := "priv button active", href := routes.Mod.communicationPublic(u.username))("PMs")
                else a(
                  cls := "priv button",
                  href := routes.Mod.communicationPrivate(u.username),
                  title := "View private messages. This will be logged in #commlog"
                )("PMs")
              }
            )
          ),

          history.nonEmpty option frag(
            h2("Moderation history"),
            div(cls := "history")(
              history.map { e =>
                div(userIdLink(e.mod.some), " ", b(e.showAction), " ", u.username, " ", e.details, " ", momentFromNowOnce(e.date))
              }
            )
          ),

          notes.nonEmpty option frag(
            h2("Notes from other users"),
            div(cls := "notes")(
              notes.map { note =>
                div(userIdLink(note.from.some), " ", momentFromNowOnce(note.date), ": ", richText(note.text))
              }
            )
          ),

          h2("Dubious public chats"),
          if (publicLines.isEmpty) strong("None!")
          else ul(cls := "public_chats")(
            publicLines.reverse.map { line =>
              li(
                line.date.map(momentFromNowOnce(_)).getOrElse("[OLD]"),
                " ",
                line.from.map {
                  case PublicSource.Tournament(id) => tournamentLink(id)
                  case PublicSource.Simul(id) => views.html.simul.bits.link(id)
                  case PublicSource.Watcher(id) => a(href := routes.Round.watcher(id, "white"))("Game #", id)
                  case PublicSource.Study(id) => a(href := routes.Study.show(id))("Study #", id)
                },
                " ",
                line.text
{'fraction_non_alphanumeric': 0.13945151460835276, 'fraction_numerical': 0.001433948736332676, 'mean_word_length': 1.8926905132192846, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7128721', 'n_tokens_mistral': 1686, 'n_tokens_neox': 1624, 'n_words': 291}