generated from RealDevSquad/website-template
-
Notifications
You must be signed in to change notification settings - Fork 280
Open
Description
Problem Description
The updateAllUserStatus() function does not automatically remove expired OOO (Out of Office) status when a user only has currentStatus set to OOO without a corresponding futureStatus.
Current Behavior
When a user sets their status to OOO directly (via PATCH /users/status/self), the system:
- Sets
currentStatus.state = "OOO"withfromanduntildates - Sets
futureStatus = {}(empty object)
When the OOO period expires (current date > until date):
- The
updateAllUserStatus()cron job does not process these users - The expired OOO status remains in the system
- User continues to show as OOO even after the period has ended
Expected Behavior
When an OOO period expires:
- The system should automatically transition the user to ACTIVE or IDLE status
- The expired OOO status should be removed
- This should happen automatically via the cron job, not requiring manual intervention
Root Cause
The updateAllUserStatus() function in models/userStatus.js only queries users with a futureStatus:
const userStatusDocs = await userStatusModel
.where("futureStatus.state", "in", ["ACTIVE", "IDLE", "OOO"])
.get();This means users with:
currentStatus.state = "OOO"(expired)futureStatus = {}(empty)
Are not included in the query and therefore never processed.
Metadata
Metadata
Assignees
Labels
No labels