Skip to content

fix: prevent wrong role text on canceled order detail screen#580

Merged
grunch merged 3 commits intomainfrom
fix-message-order-canceled
Apr 23, 2026
Merged

fix: prevent wrong role text on canceled order detail screen#580
grunch merged 3 commits intomainfrom
fix-message-order-canceled

Conversation

@Catrya
Copy link
Copy Markdown
Member

@Catrya Catrya commented Apr 21, 2026

fix #577

Summary by CodeRabbit

  • New Features
    • Trade detail titles now show a dedicated canceled-trade title that includes the trade amount, improving clarity when a trade is canceled without an associated session.
  • Chores
    • Updated localized title strings (EN, DE, ES, FR, IT) and adjusted placeholder spacing so amounts render consistently across languages.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 21, 2026

Warning

Rate limit exceeded

@Catrya has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 32 minutes and 3 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 32 minutes and 3 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6029c4ab-a307-4924-96ab-b33a31c36294

📥 Commits

Reviewing files that changed from the base of the PR and between 6d1ead8 and d42a465.

📒 Files selected for processing (2)
  • lib/features/order/screens/take_order_screen.dart
  • lib/shared/widgets/order_cards.dart

Walkthrough

Updated TradeDetailScreen title logic to detect trades canceled without a session and use a dedicated localized canceledTradeTitle(satAmount). Localization entries for canceledTradeTitle were added across multiple locales and some existing title strings had spacing/placeholder formatting adjusted.

Changes

Cohort / File(s) Summary
Trade Detail Screen Logic
lib/features/trades/screens/trade_detail_screen.dart
Added isCanceledWithoutSession derived condition; replaced inline title conditional with a precomputed titleText; pass canceledTradeTitle(satAmount) when canceled-without-session.
Localization — Added canceled title & placeholder formatting
lib/l10n/intl_en.arb, lib/l10n/intl_de.arb, lib/l10n/intl_es.arb, lib/l10n/intl_fr.arb, lib/l10n/intl_it.arb
Added canceledTradeTitle key in EN/DE/ES/FR/IT. Adjusted placeholder spacing/format for youAreSellingTitle and youAreBuyingTitle in DE/ES/IT to concatenate {sats} without an extra space; added placeholder metadata for IT entry.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • AndreaDiazCorreia
  • mostronator

Poem

🐰 I hopped through code with nimble delight,
Tuned titles that were showing the wrong sight.
Now canceled trades wear the proper name,
In five tongues they cheer — the rabbit's game! 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the primary fix: preventing incorrect role text on canceled order detail screens.
Linked Issues check ✅ Passed The PR addresses issue #577 by adding dedicated canceled trade title logic that displays the correct role text regardless of order type when status is canceled without a session.
Out of Scope Changes check ✅ Passed All changes are scoped to fixing the canceled order display issue: UI logic in TradeDetailScreen and localization strings for the new canceled trade title across all supported languages.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-message-order-canceled

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
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 6

