Show shadowban directly in the communication page

For https://hq.lichess.ovh/#narrow/stream/34-mod-dev/topic/shadowbans.20in.20PMs.20.28request.29/near/432680

TDLR: make it more clear it's not needed to investigate these players, without hovering the username of each of them.
pull/9946/head
kraktus 2021-10-07 11:26:23 +02:00
parent 13041d1f3c
commit 2d0e6df79a
6 changed files with 34 additions and 19 deletions

View File

@ -156,17 +156,17 @@ object communication {
h2("Recent inbox messages"),
convos.map { modConvo =>
div(cls := "thread")(
p(cls := "title")(strong(lightUserLink(modConvo.convo.contact))),
p(cls := "title")(strong(userLink(modConvo.contact), showSbMark(modConvo.contact))),
table(cls := "slist")(
tbody(
modConvo.truncated option div(cls := "truncated-convo")(
s"Truncated, showing last ${modConvo.convo.msgs.length} messages"
s"Truncated, showing last ${modConvo.msgs.length} messages"
),
modConvo.convo.msgs.reverse.map { msg =>
modConvo.msgs.reverse.map { msg =>
val author = msg.user == u.id
tr(cls := List("post" -> true, "author" -> author))(
td(momentFromNowOnce(msg.date)),
td(strong(if (author) u.username else modConvo.convo.contact.name)),
td(strong(if (author) u.username else modConvo.contact.username)),
td(cls := "message")(highlightBad(msg.text))
)
}
@ -189,4 +189,6 @@ object communication {
raw(regex.replaceAllIn(escapeHtmlRaw(text), m => tag(m.toString)))
}
}
private def showSbMark(u: User) = u.marks.troll option span(cls := "user_marks")(iconTag(""))
}

View File

@ -187,19 +187,18 @@ final class MsgApi(
.cursor[Msg]()
.list(11)
.flatMap { msgs =>
lightUserApi async thread.other(user) map { contact =>
ModMsgConvo(
MsgConvo(
contact | LightUser.fallback(thread other user),
userRepo named thread.other(user) map {
_.map { contact =>
ModMsgConvo(
contact,
msgs.take(10),
lila.relation.Relations(none, none),
postable = false
),
msgs.length == 11
)
msgs.length == 11
)
}
}
}
}.sequenceFu
}.sequenceFu.map(_.flatten)
}
def deleteAllBy(user: User): Funit =

View File

@ -1,6 +1,7 @@
package lila.msg
import lila.common.LightUser
import lila.user.User
import lila.relation.Relations
case class MsgConvo(
@ -11,6 +12,8 @@ case class MsgConvo(
)
case class ModMsgConvo(
convo: MsgConvo,
contact: User,
msgs: List[Msg],
relations: Relations,
truncated: Boolean
)

View File

@ -1,3 +1,5 @@
@import 'user-marks';
#communication {
h1 {
@extend %flex-between;
@ -88,6 +90,10 @@
overflow-y: auto;
}
.user_marks i {
@include user_marks;
}
.player_chats .line,
.threads .post {
opacity: 0.5;

View File

@ -1,3 +1,5 @@
@import 'user-marks';
$c-report-bg: $c-bg-high;
$c-report-high: $c-brag;
$c-report-high-over: white;
@ -139,11 +141,7 @@ $c-report-high-over: white;
}
.user_marks i {
font-size: 0.9em;
background: #dc322f70;
padding: 0.1em 0.4em;
border-radius: 0.3em;
margin: 0 0.2em;
@include user_marks;
}
.appeal-queue {

View File

@ -0,0 +1,7 @@
@mixin user_marks {
font-size: 0.9em;
background: #dc322f70;
padding: 0.1em 0.4em;
border-radius: 0.3em;
margin: 0 0.2em;
}