r
This commit is contained in:
@@ -143,24 +143,24 @@ func updateUserHistoryCount(userID string) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
u.count++
|
usersHistoryCount[userID].count++
|
||||||
|
|
||||||
if now.Before(u.bannedUntilAt) {
|
if now.Before(u.bannedUntilAt) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if !u.bannedUntilAt.IsZero() {
|
if !u.bannedUntilAt.IsZero() {
|
||||||
u.bannedUntilAt = time.Time{}
|
usersHistoryCount[userID].bannedUntilAt = time.Time{}
|
||||||
}
|
}
|
||||||
|
|
||||||
if u.date.Add(SPAM_PERIOD).After(now) {
|
if u.date.Add(SPAM_PERIOD).After(now) {
|
||||||
u.count = 1
|
usersHistoryCount[userID].count = 1
|
||||||
u.date = now
|
usersHistoryCount[userID].date = now
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if u.count > 5 {
|
if u.count > 5 {
|
||||||
u.bannedUntilAt = now.Add(2 * time.Minute)
|
usersHistoryCount[userID].bannedUntilAt = now.Add(2 * time.Minute)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user