fix: implement support for 'too-many-requests' CantDo reason#530
fix: implement support for 'too-many-requests' CantDo reason#530Deepak8858 wants to merge 2 commits intoMostroP2P:mainfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughAdds support for the Changes
Sequence Diagram(s)sequenceDiagram
participant Server
participant Parser as CantDo.fromJson
participant Enum as CantDoReason
participant UI as NotificationMapper / MessageDetail
Server->>Parser: Send CantDo(reason: "too_many_requests")
Parser->>Enum: CantDoReason.fromString("too_many_requests")
Enum-->>Parser: tooManyRequests
Parser->>UI: Provide CantDo(reason: tooManyRequests)
UI->>UI: Map to S.of(context)!.tooManyRequests
UI-->>User: Show localized "too many requests" message
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@lib/data/models/enums/cant_do_reason.dart`:
- Around line 26-27: The CantDo enum now includes tooManyRequests but the switch
in the trade-detail display (in
lib/features/trades/widgets/mostro_message_detail_widget.dart) still falls
through to a generic message; update the switch that inspects the CantDo reason
(look for the switch or map handling code around the CantDo case in the widget
rendering function) to add an explicit case for CantDoReason.tooManyRequests and
return the appropriate user-facing message/Widget (e.g., explain rate limiting /
retry interval) instead of the generic fallback, preserving the existing pattern
used by other cases like pendingOrderExists.
In `@lib/l10n/intl_en.arb`:
- Line 4: Add the missing "tooManyRequests" localization key to
lib/l10n/intl_it.arb with the Italian translation for "You have exceeded the
allowed request rate. Please try again later." (use the same key
"tooManyRequests"), then run the Flutter localization build command `dart run
build_runner build -d` to regenerate the localization outputs so the new string
is included in the generated classes.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d15971a0-076f-4232-afb5-25c6a84e0ce7
📒 Files selected for processing (4)
lib/data/models/enums/cant_do_reason.dartlib/l10n/intl_en.arblib/l10n/intl_es.arblib/shared/widgets/notification_listener_widget.dart
Catrya
left a comment
There was a problem hiding this comment.
Hi @Deepak8858 wellcome! Please follow the suggestions provided by CodeRabbit. If you have any questions, please ask us.
|
I have addressed the feedback from CodeRabbit:
Note: I could not run locally, so I am relying on CI to regenerate the localization classes. |
|
I have verified the code against the suggestions. The explicit case for |
This PR implements support for the
too-many-requestsCantDo reason as documented in the protocol.\n\nChanges:\n- AddedtooManyRequestsvariant toCantDoReasonenum inlib/data/models/enums/cant_do_reason.dart\n- Added localized messages fortooManyRequestsinintl_en.arbandintl_es.arb\n- Added mapping fortoo_many_requestsinCantDoNotificationMapperinlib/shared/widgets/notification_listener_widget.dart\n\nFixes #528Summary by CodeRabbit