added report forum post shortcut (reports user) (#8553)
* added report forum post shortcut * proper option handling * WIP * WIP * Working * works but not with hyperlinking Co-authored-by: michael1241 <michael@jamcupboard.co.uk>pull/8621/head
parent
0c36b07cc1
commit
7f330840d7
|
@ -9,6 +9,8 @@ import lila.common.HTTPRequest
|
|||
import lila.report.{ Room, Report => ReportModel, Mod => AsMod, Reporter, Suspect }
|
||||
import lila.user.{ User => UserModel, Holder }
|
||||
|
||||
import play.api.data._
|
||||
|
||||
final class Report(
|
||||
env: Env,
|
||||
userC: => User,
|
||||
|
@ -154,7 +156,11 @@ final class Report(
|
|||
if (user.map(_.id) has UserModel.lichessId) Redirect(routes.Main.contact).fuccess
|
||||
else
|
||||
env.report.forms.createWithCaptcha map { case (form, captcha) =>
|
||||
Ok(html.report.form(form, user, captcha))
|
||||
val filledForm: Form[lila.report.ReportSetup] = (user, get("postUrl")) match {
|
||||
case (Some(u), Some(pid)) => form.fill(lila.report.ReportSetup(user=u.light, "", text=pid, "", ""))
|
||||
case _ => form
|
||||
}
|
||||
Ok(html.report.form(filledForm, user, captcha))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,7 +72,16 @@ object post {
|
|||
dataIcon := "q",
|
||||
title := "Delete"
|
||||
)
|
||||
else emptyFrag
|
||||
else
|
||||
post.userId map {
|
||||
userId =>
|
||||
a(
|
||||
titleOrText(trans.reportXToModerators.txt(userId)),
|
||||
cls := "mod report button button-empty",
|
||||
href := s"${routes.Report.form}?username=${userId}&postUrl=${netBaseUrl}${routes.ForumPost.redirect(post.id).url}",
|
||||
dataIcon := "!"
|
||||
)
|
||||
}
|
||||
),
|
||||
a(cls := "anchor", href := url)(s"#${post.number}")
|
||||
),
|
||||
|
|
|
@ -68,7 +68,7 @@ private[report] case class ReportFlag(
|
|||
text: String
|
||||
)
|
||||
|
||||
private[report] case class ReportSetup(
|
||||
case class ReportSetup(
|
||||
user: LightUser,
|
||||
reason: String,
|
||||
text: String,
|
||||
|
|
Loading…
Reference in New Issue