Skip to content

fix: show sats amount on fixed orders#852

Open
Catrya wants to merge 1 commit into
mainfrom
fix-show-sats-amount-fixed-order
Open

fix: show sats amount on fixed orders#852
Catrya wants to merge 1 commit into
mainfrom
fix-show-sats-amount-fixed-order

Conversation

@Catrya

@Catrya Catrya commented Jul 1, 2026

Copy link
Copy Markdown
Member

PR #770 moved the order title into a single i18n string and dropped the sats amount, so fixed orders showed "Selling sats" instead of "Selling 100 sats".

Restores the amount via a ${amount} placeholder in the locale keys (all languages) and computes it in getOrderTitleMessage: shown for fixed orders, omitted for market/range orders.

Summary by CodeRabbit

  • New Features
    • Order status messages now show the satoshi amount alongside buy/sell activity.
    • User-specific order messages were updated to include both the username and amount.
    • The amount display now adapts based on the order’s pricing details.
  • Localization
    • Updated translated messages across multiple languages so buy/sell notifications consistently include the amount.

@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The order title message generation in bot/ordersActions.ts was updated to pass amount, fiatCode, and priceFromAPI into getOrderTitleMessage, which now conditionally builds an amount text and includes it in translation calls. Corresponding locale files across ten languages were updated to interpolate ${amount} into selling/buying and username-display messages.

Changes

Amount-aware order title messages

Layer / File(s) Summary
Order title logic
bot/ordersActions.ts
buildDescription now passes amount, fiatCode, and priceFromAPI to getOrderTitleMessage, which computes an amountText (omitted when priceFromAPI is true) and includes it in both show_username and non-show_username translation calls.
Locale string updates
locales/de.yaml, locales/en.yaml, locales/es.yaml, locales/fa.yaml, locales/fr.yaml, locales/it.yaml, locales/ko.yaml, locales/pt.yaml, locales/ru.yaml, locales/uk.yaml
selling_sats, buying_sats, showusername_buying_sats, and showusername_selling_sats keys updated to interpolate ${amount} in place of the previous generic "sats" wording.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related issues

Possibly related PRs

  • lnp2pBot/bot#770: Both PRs modify buildDescription/getOrderTitleMessage in bot/ordersActions.ts and the corresponding showusername_*_sats locale keys; this PR extends those same messages by interpolating ${amount}.

Suggested reviewers: Luquitasjeffrey, grunch, mostronatorcoder

Poem

A rabbit counts each sat with glee,
No more vague "sats" for you and me!
Now amounts hop right into view,
In German, French, Korean too. 🐇
Buying, selling, all made clear—
Hop along, the numbers here! 🥕

🚥 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 clearly matches the main change: restoring sats amounts in fixed order titles.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-show-sats-amount-fixed-order

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.

@Catrya Catrya requested review from Luquitasjeffrey and grunch July 1, 2026 22:44

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
bot/ordersActions.ts (1)

286-288: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Whitespace baked into interpolated value is fragile.

amountText embeds a trailing space (`${numberFormat(fiatCode, amount)} `) so that locale strings like 'Selling ${amount}sats' render correctly. This couples the JS logic to an undocumented assumption about every locale template's spacing (no space before sats/equivalent). A future locale edit that adds a space before the placeholder will silently produce a double space.

Consider keeping amountText as just the formatted number (or empty) and letting each locale template own the spacing, e.g. ${amount} sats with a conditional/trim, or exposing a separate hasAmount flag to the templates.

♻️ Possible approach
-  const amountText = priceFromAPI ? '' : `${numberFormat(fiatCode, amount)} `;
+  const amountText = priceFromAPI ? '' : `${numberFormat(fiatCode, amount)}`;

Then update locale strings to 'Selling ${amount} sats' and have market/range variants use a dedicated string without the amount placeholder, instead of relying on an empty interpolated value.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@bot/ordersActions.ts` around lines 286 - 288, The spacing for order amount
rendering is currently baked into `amountText` in `ordersActions.ts`, which
makes locale templates fragile. Update the `amountText` handling in the order
formatting logic so it only returns the formatted number or an empty string, and
move spacing decisions into the locale strings used by the sell/order templates.
Adjust the relevant template entries and any callers in the order action flow so
fixed orders and market/range orders render correctly without relying on a
trailing space inside `amountText`.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@bot/ordersActions.ts`:
- Around line 286-288: The spacing for order amount rendering is currently baked
into `amountText` in `ordersActions.ts`, which makes locale templates fragile.
Update the `amountText` handling in the order formatting logic so it only
returns the formatted number or an empty string, and move spacing decisions into
the locale strings used by the sell/order templates. Adjust the relevant
template entries and any callers in the order action flow so fixed orders and
market/range orders render correctly without relying on a trailing space inside
`amountText`.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 672a802a-ca1c-40ff-83de-daf963947d86

📥 Commits

Reviewing files that changed from the base of the PR and between fea5d84 and 9041ba3.

📒 Files selected for processing (11)
  • bot/ordersActions.ts
  • locales/de.yaml
  • locales/en.yaml
  • locales/es.yaml
  • locales/fa.yaml
  • locales/fr.yaml
  • locales/it.yaml
  • locales/ko.yaml
  • locales/pt.yaml
  • locales/ru.yaml
  • locales/uk.yaml

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.

1 participant