refer links induce inbox spam
This commit is contained in:
parent
ca8004b86d
commit
31b076141a
|
@ -50,7 +50,7 @@ final class Api(
|
|||
text = data.text,
|
||||
creatorId = me.id,
|
||||
invitedId = data.user.id) |> { t =>
|
||||
val thread = me.troll.fold(t deleteFor invited, t)
|
||||
val thread = Automute(s"${data.subject} ${data.text}", me).fold(t deleteFor invited, t)
|
||||
sendUnlessBlocked(thread, fromMod) >>-
|
||||
updateUser(invited) >>- {
|
||||
val text = s"${data.subject} ${data.text}"
|
||||
|
|
16
modules/message/src/main/Automute.scala
Normal file
16
modules/message/src/main/Automute.scala
Normal file
|
@ -0,0 +1,16 @@
|
|||
package lila.message
|
||||
|
||||
private object Automute {
|
||||
|
||||
def apply(text: String, by: lila.user.User) = by.troll || scan(text)
|
||||
|
||||
private def scan(text: String) = blacklist exists text.contains
|
||||
|
||||
private val blacklist = List(
|
||||
/* While links to other chess websites are welcome,
|
||||
* refer links grant the referrer money,
|
||||
* effectively inducing spam */
|
||||
"velocitychess.com/ref/",
|
||||
"chess24.com?ref="
|
||||
)
|
||||
}
|
Loading…
Reference in a new issue