fix: use maker's language when republishing order on buyer cancel - #821
Conversation
WalkthroughThe ChangesInvoice Cancellation i18n Context
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
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)
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.
Code Review Summary
Verdict: Approved
I reviewed only the changes in scope for this PR (bot/commands.ts). The fix is narrow, matches the existing seller-cancel pattern, and I did not find blocking issues.
Notes
- The republish branch now uses the maker's i18n context for both buy and sell orders.
- This keeps the button text aligned with the order owner's language instead of the canceling user's language.
There was a problem hiding this comment.
Reviewed on current head d3c4fea. The fix is narrow and does what it claims: when cancelAddInvoice republishes the order, it now rebuilds the message with the maker's own i18n context instead of reusing the buyer-side context for both branches. I re-checked the PR comments/reviews and did not find unresolved blocking feedback on the current head.
fix: use maker's language when republishing order on buyer cancel
Closes #820
Problem
When a taker with a different language setting cancels an order (causing it to be republished as
PENDING), the "Buy SAT" / "Sell SAT" button was rendered in the taker's language instead of the maker's language. This made thebutton inconsistent with the rest of the order content, which was already displayed in the maker's language.
Root Cause
In
cancelAddInvoice(bot/commands.ts), the republish branch was passingi18nCtx(derived from the calling user, i.e. the taker) to bothpublishBuyOrderMessageandpublishSellOrderMessage. The seller-cancel handler alreadyhandled this correctly by using
i18nCtxBuyer/i18nCtxSellerbased on order type, but the buyer-cancel side never picked up the same pattern.Fix
cancelAddInvoicenow mirrors the seller-cancel pattern:i18nCtxBuyerfrombuyerUserand passes it topublishBuyOrderMessage.i18nCtxSellerfromsellerUserand passes it topublishSellOrderMessage.This ensures the button text always matches the maker's configured language, regardless of who takes or cancels the order.
Affected file
bot/commands.ts—cancelAddInvoicefunction, republish branch (~line 372)Summary by CodeRabbit