From 77e53b914d3a264f591af68216c891d8ad448500 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Wed, 10 Jan 2024 00:49:34 +0000 Subject: [PATCH] Exclude systme messages from rate limit --- app/models/users.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/users.py b/app/models/users.py index e726118f..e6d73696 100644 --- a/app/models/users.py +++ b/app/models/users.py @@ -275,12 +275,12 @@ class User(db.Model, UserMixin): one_min_ago = datetime.datetime.utcnow() - datetime.timedelta(minutes=1) if ThreadReply.query.filter_by(author=self) \ - .filter(ThreadReply.created_at > one_min_ago).count() >= 2 * factor: + .filter(ThreadReply.created_at > one_min_ago, ThreadReply.is_status_update == False).count() >= 2 * factor: return False hour_ago = datetime.datetime.utcnow() - datetime.timedelta(hours=1) if ThreadReply.query.filter_by(author=self) \ - .filter(ThreadReply.created_at > hour_ago).count() >= 10 * factor: + .filter(ThreadReply.created_at > hour_ago, ThreadReply.is_status_update == False).count() >= 10 * factor: return False return True