mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-05 20:57:28 +01:00
Exclude systme messages from rate limit
This commit is contained in:
parent
8eb3604caf
commit
77e53b914d
@ -275,12 +275,12 @@ class User(db.Model, UserMixin):
|
|||||||
|
|
||||||
one_min_ago = datetime.datetime.utcnow() - datetime.timedelta(minutes=1)
|
one_min_ago = datetime.datetime.utcnow() - datetime.timedelta(minutes=1)
|
||||||
if ThreadReply.query.filter_by(author=self) \
|
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
|
return False
|
||||||
|
|
||||||
hour_ago = datetime.datetime.utcnow() - datetime.timedelta(hours=1)
|
hour_ago = datetime.datetime.utcnow() - datetime.timedelta(hours=1)
|
||||||
if ThreadReply.query.filter_by(author=self) \
|
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 False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
Loading…
Reference in New Issue
Block a user