Skip to content

chore: added network and count of the transactions, separated reusabl…#2621

Open
Kolpic wants to merge 2 commits intomainfrom
2520-simplify-email-content
Open

chore: added network and count of the transactions, separated reusabl…#2621
Kolpic wants to merge 2 commits intomainfrom
2520-simplify-email-content

Conversation

@Kolpic
Copy link
Copy Markdown
Collaborator

@Kolpic Kolpic commented Apr 9, 2026

Fixes #2520

Description:

  • Recent feedback on the new email design suggests that listing individual transactions (especially in large numbers) is not very helpful, and including detailed data in emails may introduce security and privacy risks. Update notification emails to be simpler and more high-level, describing the type and meaning of the notification without embedding transaction details.

What changed:

  • The entire change is localized to the template layer under back-end/libs/common/src/templates/. Zero changes to the notification pipeline, the debounced batcher, NATS contracts, DTOs, database entities, the producer code in transactions.service.ts, or the additionalData payload. In-app notifications continue to receive exactly the same data they always did.

New files:

  • network.ts — a shared helper buildNetworkBreakdown(notifications) that groups notifications by additionalData.network, normalizes labels via the existing getNetworkString, and returns an HTML fragment like 3 transactions on Mainnet, 1 transaction on Testnet.
  • network.spec.ts — unit tests for the helper: empty input, missing networks, single-network with singular/plural, multi-network joining, sort order, mixed valid/invalid inputs.

Rewritten template files:

All six transaction-related templates were rewritten to:
Each rewritten template:

  • Builds a short, high-level sentence with a bolded count and the correct singular/plural noun — always including the count even when it is 1, so mixed cases (1 manual + 1 automatic, 1 success + 1 failure) are unambiguous.
  • Optionally renders a secondary paragraph containing the network breakdown, if any notifications carry a usable network.
  • Closes with a unified CTA: "View details in the Hedera Transaction Tool."
  • Templates that previously had a warning banner still render it.

Deletions in layout.ts:

  • Removed buildEmailTransactionsList (the old helper that rendered the per-transaction HTML table).
  • Removed the TransactionNotification interface (orphaned).
  • Kept emailCardTable, emailCardRow, emailWrapper, emailHeader, emailBody, emailFooter, emailWarning, emailReviewButton, escapeHtml, renderTransactionEmailLayout — still used by user-registered.ts, reset-password.ts, and the rewritten templates.

What the recipient sees:

  • Branded gradient header and footer (unchanged layout.ts wrappers)
  • One or two sentences describing what happened, with counts
  • One additional line showing which networks those transactions are on
  • A uniform call-to-action instructing them to open the app
  • Where applicable, the existing warning banner ("If this wasn't expected, please contact your administrator.")
image

…e logic

Signed-off-by: Kolpic <galincho112@gmail.com>
@Kolpic Kolpic added this to the v0.28.0 milestone Apr 9, 2026
@Kolpic Kolpic self-assigned this Apr 9, 2026
@Kolpic Kolpic added Feature Enhancement Enhancing an existing feature driven by business requirements. Typically backwards compatible. Backend labels Apr 9, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.95%. Comparing base (509bfd3) to head (6eeccc6).
⚠️ Report is 14 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2621   +/-   ##
=======================================
  Coverage   99.95%   99.95%           
=======================================
  Files         183      184    +1     
  Lines        7410     7446   +36     
  Branches     1478     1479    +1     
=======================================
+ Hits         7407     7443   +36     
  Misses          3        3           

see 6 files with indirect coverage changes

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Signed-off-by: Kolpic <galincho112@gmail.com>
@Kolpic Kolpic marked this pull request as ready for review April 10, 2026 08:07
@Kolpic Kolpic requested a review from a team as a code owner April 10, 2026 08:07
@Kolpic Kolpic requested a review from jbair06 April 10, 2026 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backend Feature Enhancement Enhancing an existing feature driven by business requirements. Typically backwards compatible.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Simplify email content and remove detailed transaction data

1 participant