Skip to content

Comments

fix(#1020): fix ooo accept/reject flow#1024

Merged
iamitprakash merged 8 commits intoRealDevSquad:developfrom
Hariom01010:fix/ooo-flow
Oct 27, 2025
Merged

fix(#1020): fix ooo accept/reject flow#1024
iamitprakash merged 8 commits intoRealDevSquad:developfrom
Hariom01010:fix/ooo-flow

Conversation

@Hariom01010
Copy link
Contributor

@Hariom01010 Hariom01010 commented Oct 11, 2025

Date: 11 Oct 2025

Developer Name: @Hariom01010


Issue Ticket Number

Description

  • Fixed the OOO request flow where still the old PUT method was being used to accept/reject the OOO request. Now the PATCH method is used and the payload send has been updated.
  • The new request card has been moved out of the feature flag and is now used to show the OOO requests
  • Date bug has been fixed where the until section in the request card showed the wrong date

Documentation Updated?

  • Yes
  • No

Under Feature Flag

  • Yes
  • No

Database Changes

  • Yes
  • No

Breaking Changes

  • Yes
  • No

Development Tested?

  • Yes
  • No

Screenshots

Screenshot 1
fix-ooo-flow.1.mp4

Test Coverage

Screenshot 1 image

Additional Notes

Description by Korbit AI

What change is being made?

Fix the OOO (out-of-office) accept/reject flow by updating the request card component, tests, and related utilities to correctly handle OOO requests, propagate an isOOORequest flag, and adjust UI/selectors and API interactions accordingly.

Why are these changes being made?

To ensure the OOO request lifecycle works end-to-end (approve/reject) with correct UI states, statuses, and data flow, and to align tests with the updated component behavior and endpoints. This also introduces consistent handling for OOO requests across development and production flows.

Is this description stale? Ask me to generate a new description by commenting /korbit-generate-pr-description

- update network request for approval and rejection of  OOO requests and updated payload for these
- fix bug for OOO request card where reason and comment were being
  rendered in each other's div
@Hariom01010 Hariom01010 requested review from AnujChhikara and RishiChaubey31 and removed request for AnujChhikara and RishiChaubey31 October 11, 2025 01:31
@coderabbitai
Copy link

coderabbitai bot commented Oct 11, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Summary by CodeRabbit

  • New Features
    • Added support for Out-of-Office requests with appropriate text and actions.
    • Introduced a Requests link in the interface for eligible users.
  • Improvements
    • Unified request cards use a consistent component, providing a more consistent look and behavior across request types.
    • Deadline dates now display in a consistent two-digit format for improved readability.
  • Refactor
    • Consolidated request card rendering into a single component for a smoother, more reliable experience.

Walkthrough

Introduces isOOORequest across request-card component and utilities, unifies requests page rendering to always use createRequestCardComponent, updates API routing and payloads for OOO via PATCH with dev=true, adjusts date formatting, adds REQUESTS_LINK constant and wiring for superuser visibility, and removes a legacy date formatting util.

Changes

Cohort / File(s) Summary of changes
Request card component
components/request-card/script.js
Added isOOORequest to createRequestCardComponent signature and propagated to text blocks, action container, and data prep; switched newDeadlineDays formatting to getTwoDigitDate(..., false).
Request card utilities
components/request-card/utils.js
Threaded isOOORequest through UI builders and status handlers; updateRequestStatus now branches to dev API endpoint and uses PATCH for OOO; buildRequestBody varies payload by request type and presence of remark; createTextBlockContainer and createActionContainer consume isOOORequest.
Requests page rendering
requests/script.js
Removed legacy DOM-based card builder and accept/reject handlers; renderRequestCards now always uses createRequestCardComponent, deriving isOOORequest from request.type.
Global constants and superuser UI
constants.js, script.js
Added REQUESTS_LINK constant; retrieved DOM element and included in showSuperUserOptions privateBtns.
Removed date util
requests/util.js
Deleted convertDateToReadableStringDate(date, format).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant SU as Superuser
  participant RP as Requests Page
  participant RC as createRequestCardComponent
  participant U as Request Card Utils
  participant API as Server API

  SU->>RP: Open Requests
  RP->>RP: fetch requests
  loop For each request
    RP->>RC: createRequestCardComponent({ isOOORequest })
    RC->>U: createTextBlockContainer(..., isOOORequest)
    RC->>U: createActionContainer(..., isOOORequest)
  end

  SU->>RC: Approve/Reject (optional remark)
  RC->>U: handleRequestStatusUpdate({ isOOORequest, ... })
  alt isOOORequest
    U->>U: buildRequestBody(OOO payload)
    U->>API: PATCH /requests/... ?dev=true
  else non-OOO
    U->>U: buildRequestBody(standard payload)
    U->>API: PUT/PATCH standard endpoint
  end
  API-->>U: Response
  U-->>RC: Update UI state/logs
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~55 minutes

Possibly related PRs

Suggested reviewers

  • AnujChhikara
  • RishiChaubey31
  • Achintya-Chatterjee
  • MayankBansal12
  • iamitprakash

Poem

Hopping through requests, I tap “Approve!” with glee,
A patchy breeze for OOO, dev=true—whee!
Old cards burrowed, new ones take the stage,
Dates trim neatly as I flip the page.
Superuser buttons blink—carrots well-earned!
Thump-thump: flows fixed, features returned. 🥕🐇

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Out of Scope Changes Check ⚠️ Warning The removal of the standalone date conversion utility and the addition of a new REQUESTS_LINK constant with corresponding superuser options in script.js are not described in issue #1020 and introduce UI and utility changes unrelated to fixing the OOO accept/reject flow. Please isolate the unrelated constant addition and utility removal into a separate refactor or update the issue to include these changes if they are intentional and relevant.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title clearly summarizes the primary change by indicating that the Out-Of-Office request accept/reject flow is being fixed and references the relevant issue number, making it concise and easily understood in history.
Linked Issues Check ✅ Passed The changes implement the required PATCH method for OOO acknowledgements, remove the dev flag from the request card and retrieval logic, propagate the isOOORequest flag for comment support, and fix the date mapping, thereby fulfilling all core requirements from issue #1020.
Description Check ✅ Passed The pull request description is directly related to the changeset and provides specific, meaningful information about the changes being made. The author describes three key modifications: (1) fixing the OOO request flow by changing from PUT to PATCH method and updating the payload, which is confirmed by the changes to updateRequestStatus and buildRequestBody functions in components/request-card/utils.js; (2) moving the new request card out of the feature flag to handle OOO requests, which is verified by the removal of the legacy createRequestCard function and unification of rendering through createRequestCardComponent in requests/script.js; and (3) fixing a date bug in the request card's "until" section, which is confirmed by the date formatting changes in components/request-card/script.js and the removal of convertDateToReadableStringDate in requests/util.js. The description is neither vague nor completely off-topic, and it accurately reflects the core objectives of the changeset.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@korbit-ai korbit-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review by Korbit AI

Korbit automatically attempts to detect when you fix issues in new commits.
Category Issue Status
Readability Redundant boolean conversion ▹ view ✅ Fix detected
Functionality Missing function definition ▹ view
Files scanned
File Path Reviewed
constants.js
requests/util.js
script.js
components/request-card/script.js
requests/script.js
components/request-card/utils.js

Explore our documentation to understand the languages and file types we support and the files we ignore.

Check out our docs on how you can make Korbit work best for you and your team.

Loving Korbit!? Share us on LinkedIn Reddit and X

@AnujChhikara
Copy link
Contributor

  • Can you please attach the test coverage screenshot also write test for your changes

@Hariom01010
Copy link
Contributor Author

  • Can you please attach the test coverage screenshot also write test for your changes

added test case for the request button we added on home page

Copy link
Member

@MayankBansal12 MayankBansal12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Hariom01010 kindly include the test coverage screenshot

@Hariom01010
Copy link
Contributor Author

@Hariom01010 kindly include the test coverage screenshot

added test coverage

Copy link
Member

@iamitprakash iamitprakash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

form design and button alignment doesn't looks good to me, can you please check how other popup is being displayed and designed

@iamitprakash iamitprakash merged commit f003021 into RealDevSquad:develop Oct 27, 2025
4 checks passed
@Hariom01010 Hariom01010 mentioned this pull request Oct 29, 2025
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix OOO request approval/rejection flow for superusers and remove dev flag from request card

4 participants