🤖 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/l10n/intl_de.arb`:
- Line 289: Add a metadata block for the ARB key canceledTradeTitle that
declares its sats placeholder; specifically add an `@canceledTradeTitle` entry
with a placeholders object containing sats (e.g. "@canceledTradeTitle": {
"placeholders": { "sats": {} } }) so the ARB file properly documents the {sats}
variable used by canceledTradeTitle.

In `@lib/l10n/intl_en.arb`:
- Line 289: The new ARB key canceledTradeTitle is missing its required metadata
entry (`@canceledTradeTitle`) and must be added (including a description and
placeholders spec for {sats}); update intl_en.arb to add the `@canceledTradeTitle`
metadata object, then mirror the new key plus corresponding `@canceledTradeTitle`
metadata into intl_es.arb and intl_it.arb with appropriate translated values and
matching placeholder definitions so all three localization files remain
consistent.

In `@lib/l10n/intl_es.arb`:
- Line 655: The ES ARB is missing the metadata block for the
"canceledTradeTitle" key; add an `@canceledTradeTitle` metadata object matching
the IT file's metadata (description, type, and placeholders) so the placeholder
{sats} is documented—ensure the metadata includes a "description" explaining the
use, "type": "text", and a "placeholders" entry for "sats" (with any example or
content description) to mirror intl_it.arb and keep all three ARB files
consistent.
- Line 655: The localized string "canceledTradeTitle" currently contains a space
before the {sats} placeholder ("Intercambio de {sats} sats") which causes double
spaces when satAmount already includes a leading space; update the string to
remove that extra space (e.g., "Intercambio de{sats} sats") so interpolation
yields correct spacing for both empty and non-empty satAmount, and consider
applying the same fix to the related keys "youAreSellingTitle" and
"youAreBuyingTitle" for consistency.

In `@lib/l10n/intl_fr.arb`:
- Line 289: Add a placeholder metadata block for the canceledTradeTitle ARB key:
create an "@canceledTradeTitle" JSON object immediately after
"canceledTradeTitle" that declares the "sats" placeholder (e.g., under
"placeholders": {"sats": {"type": "int"}}) and, optionally, include a short
"description" explaining the placeholder; this matches the placeholder-based
convention used for other keys and keeps ARB files consistent.

In `@lib/l10n/intl_it.arb`:
- Line 713: The Italian messages include a literal space before the {sats}
placeholder which causes double spaces when satAmount already contains a leading
space or an empty result; update the three keys canceledTradeTitle,
youAreSellingTitle, and youAreBuyingTitle to remove the space before {sats}
(matching the EN pattern "Trade of{sats} sats") so the variable-provided spacing
logic controls spacing and avoids double/empty-space output.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 52229150-2401-48f7-b2ec-0d8737775cf4

📥 Commits

Reviewing files that changed from the base of the PR and between 38ed8ee and 3461c6b.

📒 Files selected for processing (6)
  • lib/features/trades/screens/trade_detail_screen.dart
  • lib/l10n/intl_de.arb
  • lib/l10n/intl_en.arb
  • lib/l10n/intl_es.arb
  • lib/l10n/intl_fr.arb
  • lib/l10n/intl_it.arb

Comment thread lib/l10n/intl_de.arb Outdated
Comment thread lib/l10n/intl_en.arb
Comment thread lib/l10n/intl_es.arb Outdated
Comment thread lib/l10n/intl_fr.arb
Comment thread lib/l10n/intl_it.arb Outdated
@Catrya
Copy link
Copy Markdown
Member Author

Catrya commented Apr 22, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 22, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Contributor

@mostronatorcoder mostronatorcoder Bot left a comment

Choose a reason for hiding this comment

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

🔴 Request Changes

1. Out-of-scope change — Commit d42a465c

The commit "fix: remove duplicate currency code in order amount display" modifies:

  • lib/features/order/screens/take_order_screen.dart (removes ${order.currency})
  • lib/shared/widgets/order_cards.dart (removes $currency)

This is not related to issue #577. The issue is about incorrect role text on canceled orders. The duplicate currency changes are a separate UI fix that should go in its own PR.

Action: Revert this commit from the branch or move it to a separate PR.


2. Main fix — Correct but with a caveat

Issue #577 reports: "When a buy order is canceled in status waiting-payment or waiting-buyer-invoice, it incorrectly displays to the seller: 'You are buying sats'".

Your fix detects session == null and shows a neutral title (canceledTradeTitle). This works when there is no session, but what if there IS a session (session != null) and the role is still wrong?

If bug #577 also occurs with a session present, this fix does not cover it. I recommend verifying with whoever reported #577 whether their specific case is session == null or if there is a deeper issue in session.role determination.

Not blocking — the fix is reasonable for the session == null case, but please document in the PR description that the scope is specifically canceled orders without an active session.


3. Double-space fix — Commit 6d1ead81

Confirmed correct. The code generates satAmount with a leading space:

final satAmount = hasFixedSatsAmount ? ' ${tradeState.order!.amount}' : '';

So 'Estás vendiendo{sats} sats' with satAmount = ' 10000' produces "Estás vendiendo 10000 sats" (one space). Before this commit there was a double space. This commit is correct.


4. Placeholder metadata inconsistency

canceledTradeTitle has @canceledTradeTitle (metadata) only in intl_it.arb, not in the other locale files. Please check whether this is the project pattern — if the other strings in en/de/es/fr do not have metadata for placeholders, then it is fine as-is. But if consistency is expected, either add metadata to all locales or remove it from it.


✅ What is good

  • The canceledTradeTitle fix is conceptually correct
  • All translations are present (5 languages)
  • No breaking changes in string API

Summary

Item Status
Commit 1 (role fix) ✅ Correct
Commit 2 (double space) ✅ Correct
Commit 3 (currency dup) 🔴 Out of scope — remove or split
Locale coverage ✅ Complete
Metadata consistency ⚠️ Review needed

Required action: Remove commit d42a465c from the branch.

@grunch grunch merged commit 8007b35 into main Apr 23, 2026
2 checks passed
@grunch grunch deleted the fix-message-order-canceled branch April 23, 2026 18:51
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.

When a buy order is canceled, it incorrectly displays to the seller: "You are buying."

2 participants