refer links induce inbox spam

This commit is contained in:
Thibault Duplessis 2016-02-01 13:32:46 +07:00
parent ca8004b86d
commit 31b076141a
2 changed files with 17 additions and 1 deletions

View file

@ -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}"

View 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="
)
}