Skip to content

Bug: OOO Status Not Automatically Expired When No FutureStatus is Set #2550

@lakshayman

Description

@lakshayman

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" with from and until dates
  • 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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions