feat(transfers): Add ability to rename transfers from the drawer
Problem
A transfer's name cannot be currently changed. If the transfer is created manually, it just says "Transfer from"/"Payment to". But if it comes from a transaction, it gets the name of the original transaction, while the other leg says "Transfer from"/"Payment to", or the matching transaction.
What this changes
The transfer drawer now shows each leg's own name and lets a user with write access to
both endpoints rename them inline:
- The header shows
Transfer#display_name: the shared label when both legs are named
identically (the user or importer spoke of the transfer as one thing), otherwise a
contextual type ("Credit card payment", "Loan payment", "Investment contribution",
"Payment", "Transfer") so neither leg's name is passed off as the name for both. - Each leg's name sits inline next to its From/To row as a pencil-reveal text field that
looks like the row's value, not a boxed form input. Blurring submits via the existing
auto-submit controller; the turbo-stream response replaces both entry rows and the
drawer's name, so the list and the drawer stay in sync without a reload. Transfer#rename_entries!renames both legs atomically, strips whitespace, and returns
false when either name is blank — the controller turns that into an alert and changes
nothing. Only changed legs are written, and each renamed leg locks just its name via
lock_saved_attributes!so a later provider sync cannot overwrite the user's label,
without freezing unrelated provider enrichment.- Both names travel together: a request carrying only one name is treated as invalid
rather than silently leaving the other leg unchanged, and the permission check reuses
the samerequire_account_permission!flow as every other transfer mutation. The
rename fields are hidden for viewers without write access to both endpoints, so
read-only sharers never see a CTA the controller would reject.
Design system
The inline field is a new primitive, DS::InlineEdit, with a component preview: an
input styled as the row's value text with a pencil affordance on hover/focus, usable
inside any summary row (currently DS::DetailRow's value slot). The caller supplies the
accessible name, since the visible label usually lives in a sibling <dt>.
Validation
bin/rails test test/controllers/transfers_controller_test.rb test/models/transfer_test.rb
— 120 runs, 433 assertions, 0 failures, 0 errorsbin/rails test test/components/DS/inline_edit_test.rb— 3 runs, 7 assertions, 0 failuresbin/rails test test/system/transfers_test.rb— 3 runs, 14 assertions, 0 failuresrubocop/erb_linton all changed Ruby and ERB files — no offenses
The system test drives the real flow: open the drawer from the transaction list, fill
both name fields, blur to auto-submit, and assert both the drawer's name and the
transaction row update.
Notes
- No migration, no new valuation kind, no new dependency. Existing drawer markup moved
intotransfers/_overviewunchanged apart from the added name rows; the fee and
status behaviors are untouched.
Screenshots
Summary by cubic
Adds inline renaming of both transfer legs from the transfer drawer, so transfers created manually or from transactions can get meaningful labels.
- The drawer header shows the shared name when both legs match, otherwise a localized contextual label based on the destination account type.
- Users with write access to both accounts get a pencil-reveal inline field next to each leg's From/To row; blurring auto-submits and the Turbo Stream response updates both rows and the drawer name. Read-only viewers see each leg's name without the rename control.
Transfer#rename_entries!renames both legs atomically, strips whitespace, and raisesActiveRecord::RecordInvalidon blank names so the controller surfaces an alert; changed legs lock their names so provider syncs don't overwrite user labels.- Adds the
DS::InlineEditdesign-system primitive for inline-editable text values inDS::DetailRowsummary rows.
Summary by CodeRabbit
- New Features
- Added inline editing for transfer transaction names when both accounts are writable. Changes appear in the transfer view and transaction list.
- Transfer displays use a shared name when both transactions match, or a contextual, translated label when they differ.
- Transfer overviews show source and destination account details, including applicable fees and totals.
- Bug Fixes
- Blank names are rejected without changing either transaction. Updates that omit names leave existing names unchanged.
- Transaction names for accounts a viewer cannot access are not exposed in the transfer overview.