Skip to content

Commit b91abcb

Browse files
committed
fix: user status not updated if new limit = 0
1 parent 5ace588 commit b91abcb

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/modules/users/users.service.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,15 @@ export class UsersService {
151151
let isNeedToBeAddedToNode =
152152
user.status !== USERS_STATUS.ACTIVE && status === USERS_STATUS.ACTIVE;
153153

154-
if (user.status === USERS_STATUS.LIMITED && trafficLimitBytes) {
155-
if (BigInt(trafficLimitBytes) > user.trafficLimitBytes) {
156-
newStatus = USERS_STATUS.ACTIVE;
157-
isNeedToBeAddedToNode = true;
154+
if (trafficLimitBytes !== undefined) {
155+
if (user.status === USERS_STATUS.LIMITED && trafficLimitBytes >= 0) {
156+
if (
157+
BigInt(trafficLimitBytes) > user.trafficLimitBytes ||
158+
trafficLimitBytes === 0
159+
) {
160+
newStatus = USERS_STATUS.ACTIVE;
161+
isNeedToBeAddedToNode = true;
162+
}
158163
}
159164
}
160165

0 commit comments

Comments
 (0)