notify moderators about new user reports
This commit is contained in:
parent
e1b92fd91a
commit
5fbab57ec9
|
@ -2,10 +2,14 @@ package lila.app
|
|||
package templating
|
||||
|
||||
import lila.message.Env.{ current ⇒ messageEnv }
|
||||
import lila.report.Env.{ current ⇒ reportEnv }
|
||||
import lila.user.Context
|
||||
|
||||
trait MessageHelper {
|
||||
trait MessageHelper { self: SecurityHelper =>
|
||||
|
||||
def messageNbUnread(ctx: Context): Int =
|
||||
ctx.me.??(user ⇒ messageEnv.api.unreadIds(user.id).await.size)
|
||||
|
||||
def reportNbUnprocessed(implicit ctx: Context): Int =
|
||||
isGranted(_.SeeReport) ?? reportEnv.api.nbUnprocessed.await
|
||||
}
|
||||
|
|
|
@ -72,6 +72,11 @@ data-accept-languages="@acceptLanguages.mkString(",")">
|
|||
}
|
||||
}
|
||||
}
|
||||
@defining(reportNbUnprocessed) { nb =>
|
||||
@if(nb > 0) {
|
||||
<a class="goto_nav" href="@routes.Report.list"><strong>Report (@nb)</strong></a>
|
||||
}
|
||||
}
|
||||
<div id="nb_connected_players" class="nb_connected_players">
|
||||
@trans.nbConnectedPlayers("<strong>?</strong>")
|
||||
</div>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@(title: String, searchText: String = "", moreJs: Html = Html(""))(body: Html)(implicit ctx: Context)
|
||||
@(title: String, searchText: String = "", goodies: Option[Html] = None, moreJs: Html = Html(""))(body: Html)(implicit ctx: Context)
|
||||
|
||||
@moreCss = {
|
||||
@cssTag("forum.css")
|
||||
|
@ -11,6 +11,7 @@
|
|||
|
||||
@base.layout(
|
||||
title = title,
|
||||
goodies = goodies,
|
||||
moreCss = moreCss,
|
||||
moreJs = forumJs,
|
||||
active = siteMenu.forum.some) {
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
@(categ: lila.forum.Categ, form: Form[_], captcha: lila.common.Captcha)(implicit ctx: Context)
|
||||
|
||||
@forum.layout(
|
||||
title = "New forum topic") {
|
||||
@goodies = {
|
||||
<br />
|
||||
@report.speech(true)
|
||||
}
|
||||
|
||||
@forum.layout(title = "New forum topic", goodies = goodies.some) {
|
||||
<ol class="crumbs">
|
||||
<li><a href="@routes.ForumCateg.index">Forum</a></li>
|
||||
<li><h1>@categ.name</h1></li>
|
||||
|
|
|
@ -4,7 +4,12 @@
|
|||
|
||||
@title = @{ "Report a user" }
|
||||
|
||||
@site.layout(title = title, moreCss = cssTag("report.css")) {
|
||||
@goodies = {
|
||||
<br />
|
||||
@report.speech(false)
|
||||
}
|
||||
|
||||
@site.layout(title = title, moreCss = cssTag("report.css"), goodies = goodies.some) {
|
||||
<div class="content_box" id="report">
|
||||
<h1>@title</h1>
|
||||
<form class="create" action="@routes.Report.create()@reqUser.map(u => "?username=" + u.username)" method="post">
|
||||
|
|
10
app/views/report/speech.scala.html
Normal file
10
app/views/report/speech.scala.html
Normal file
|
@ -0,0 +1,10 @@
|
|||
@(link: Boolean)
|
||||
|
||||
When you see someone cheating or being an ass,<br /><br />
|
||||
<strong>DO NOT WRITE IT IN THE FORUM</strong><br /><br />
|
||||
But @if(link) {
|
||||
<a href="@routes.Report.form">fill this form</a>
|
||||
} else {
|
||||
fill this form
|
||||
} to inform the moderators.<br />
|
||||
Your report will be processed faster this way.
|
|
@ -22,9 +22,7 @@ final class ReportApi {
|
|||
def process(id: String, by: User): Funit =
|
||||
$update.field(id, "processedBy", by.id)
|
||||
|
||||
// def unprocessed = $find($query(
|
||||
// Json.obj("processedBy" -> $exists(true))
|
||||
// ) sort $sort.createdDesc, 50)
|
||||
def nbUnprocessed = $count(Json.obj("processedBy" -> $exists(false)))
|
||||
|
||||
def recent = $find($query.all sort $sort.createdDesc, 50)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue