mirror of
https://github.com/ente-io/ente.git
synced 2025-08-08 07:28:26 +00:00
[server] Fix deviceLimit tracker
This commit is contained in:
parent
3392e39f7c
commit
29cf5b91a5
@ -126,9 +126,7 @@ func (m *AccessTokenMiddleware) isDeviceLimitReached(ctx context.Context,
|
||||
if network.IsCFWorkerIP(ip) {
|
||||
return false, nil
|
||||
}
|
||||
if collectionSummary.DeviceLimit <= 0 { // no device limit was added
|
||||
return false, nil
|
||||
}
|
||||
|
||||
sharedID := collectionSummary.ID
|
||||
hasAccessedInPast, err := m.PublicCollectionRepo.AccessedInPast(ctx, sharedID, ip, ua)
|
||||
if err != nil {
|
||||
@ -156,7 +154,7 @@ func (m *AccessTokenMiddleware) isDeviceLimitReached(ctx context.Context,
|
||||
}
|
||||
}
|
||||
|
||||
if count >= deviceLimit {
|
||||
if deviceLimit > 0 && count >= deviceLimit {
|
||||
return true, nil
|
||||
}
|
||||
err = m.PublicCollectionRepo.RecordAccessHistory(ctx, sharedID, ip, ua)
|
||||
|
Loading…
x
Reference in New Issue
Block a user