Exclude systme messages from rate limit

This commit is contained in:
rubenwardy 2024-01-10 00:49:34 +00:00
parent 8eb3604caf
commit 77e53b914d

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