don't notify kids about new blog posts

This commit is contained in:
Thibault Duplessis 2015-09-20 10:53:44 +02:00
parent fd96570599
commit c3d4c592e2
2 changed files with 4 additions and 3 deletions

View file

@ -18,7 +18,7 @@ private[blog] final class Notifier(
_ ?? { post =>
ThreadRepo.visibleByUserContainingExists(user = lichessUserId, containing = post.id) foreach {
case true => funit
case false => UserRepo recentlySeenIds DateTime.now.minusWeeks(2) foreach { userIds =>
case false => UserRepo recentlySeenNotKidIds DateTime.now.minusWeeks(2) foreach { userIds =>
(ThreadRepo reallyDeleteByCreatorId lichessUserId) >> {
val thread = makeThread(post)
val futures = userIds.toStream map { userId =>

View file

@ -281,10 +281,11 @@ trait UserRepo {
$update.fieldUnchecked(id, "seenAt", $date(DateTime.now))
}
def recentlySeenIds(since: DateTime) =
def recentlySeenNotKidIds(since: DateTime) =
$primitive(enabledSelect ++ Json.obj(
"seenAt" -> $gt($date(since)),
"count.game" -> $gt(4)
"count.game" -> $gt(4),
"kid" -> $ne(true)
), "_id")(_.asOpt[String])
def setLang(id: ID, lang: String) = $update.field(id, "lang", lang)