Skip to content

Session availibilty toast - #1366

Merged
aks30 merged 3 commits into
developfrom
sessionAvailibiltyToast
Sep 25, 2025
Merged

aks30 merged 3 commits into
developfrom
sessionAvailibiltyToast

Conversation

@rakeshSgr

@rakeshSgr rakeshSgr commented Sep 24, 2025 •

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • Bug Fixes
    • Clarified the time-conflict message to: “You already have a session scheduled at this time,” improving clarity for users.
    • Ensured consistent, user-centric error messaging when creating or accepting sessions from requests, so the correct conflict message appears if the selected time is unavailable.

@coderabbitai

coderabbitai Bot commented Sep 24, 2025 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

A locale string was revised. A debug log was added to user detail retrieval. Session request acceptance now sets a sessionCreatedByRequest flag. Session creation logic allows mutable error message and, when the flag is present, returns a different error key for time-slot conflicts.

Changes

Cohort / File(s) Summary
Localization
src/locales/en.json
Updated INVALID_TIME_SELECTION_FOR_GIVEN_MENTOR message text to indicate the user already has a session at the selected time.
User requests logging
src/requests/user.js
Added console.log of profileUrl and userDetails in fetchUserDetails after retrieval; no functional changes.
Session requests handling
src/services/requestSessions.js
In accept(), adds bodyData.sessionCreatedByRequest: true when creating a session from a request.
Sessions service validation
src/services/sessions.js
Switched const to let for isSessionCreatedByManager and errorMessage. If bodyData.sessionCreatedByRequest is true, errorMessage becomes 'INVALID_TIME_SELECTION_FOR_GIVEN_MENTOR' on time-slot conflict.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User as Requester
  participant UI as Client/UI
  participant RS as requestSessions.accept()
  participant SS as sessions.create()
  participant TV as Time-slot Validator

  User->>UI: Accept session request
  UI->>RS: accept(requestId)
  RS->>SS: createSession({..., sessionCreatedByRequest: true})
  SS->>TV: validate(timeSlot, mentor, user)
  alt Slot unavailable
    TV-->>SS: conflict
    SS->>SS: if sessionCreatedByRequest => set errorKey = INVALID_TIME_SELECTION_FOR_GIVEN_MENTOR
    SS-->>RS: throw error(errorKey)
    RS-->>UI: surface errorKey
    UI-->>User: Show localized message
  else Slot available
    TV-->>SS: ok
    SS-->>RS: session created
    RS-->>UI: success
    UI-->>User: Confirmation
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

I twitch my whiskers at the new request flag,
A hop, a log, a localized tag.
When slots collide, the message is neat—
“You’ve booked this time,” a gentle beat.
I stamp my paw, then bound away,
Sessions aligned for another day. 🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "Session availibilty toast" concisely reflects the primary user-facing change in the diff—adjusting the session availability toast/message and related session-creation logic—so it summarizes the main change appropriately for a quick review.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

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.

@rakeshSgr

Copy link
Copy Markdown
Collaborator Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Sep 24, 2025

Copy link
Copy Markdown
✅ Actions performed

Full review triggered.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/services/requestSessions.js (1)

342-343: Drop the extra boolean passed to sessionService.create

The signature is create(bodyData, loggedInUserId, orgId, isAMentor, notifyUser) (src/services/sessions.js:67) but the call passes six args (src/services/requestSessions.js:346). Remove the trailing boolean (the second true) to match the signature and avoid confusion.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7b6fc8c and 49dd2d6.

📒 Files selected for processing (4)
  • src/locales/en.json (1 hunks)
  • src/requests/user.js (1 hunks)
  • src/services/requestSessions.js (1 hunks)
  • src/services/sessions.js (2 hunks)
🔇 Additional comments (2)
src/locales/en.json (1)

140-140: LGTM — clearer conflict message.

The revised copy is concise and user-friendly.

src/services/sessions.js (1)

163-170: LGTM — targeted error override for request-created sessions.

The conditional switch to INVALID_TIME_SELECTION_FOR_GIVEN_MENTOR is appropriate and keeps non-request flows unchanged.

Comment thread src/requests/user.js Resolved
Comment thread src/services/sessions.js Resolved
@aks30
aks30 merged commit 4217ae9 into develop Sep 25, 2025
1 of 2 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Oct 8, 2025
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.

2 participants