Browse Source

Swap daily/hourly cutoff timedelta for floodprotection middleware (#1377)

Co-authored-by: James Neyer <jamesneyer@Jamess-MBP.lan>
James Neyer 3 years ago
parent
commit
1a739a40fa
1 changed files with 2 additions and 2 deletions
  1. 2 2
      misago/threads/api/postingendpoint/floodprotection.py

+ 2 - 2
misago/threads/api/postingendpoint/floodprotection.py

@@ -29,14 +29,14 @@ class FloodProtectionMiddleware(PostingMiddleware):
         self.user.update_fields.append("last_posted_on")
         self.user.update_fields.append("last_posted_on")
 
 
         if self.settings.hourly_post_limit:
         if self.settings.hourly_post_limit:
-            cutoff = now - timedelta(hours=24)
+            cutoff = now - timedelta(hours=1)
             if self.is_limit_exceeded(cutoff, self.settings.hourly_post_limit):
             if self.is_limit_exceeded(cutoff, self.settings.hourly_post_limit):
                 raise PostingInterrupt(
                 raise PostingInterrupt(
                     _("Your account has exceed an hourly post limit.")
                     _("Your account has exceed an hourly post limit.")
                 )
                 )
 
 
         if self.settings.daily_post_limit:
         if self.settings.daily_post_limit:
-            cutoff = now - timedelta(hours=1)
+            cutoff = now - timedelta(hours=24)
             if self.is_limit_exceeded(cutoff, self.settings.daily_post_limit):
             if self.is_limit_exceeded(cutoff, self.settings.daily_post_limit):
                 raise PostingInterrupt(_("Your account has exceed a daily post limit."))
                 raise PostingInterrupt(_("Your account has exceed a daily post limit."))