Skip to content

Commit

Permalink
fix: make on_hold fields None when user is activate (#1444)
Browse files Browse the repository at this point in the history
  • Loading branch information
ImMohammad20000 authored Nov 21, 2024
1 parent 8b7ce3c commit 0503532
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions app/db/crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -814,9 +814,6 @@ def update_user_status(db: Session, dbuser: User, status: UserStatus) -> User:
Returns:
User: The updated user object.
"""
if dbuser.status == UserStatus.on_hold and status == UserStatus.active:
dbuser.on_hold_expire_duration = None
dbuser.on_hold_timeout = None
dbuser.status = status
dbuser.last_status_change = datetime.utcnow()
db.commit()
Expand Down Expand Up @@ -855,6 +852,8 @@ def start_user_expire(db: Session, dbuser: User) -> User:
"""
expire = int(datetime.utcnow().timestamp()) + dbuser.on_hold_expire_duration
dbuser.expire = expire
dbuser.on_hold_expire_duration = None
dbuser.on_hold_timeout = None
db.commit()
db.refresh(dbuser)
return dbuser
Expand Down

0 comments on commit 0503532

Please sign in to comment.