Display to mods when conv threads are truncated
parent
2cc0803a10
commit
767849a396
|
@ -18,7 +18,7 @@ object communication {
|
||||||
mod: Holder,
|
mod: Holder,
|
||||||
u: User,
|
u: User,
|
||||||
players: List[(lila.game.Pov, lila.chat.MixedChat)],
|
players: List[(lila.game.Pov, lila.chat.MixedChat)],
|
||||||
convos: List[lila.msg.MsgConvo],
|
convos: List[lila.msg.ModMsgConvo],
|
||||||
publicLines: List[lila.shutup.PublicLine],
|
publicLines: List[lila.shutup.PublicLine],
|
||||||
notes: List[lila.user.Note],
|
notes: List[lila.user.Note],
|
||||||
history: List[lila.mod.Modlog],
|
history: List[lila.mod.Modlog],
|
||||||
|
@ -154,16 +154,19 @@ object communication {
|
||||||
),
|
),
|
||||||
div(cls := "threads")(
|
div(cls := "threads")(
|
||||||
h2("Recent inbox messages"),
|
h2("Recent inbox messages"),
|
||||||
convos.map { convo =>
|
convos.map { modConvo =>
|
||||||
div(cls := "thread")(
|
div(cls := "thread")(
|
||||||
p(cls := "title")(strong(lightUserLink(convo.contact))),
|
p(cls := "title")(strong(lightUserLink(modConvo.convo.contact))),
|
||||||
table(cls := "slist")(
|
table(cls := "slist")(
|
||||||
tbody(
|
tbody(
|
||||||
convo.msgs.reverse.map { msg =>
|
modConvo.truncated option div(cls := "truncated-convo")(
|
||||||
|
s"Truncated, showing last ${modConvo.convo.msgs.length} messages"
|
||||||
|
),
|
||||||
|
modConvo.convo.msgs.reverse.map { msg =>
|
||||||
val author = msg.user == u.id
|
val author = msg.user == u.id
|
||||||
tr(cls := List("post" -> true, "author" -> author))(
|
tr(cls := List("post" -> true, "author" -> author))(
|
||||||
td(momentFromNowOnce(msg.date)),
|
td(momentFromNowOnce(msg.date)),
|
||||||
td(strong(if (author) u.username else convo.contact.name)),
|
td(strong(if (author) u.username else modConvo.convo.contact.name)),
|
||||||
td(cls := "message")(highlightBad(msg.text))
|
td(cls := "message")(highlightBad(msg.text))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,7 +173,7 @@ final class MsgApi(
|
||||||
case Some(sender) => multiPost(Holder(sender), Source(dests), text) inject "done"
|
case Some(sender) => multiPost(Holder(sender), Source(dests), text) inject "done"
|
||||||
}
|
}
|
||||||
|
|
||||||
def recentByForMod(user: User, nb: Int): Fu[List[MsgConvo]] =
|
def recentByForMod(user: User, nb: Int): Fu[List[ModMsgConvo]] =
|
||||||
colls.thread
|
colls.thread
|
||||||
.find($doc("users" -> user.id))
|
.find($doc("users" -> user.id))
|
||||||
.sort($sort desc "lastMsg.date")
|
.sort($sort desc "lastMsg.date")
|
||||||
|
@ -185,14 +185,17 @@ final class MsgApi(
|
||||||
.find($doc("tid" -> thread.id), msgProjection)
|
.find($doc("tid" -> thread.id), msgProjection)
|
||||||
.sort($sort desc "date")
|
.sort($sort desc "date")
|
||||||
.cursor[Msg]()
|
.cursor[Msg]()
|
||||||
.list(10)
|
.list(11)
|
||||||
.flatMap { msgs =>
|
.flatMap { msgs =>
|
||||||
lightUserApi async thread.other(user) map { contact =>
|
lightUserApi async thread.other(user) map { contact =>
|
||||||
MsgConvo(
|
ModMsgConvo(
|
||||||
contact | LightUser.fallback(thread other user),
|
MsgConvo(
|
||||||
msgs,
|
contact | LightUser.fallback(thread other user),
|
||||||
lila.relation.Relations(none, none),
|
msgs.take(10),
|
||||||
postable = false
|
lila.relation.Relations(none, none),
|
||||||
|
postable = false
|
||||||
|
),
|
||||||
|
msgs.length == 11
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,3 +9,8 @@ case class MsgConvo(
|
||||||
relations: Relations,
|
relations: Relations,
|
||||||
postable: Boolean
|
postable: Boolean
|
||||||
)
|
)
|
||||||
|
|
||||||
|
case class ModMsgConvo(
|
||||||
|
convo: MsgConvo,
|
||||||
|
truncated: Boolean
|
||||||
|
)
|
||||||
|
|
|
@ -113,6 +113,12 @@
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.thread .truncated-convo {
|
||||||
|
text-align: center;
|
||||||
|
font-style: italic;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
.thread .title strong {
|
.thread .title strong {
|
||||||
font-size: 1.2em;
|
font-size: 1.2em;
|
||||||
display: block;
|
display: block;
|
||||||
|
|
Loading…
Reference in New Issue