fix team leader forum deletion message - closes lichess-org/tavern#119
parent
bea19922b2
commit
17870be430
|
@ -84,13 +84,16 @@ final class ForumPost(env: Env) extends LilaController(env) with ForumController
|
|||
postApi.erasePost(post) inject Redirect(routes.ForumPost.redirect(id))
|
||||
else
|
||||
isGrantedMod(categSlug) flatMap { granted =>
|
||||
(granted | isGranted(_.ModerateForum)) ?? postApi.delete(categSlug, id, me) inject {
|
||||
postApi.delete(categSlug, id, me) inject {
|
||||
implicit val req = ctx.body
|
||||
for {
|
||||
userId <- post.userId
|
||||
reasonOpt <- forms.deleteWithReason.bindFromRequest().value
|
||||
reason <- reasonOpt
|
||||
} env.msg.api.systemPost(userId, lila.msg.MsgPreset forumDeletion reason)
|
||||
preset =
|
||||
if (isGranted(_.ModerateForum)) lila.msg.MsgPreset.forumDeletionByModerator
|
||||
else lila.msg.MsgPreset.forumDeletionByTeamLeader
|
||||
} env.msg.api.systemPost(userId, preset(reason))
|
||||
NoContent
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,10 @@ To follow new players, you must first unfollow some on https://lichess.org/@/$us
|
|||
Thank you for your understanding."""
|
||||
)
|
||||
|
||||
def forumDeletion(reason: String) =
|
||||
s"""A moderator deleted one of your posts for this reason: $reason. Please read our Forum-Etiquette: https://lichess.org/page/forum-etiquette"""
|
||||
def forumDeletionByModerator = forumDeletion("A moderator") _
|
||||
|
||||
def forumDeletionByTeamLeader = forumDeletion("A team leader") _
|
||||
|
||||
private def forumDeletion(by: String)(reason: String) =
|
||||
s"""$by deleted one of your posts for this reason: $reason. Please read our Forum-Etiquette: https://lichess.org/page/forum-etiquette"""
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue