]> git.ipfire.org Git - ipfire.org.git/commitdiff
Toot once a day
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 11 May 2023 10:36:37 +0000 (10:36 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 28 Jun 2023 10:01:42 +0000 (10:01 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/backend/toots.py

index d434d6d9e2aade784ed82a0b75afcabd4e9ae555..271d4be3b928641838c4c7c06ae3b6bd056ef1ec 100644 (file)
@@ -11,11 +11,6 @@ class Toots(Object):
                """
                        Sends a random promotional toot
                """
-               # Do not toot too often
-               if self.has_had_recent_activity(days=3):
-                       logging.debug("Won't toot because we recently did it")
-                       return
-
                # Do not toot when there was a blog post
                if self.backend.blog.has_had_recent_activity(hours=24):
                        logging.debug("Won't toot because the blog has had activity")
@@ -31,17 +26,6 @@ class Toots(Object):
                with self.db.transaction():
                        self._toot(toot)
 
-       def has_had_recent_activity(self, **kwargs):
-               t = datetime.timedelta(**kwargs)
-
-               res = self.db.get("SELECT COUNT(*) AS count FROM toots \
-                       WHERE last_tooted_at IS NOT NULL AND last_tooted_at >= NOW() - %s", t)
-
-               if res and res.count > 0:
-                       return True
-
-               return False
-
        def _get_random_toot(self):
                res = self.db.get(
                        "WITH candidate_toots AS (SELECT id, \