-
Notifications
You must be signed in to change notification settings - Fork 136
Added a release confirmation feature #723
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Added a release confirmation feature #723
Conversation
WalkthroughAdds a two-step release confirmation flow: a new exported message builder that shows order details and confirm/cancel buttons, inline callback handlers for show/confirm/cancel release added to the bot start file (duplicated in two locations), and localization strings updated across multiple locale files. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
bot/start.ts (1)
909-955: Both/release <id>command and/^release_<id>$/action still bypass confirmationThe new confirmation flow works correctly when using
/releasewithout parameters (routes throughshowConfirmationButtons→show_release_confirmation_<id>). However, two bypasses remain:
- Direct command with ID: A user can type
/release <order_id>to execute the release immediately without confirmation (line 323 in start.ts directly callsrelease()).- Action handler: The
/^release_([0-9a-f]{24})$/handler at line 910 still bypasses confirmation, though currently no UI buttons trigger it.Fix both by:
- Route the
/release <id>command path to the confirmation screen (when orderId is provided at line 323)- Route the
/^release_([0-9a-f]{24})$/action toshowReleaseConfirmationMessageinstead of directly callingrelease()All required i18n keys (
release_confirmation_message,release_confirm_button,release_cancel_button,release_operation_cancelled) are present in all locale files.
🤖 Fix all issues with AI agents
In @locales/es.yaml:
- Around line 514-528: Translate the English label "Order ID" into Spanish in
the release_confirmation_message and remove the hardcoded "@" before
${counterparty} to avoid producing a double-@; update the tap_release,
release_confirmation_message, release_confirm_button and related keys so the
copy is fully Spanish (e.g., "ID de orden" or similar) and leave ${counterparty}
un-prefixed so the caller/templating layer can decide whether to include an @.
Ensure the change is applied to the release_confirmation_message string only and
keep placeholders (${orderId}, ${counterparty}, ${amount}, ${fiatAmount},
${fiatCode}) intact.
In @locales/fa.yaml:
- Around line 513-527: Update the wording to convey "about to release" rather
than an action already in progress by changing the tap_release and the opening
line of release_confirmation_message: replace the current tap_release value with
a Persian phrase like "برای آزادسازی وجه، سفارش را انتخاب کنید؛ قبل از ادامه
تأییدی مشاهده خواهید کرد." and change the first sentence of
release_confirmation_message from "شما در حال آزاد کردن سفارش زیر هستید:" to
"شما در آستانه آزاد کردن سفارش زیر هستید:" (leave the rest of
release_confirmation_message, release_confirm_button, release_cancel_button, and
release_operation_cancelled intact).
🧹 Nitpick comments (2)
bot/start.ts (1)
50-64: Avoid redundant imports from the same module
You import bothshowReleaseConfirmationMessageand* as messagesfrom./messages. Prefer one style for consistency (e.g.,messages.showReleaseConfirmationMessage).bot/messages.ts (1)
2031-2033: Consider addingparse_modefor message formatting.Other similar functions in this file use
parse_mode: 'Markdown'orparse_mode: 'MarkdownV2'when sending messages. If therelease_confirmation_messagelocale string contains Markdown formatting (which it does in several locales), the message may not render correctly without specifying the parse mode.Suggested fix
await ctx.reply(message, { reply_markup: { inline_keyboard: inlineKeyboard }, + parse_mode: 'Markdown', });
📜 Review details
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (12)
bot/messages.tsbot/start.tslocales/de.yamllocales/en.yamllocales/es.yamllocales/fa.yamllocales/fr.yamllocales/it.yamllocales/ko.yamllocales/pt.yamllocales/ru.yamllocales/uk.yaml
🧰 Additional context used
📓 Path-based instructions (3)
{bot/**,locales/**}
📄 CodeRabbit inference engine (AGENTS.md)
House commands, scenes, and middleware modules in
bot/directory and pair new flows with text updates underlocales/
Files:
locales/ru.yamllocales/fa.yamllocales/uk.yamllocales/pt.yamllocales/fr.yamllocales/ko.yamllocales/it.yamllocales/es.yamllocales/de.yamllocales/en.yamlbot/start.tsbot/messages.ts
**/*.{ts,tsx,js,jsx,json}
📄 CodeRabbit inference engine (AGENTS.md)
Enforce Prettier formatting with 2-space indentation, semicolons, and single quotes; run before committing
Files:
bot/start.tsbot/messages.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx,js,jsx}: Use ESLint Standard plus TypeScript rules to guard the codebase; address warnings instead of disabling them
Use camelCase for functions and variables
Use PascalCase for class names
Files:
bot/start.tsbot/messages.ts
🧠 Learnings (8)
📚 Learning: 2026-01-02T12:48:28.393Z
Learnt from: CR
Repo: lnp2pBot/bot PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-02T12:48:28.393Z
Learning: Applies to src/bot/**/*.{ts,tsx} : Use custom context types extending Telegraf's base context (MainContext and CommunityContext) for bot command handlers and message processing
Applied to files:
bot/start.tsbot/messages.ts
📚 Learning: 2026-01-02T12:48:44.329Z
Learnt from: CR
Repo: lnp2pBot/bot PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-02T12:48:44.329Z
Learning: Applies to {bot/**,locales/**} : House commands, scenes, and middleware modules in `bot/` directory and pair new flows with text updates under `locales/`
Applied to files:
bot/start.ts
📚 Learning: 2026-01-02T12:48:28.393Z
Learnt from: CR
Repo: lnp2pBot/bot PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-02T12:48:28.393Z
Learning: Applies to src/ln/**/*.ts : Implement Lightning Network hold invoice pattern: Seller creates order → Buyer takes order → Seller pays hold invoice → Funds held until parties confirm fiat exchange → Hold invoice settled or canceled
Applied to files:
bot/start.ts
📚 Learning: 2026-01-02T12:48:28.393Z
Learnt from: CR
Repo: lnp2pBot/bot PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-02T12:48:28.393Z
Learning: Applies to src/bot/middleware/**/*.ts : Apply middleware chain in this order: User validation → Admin checking → Context enhancement → Command routing
Applied to files:
bot/start.ts
📚 Learning: 2026-01-02T12:48:28.393Z
Learnt from: CR
Repo: lnp2pBot/bot PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-02T12:48:28.393Z
Learning: Applies to src/bot/**/messages.ts : Use i18n for message templates with YAML localization files for 10 supported languages and store user-specific language preferences in database
Applied to files:
bot/messages.ts
📚 Learning: 2026-01-02T12:48:44.329Z
Learnt from: CR
Repo: lnp2pBot/bot PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-02T12:48:44.329Z
Learning: Applies to app.ts : Keep Telegram bot bootstrap and Mongo connection logic centralized in `app.ts`
Applied to files:
bot/messages.ts
📚 Learning: 2026-01-02T12:48:28.394Z
Learnt from: CR
Repo: lnp2pBot/bot PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-02T12:48:28.394Z
Learning: Applies to src/models/User.ts : Store user-specific language preferences in the database and enable dynamic language switching with grammyjs/i18n
Applied to files:
bot/messages.ts
📚 Learning: 2026-01-02T12:48:28.393Z
Learnt from: CR
Repo: lnp2pBot/bot PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-02T12:48:28.393Z
Learning: Applies to src/models/Order.ts : Implement order status lifecycle transitions: PENDING → ACTIVE → FIAT_SENT → COMPLETED, with dispute states (DISPUTE, CANCELED_BY_ADMIN) and failed states (EXPIRED, CANCELED)
Applied to files:
bot/messages.ts
🧬 Code graph analysis (5)
locales/ru.yaml (3)
bot/modules/orders/messages.ts (1)
i18n(57-85)bot/ordersActions.ts (1)
i18n(190-269)bot/commands.ts (1)
ctx(806-839)
locales/uk.yaml (2)
bot/modules/orders/scenes.ts (3)
fiatAmount(136-146)currency(110-135)fiatAmount(247-250)bot/scenes.ts (1)
ctx(204-236)
locales/fr.yaml (1)
bot/modules/orders/messages.ts (1)
i18n(57-85)
bot/start.ts (4)
bot/middleware/user.ts (1)
userMiddleware(9-19)bot/modules/community/communityContext.ts (1)
CommunityContext(18-22)bot/messages.ts (1)
showReleaseConfirmationMessage(2153-2153)bot/commands.ts (1)
release(885-885)
bot/messages.ts (2)
bot/start.ts (1)
MainContext(79-84)models/index.ts (2)
Order(9-9)User(9-9)
🔇 Additional comments (10)
locales/uk.yaml (1)
510-524: Release confirmation strings look consistent and well-structured
Placeholders and the warning/CTA read correctly for the new flow.locales/en.yaml (1)
519-533: English confirmation flow strings look correct and consistent
Keys and placeholders match the intended confirm/cancel UX.locales/ru.yaml (1)
513-527: RU confirmation strings are consistent with the new flow
No issues in the added confirmation block/keys.locales/fr.yaml (1)
512-526: FR confirmation strings look good
Clear warning + confirm/cancel labels; placeholders align with expected variables.bot/messages.ts (2)
1975-1978: LGTM!The conditional routing for release commands to the confirmation flow is cleanly implemented and follows the existing pattern.
21-21: LGTM!The import of Order and User models is appropriate for the new database lookups in
showReleaseConfirmationMessage.locales/it.yaml (1)
510-524: LGTM!The Italian translations for the release confirmation flow are complete and use the correct placeholders (
${orderId},${counterparty},${amount},${fiatAmount},${fiatCode}) that match the parameters passed inshowReleaseConfirmationMessage.locales/pt.yaml (1)
512-526: LGTM!The Portuguese translations for the release confirmation flow are complete and consistent with the other locale files.
locales/ko.yaml (1)
510-524: LGTM!The Korean translations for the release confirmation flow are complete and properly localized.
locales/de.yaml (1)
513-527: LGTM!The German translations for the release confirmation flow are complete and maintain consistent formal language ("Sie") used throughout the file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
locales/ru.yaml (1)
528-533: Untranslated strings in Russian locale.The earnings-related keys (
earnings,withdraw_earnings,invoice_expired_earnings) remain in English while the release confirmation flow has been properly translated to Russian. For consistency, these should be translated.Suggested Russian translations
-earnings: Earnings -premium: Premium -discount: Discount -premium_discount: premium/discount -withdraw_earnings: Withdraw earnings -invoice_expired_earnings: The invoice has expired, resubmit a withdrawal request with a new invoice. +earnings: Доход +premium: Премия +discount: Скидка +premium_discount: премия/скидка +withdraw_earnings: Вывести доход +invoice_expired_earnings: Срок действия счета истек, повторите запрос на вывод с новым счетом.
This is ouside of the scope of this PR. |
Summary by CodeRabbit
New Features
Localization
✏️ Tip: You can customize this high-level summary in your review settings.