The personal finance app for everyone (by everyone)
Ruby
feat(transactions): auto-generate transaction name from merchant/category (opt-in) (#3378)
GFRbc02ce5594fc
diff --git a/app/components/DS/category_select.html.erb b/app/components/DS/category_select.html.erbindex 7413698605..5a7f0e260c 100644--- a/app/components/DS/category_select.html.erb+++ b/app/components/DS/category_select.html.erb@@ -45,6 +45,7 @@name="<%= field_name %>"value="<%= selected_id %>"data-category-select-target="hiddenInput"+ data-action="change->transaction-name-preview#update"<%= "disabled" if disabled %>><% unless disabled %>diff --git a/app/components/DS/merchant_select.html.erb b/app/components/DS/merchant_select.html.erbindex 7a6c2b4ca0..776428de9d 100644--- a/app/components/DS/merchant_select.html.erb+++ b/app/components/DS/merchant_select.html.erb@@ -40,6 +40,7 @@name="<%= field_name %>"value="<%= selected_id %>"data-merchant-select-target="hiddenInput"+ data-action="change->transaction-name-preview#update"<%= "disabled" if disabled %>><% unless disabled %>diff --git a/app/controllers/recurring_transactions/smart_fills_controller.rb b/app/controllers/recurring_transactions/smart_fills_controller.rbindex c0e63e4d04..212463e194 100644--- a/app/controllers/recurring_transactions/smart_fills_controller.rb+++ b/app/controllers/recurring_transactions/smart_fills_controller.rb@@ -47,7 +47,13 @@ class RecurringTransactions::SmartFillsController < RecurringTransactionsControlprivate# The picked entry's own history: same account, same sign, same name# shape. Recency-ordered so drifting amounts weight toward the present.+ # Skipped entirely for a generic name (e.g. the auto-generated "Unknown+ # transaction" fallback) -- an ILIKE on that text would pull in every+ # other unrelated transaction that happens to share the same generic+ # label, corrupting the evidence fed to the AI suggester.def evidence_entries(entry, income:)+ return [ entry ] if entry.generic_name?+pattern = "%#{ActiveRecord::Base.sanitize_sql_like(entry.name.to_s)}%"entry.account.entriesdiff --git a/app/controllers/settings/appearances_controller.rb b/app/controllers/settings/appearances_controller.rbindex e208c76acf..ce6ed26206 100644--- a/app/controllers/settings/appearances_controller.rb+++ b/app/controllers/settings/appearances_controller.rb@@ -33,6 +33,15 @@ class Settings::AppearancesController < ApplicationControlleraccount_order = params.dig(:user, :default_account_order)@user.default_account_order = account_order if AccountOrder::ORDERS.key?(account_order.to_s)end++ # Family-wide (not a per-user preference, unlike the toggles above): it+ # controls what gets written to shared transaction data regardless of+ # which family member is logged in, so only an admin may change it --+ # same restriction as the other family-level settings in UsersController.+ if @user.admin? && params.dig(:family, :auto_generate_transaction_names)+ Current.family.update!(auto_generate_transaction_names: params.dig(:family, :auto_generate_transaction_names) == "1")+ end+redirect_to settings_appearance_pathendenddiff --git a/app/controllers/transactions_controller.rb b/app/controllers/transactions_controller.rbindex 67ab63c29a..5925b14812 100644--- a/app/controllers/transactions_controller.rb+++ b/app/controllers/transactions_controller.rb@@ -135,6 +135,7 @@ class TransactionsController < ApplicationControllerif account.nil?@entry = Current.family.entries.new(entry_params)@entry.valid?+ clear_stale_auto_generated_name!(@entry)set_new_transaction_form_optionsrender :new, status: :unprocessable_entityreturn@@ -164,6 +165,7 @@ class TransactionsController < ApplicationControllerrespond_with_created_entry(@entry)else+ clear_stale_auto_generated_name!(@entry)set_new_transaction_form_optionsrender :new, status: :unprocessable_entityend@@ -687,6 +689,16 @@ class TransactionsController < ApplicationControllerset_entryend+ # Entry#set_default_name may have already filled in a category/merchant+ # -derived name during this failed validation attempt. A blank+ # submission must still render blank -- otherwise the generated text+ # becomes the field's literal value, and if the user then changes the+ # category/merchant and resubmits, that stale generated name (no longer+ # blank) skips the callback entirely and gets saved as-is.+ def clear_stale_auto_generated_name!(entry)+ entry.name = "" if entry_params[:name].blank?+ end+def set_new_transaction_form_optionsaccessible_accounts_scope = accessible_accounts@@ -700,6 +712,42 @@ class TransactionsController < ApplicationController@categories = Current.family.categories.alphabetically_by_hierarchy.to_a@merchants = Current.family.available_merchants_for(Current.user).alphabetically.to_a@tags = Current.family.tags.alphabetically.to_a+ @recent_transaction_names = recent_transaction_names+ end++ # Autocomplete suggestions for the name field, only queried when the+ # auto-generate setting is on: lets a user reuse an actual previous name+ # instead of leaving the field blank (which would produce a generic+ # fallback), the same way it curbs bulk-identical generated names.+ def recent_transaction_names+ return [] unless Current.family.auto_generate_transaction_names?++ # Current.accessible_entries (not Entry.family_scope), so a non-admin+ # family member never sees names from accounts that weren't shared+ # with them -- family-wide settings still respect per-account sharing.+ # Its underlying Account.accessible_by scope is itself a `.distinct`+ # query, so ORDER BY created_at must stay in the pluck'd column list+ # (a plain "pluck(:name)" here would hit Postgres's "SELECT DISTINCT+ # ... ORDER BY expressions must appear in select list"); dedup by name+ # happens in Ruby afterward instead.+ #+ # Checked across every supported locale (like Entry#generic_name?'s+ # unknown-name check), not just the current one -- otherwise an old+ # entry named under a different locale's fallback (e.g. "Unbekannte+ # Transaktion") would still surface as a "recent name" suggestion. A+ # full generic_name? reuse isn't practical here since it also needs a+ # loaded entryable.category, which isn't available cheaply from a pluck.+ unknown_names = LanguagesHelper::SUPPORTED_LOCALES.map { |locale| I18n.t("transactions.unknown_name", locale: locale) }++ Current.accessible_entries+ .where(entryable_type: "Transaction")+ .where.not(name: unknown_names)+ .order(created_at: :desc)+ .limit(200)+ .pluck(:name, :created_at)+ .map(&:first)+ .uniq+ .first(20)end# Filters entry_params based on the user's permission on the account.diff --git a/app/javascript/controllers/category_select_controller.js b/app/javascript/controllers/category_select_controller.jsindex 1485762268..28fc4e5a13 100644--- a/app/javascript/controllers/category_select_controller.js+++ b/app/javascript/controllers/category_select_controller.js@@ -192,6 +192,12 @@ export default class extends Controller {this.selectionContainerTarget.textContent =option.dataset.categoryDisplayLabel;}++ // Dispatched after the display text above is updated, not before --+ // listeners (e.g. the transaction name preview) read the selection+ // text synchronously off this event, so firing early would hand them+ // the previous selection's label.+ this.hiddenInputTarget.dispatchEvent(new Event("change", { bubbles: true }));}showParentPicker(event) {diff --git a/app/javascript/controllers/merchant_select_controller.js b/app/javascript/controllers/merchant_select_controller.jsindex 83522820bf..55b2bac8d4 100644--- a/app/javascript/controllers/merchant_select_controller.js+++ b/app/javascript/controllers/merchant_select_controller.js@@ -93,10 +93,15 @@ export default class extends Controller {this.selectedId = id;this.hiddenInputTarget.value = id;- this.hiddenInputTarget.dispatchEvent(new Event("change", { bubbles: true }));this.optionTargets.forEach((target) => this.updateOptionState(target, id));this.updateSelectionDisplay(option);++ // Dispatched after updateSelectionDisplay above, not before -- listeners+ // (e.g. the transaction name preview) read the selection text+ // synchronously off this event, so firing early would hand them the+ // previous selection's label.+ this.hiddenInputTarget.dispatchEvent(new Event("change", { bubbles: true }));}updateOptionState(option, selectedId) {diff --git a/app/javascript/controllers/transaction_name_preview_controller.js b/app/javascript/controllers/transaction_name_preview_controller.jsnew file mode 100644index 0000000000..e5fcfa8528--- /dev/null+++ b/app/javascript/controllers/transaction_name_preview_controller.js@@ -0,0 +1,164 @@+import { Controller } from "@hotwired/stimulus";++// Two related jobs for the (optional) transaction name field:+//+// 1. Live-updates its placeholder to preview what the server-side fallback+// (Entry#set_default_name) will save if the field is left blank: category,+// then merchant. Only ever touches the placeholder, never the field's+// value, so it can't clobber anything the user typed -- and since+// placeholders aren't submitted, the preview can never drift from what+// actually gets saved as long as both follow the same order. There is no+// generic fallback for "neither is set": the field's original hint text+// comes back instead, since a name is still required in that case.+//+// 2. A keyboard- and mouse-accessible suggestion dropdown for recently used+// names, filtered as the user types (an ARIA combobox: the input keeps+// focus throughout, arrow keys move an active-descendant highlight,+// Enter/click applies it). This exists instead of a native <datalist>+// because iOS Safari doesn't render datalist suggestions for text inputs+// at all -- a plain <datalist> works on desktop but is silently a no-op+// there.+export default class extends Controller {+ static targets = ["name", "suggestions", "suggestionOption"];++ connect() {+ if (this.hasNameTarget) this.originalPlaceholder = this.nameTarget.placeholder;+ this.activeIndex = -1;+ }++ update() {+ if (!this.hasNameTarget) return;++ this.nameTarget.placeholder = this.previewName() || this.originalPlaceholder;+ }++ previewName() {+ const parts = [+ this.selectionText("category-select", '[data-testid="category-name"]'),+ this.selectionText("merchant-select", "[data-merchant-select-name]"),+ ].filter(Boolean);++ return parts.length > 0 ? parts.join(" - ") : null;+ }++ // `nameSelector` picks out just the label text within the cloned+ // selection markup -- reading the container's full textContent would+ // also pick up the letter-avatar glyph (e.g. "A" for a logo-less+ // merchant) or other decorative text nodes alongside the real name.+ selectionText(controllerName, nameSelector) {+ const hiddenInput = this.element.querySelector(+ `[data-controller~="${controllerName}"] [data-${controllerName}-target="hiddenInput"]`,+ );+ if (!hiddenInput || !hiddenInput.value) return null;++ const container = this.element.querySelector(+ `[data-controller~="${controllerName}"] [data-${controllerName}-target="selectionContainer"]`,+ );+ const text = container?.querySelector(nameSelector)?.textContent.trim();+ return text || null;+ }++ showSuggestions() {+ this.filterSuggestions();+ }++ filterSuggestions() {+ if (!this.hasSuggestionsTarget) return;++ const query = this.nameTarget.value.trim().toLowerCase();+ let anyVisible = false;++ this.suggestionOptionTargets.forEach((option) => {+ const matches = option.dataset.name.toLowerCase().includes(query);+ option.classList.toggle("hidden", !matches);+ if (matches) anyVisible = true;++ // Re-filtering can hide whichever option was previously highlighted+ // by arrow-key navigation -- clear that stale highlight/ARIA state+ // along with resetting activeIndex below, not just the index itself.+ option.classList.remove("bg-container-inset");+ option.setAttribute("aria-selected", "false");+ });++ this.activeIndex = -1;+ this.nameTarget.removeAttribute("aria-activedescendant");+ this.suggestionsTarget.classList.toggle("hidden", !anyVisible);+ this.nameTarget.setAttribute("aria-expanded", anyVisible ? "true" : "false");+ }++ // Hiding on a delay (rather than immediately on blur) lets the+ // mousedown-based selectSuggestion below still register as a click on+ // the option before it disappears.+ scheduleHideSuggestions() {+ if (!this.hasSuggestionsTarget) return;++ this.hideTimeout = setTimeout(() => {+ this.suggestionsTarget.classList.add("hidden");+ this.activeIndex = -1;+ this.nameTarget.setAttribute("aria-expanded", "false");+ this.nameTarget.removeAttribute("aria-activedescendant");+ }, 150);+ }++ // Arrow keys move a highlighted "active descendant" without moving DOM+ // focus off the input (so typing keeps working); Enter applies whichever+ // option is highlighted; Escape closes the list.+ handleKeydown(event) {+ if (!this.hasSuggestionsTarget || this.suggestionsTarget.classList.contains("hidden")) return;++ const visible = this.visibleSuggestions;+ if (visible.length === 0) return;++ if (event.key === "ArrowDown") {+ event.preventDefault();+ this.activeIndex = (this.activeIndex + 1) % visible.length;+ this.highlightActive(visible);+ } else if (event.key === "ArrowUp") {+ event.preventDefault();+ this.activeIndex = (this.activeIndex - 1 + visible.length) % visible.length;+ this.highlightActive(visible);+ } else if (event.key === "Enter" && this.activeIndex >= 0) {+ event.preventDefault();+ this.applySuggestion(visible[this.activeIndex]);+ } else if (event.key === "Escape") {+ this.suggestionsTarget.classList.add("hidden");+ this.activeIndex = -1;+ this.nameTarget.setAttribute("aria-expanded", "false");+ this.nameTarget.removeAttribute("aria-activedescendant");+ }+ }++ get visibleSuggestions() {+ return this.suggestionOptionTargets.filter((option) => !option.classList.contains("hidden"));+ }++ highlightActive(visible) {+ visible.forEach((option, index) => {+ const active = index === this.activeIndex;+ option.classList.toggle("bg-container-inset", active);+ option.setAttribute("aria-selected", active ? "true" : "false");+ });++ const activeOption = visible[this.activeIndex];+ if (!activeOption) return;++ activeOption.scrollIntoView({ block: "nearest" });+ this.nameTarget.setAttribute("aria-activedescendant", activeOption.id);+ }++ selectSuggestion(event) {+ event.preventDefault();+ if (this.hideTimeout) clearTimeout(this.hideTimeout);++ this.applySuggestion(event.currentTarget);+ }++ applySuggestion(option) {+ this.nameTarget.value = option.dataset.name;+ this.suggestionsTarget.classList.add("hidden");+ this.activeIndex = -1;+ this.nameTarget.setAttribute("aria-expanded", "false");+ this.nameTarget.removeAttribute("aria-activedescendant");+ this.nameTarget.focus();+ }+}diff --git a/app/models/category.rb b/app/models/category.rbindex ec236b6a2b..2dc27638db 100644--- a/app/models/category.rb+++ b/app/models/category.rb@@ -380,6 +380,28 @@ class Category < ApplicationRecordself.class.localized_default_name_for(name)end+ # True if `candidate` matches this category's display name in ANY+ # supported locale, not just the current one -- a name generated (or+ # persisted by a background job) under one locale must still be+ # recognized as "this category" when compared under a different one. For+ # a default category this checks every locale's translation of its i18n+ # key; for a custom (non-default) category the raw `name` is the only+ # locale-independent label there is.+ def any_locale_display_name_matches?(candidate)+ return false if candidate.blank?++ normalized = candidate.strip+ return true if normalized.casecmp?(name)++ i18n_key = self.class.send(:default_category_translation_key_for, name)+ return false unless i18n_key++ LanguagesHelper::SUPPORTED_LOCALES.any? do |locale|+ translated = I18n.t(i18n_key, locale: locale, default: nil)+ translated.present? && normalized.casecmp?(translated)+ end+ end+def display_name_with_parentsubcategory? ? "#{parent.display_name} > #{display_name}" : display_nameenddiff --git a/app/models/entry.rb b/app/models/entry.rbindex 6a61b8656e..d55255eaae 100644--- a/app/models/entry.rb+++ b/app/models/entry.rb@@ -41,6 +41,22 @@ class Entry < ApplicationRecordvalidate :cannot_unexclude_split_parentvalidate :split_child_date_matches_parent+ # new_record? && import_id.blank? keeps this to genuinely new manual+ # entries -- excludes CSV imports (which have their own, separately+ # decided blank-name handling) and any unrelated re-validation of an+ # already-persisted entry (background jobs, resaves) that happens to see+ # a blank name for some other reason. external_id/source are also excluded+ # (via !cleared?) because Account::ProviderImportAdapter sets both at+ # find_or_initialize_by time, before this callback runs -- without that+ # guard, a first-time sync of a provider transaction with no name (e.g.+ # Plaid omitting both merchant_name and original_description) would get a+ # synthetic "Category - Merchant" name instead of surfacing the blank-name+ # presence error the same way a manual blank submission would.+ before_validation :set_default_name, if: -> {+ new_record? && import_id.blank? && name.blank? && !cleared? &&+ entryable_type == "Transaction" && account&.family&.auto_generate_transaction_names?+ }+before_destroy :prevent_individual_child_deletion, if: :split_child?after_save :track_earliest_saved_date, if: :saved_change_to_date?@@ -339,6 +355,25 @@ class Entry < ApplicationRecordentryable_type.demodulize.underscoreend+ # True when this entry's name isn't distinguishing on its own -- either it's+ # the auto-generated fallback label, or it just repeats the entryable's own+ # category name. Used to keep name-based grouping/matching (Quick Categorize,+ # recurring smart-fill evidence) from treating unrelated transactions that+ # happen to share a generic name as if they were the same thing.+ def generic_name?+ return false if name.blank?++ normalized = name.strip+ # Checked across every supported locale, not just the current one -- a+ # name generated (or saved by a background job) under one locale must+ # still read as generic when this is later checked under another.+ return true if LanguagesHelper::SUPPORTED_LOCALES.any? { |locale| normalized.casecmp?(I18n.t("transactions.unknown_name", locale: locale)) }+ return false unless entryable_type == "Transaction"++ category = entryable&.category+ category.present? && category.any_locale_display_name_matches?(normalized)+ end+def balance_trend(entries, balances)Balance::TrendCalculator.new(self, entries, balances).trendend@@ -700,4 +735,22 @@ class Entry < ApplicationRecordthrow :abortend++ # Deliberately does not fall back to a generic label like "Unknown+ # transaction" when neither is set -- leaving the name blank with no+ # category or merchant selected either still fails the presence+ # validation below, so a transaction can never end up with no+ # information distinguishing it from any other.+ def set_default_name+ # Category#display_name, not #name -- default categories store the+ # translated label in the `name` column itself (see Category#display_name),+ # so using the raw column here would save whatever locale the category+ # happened to be created under instead of the one the user just picked+ # it in.+ # entryable can be unset if entryable_type was assigned without the+ # nested entryable_attributes that would normally build it (e.g. a+ # malformed API request) -- guard the dereference instead of raising.+ parts = [ entryable&.category&.display_name.presence, entryable&.merchant&.name.presence ].compact+ self.name = parts.join(" - ") if parts.any?+ endenddiff --git a/app/models/family.rb b/app/models/family.rbindex 84da056d65..5ecd655dbe 100644--- a/app/models/family.rb+++ b/app/models/family.rb@@ -254,6 +254,7 @@ class Family < ApplicationRecordvalidates :default_account_sharing, inclusion: { in: SHARING_DEFAULTS }validates :personal_budgets, inclusion: { in: [ true, false ] }validates :household_budget_enabled, inclusion: { in: [ true, false ] }+ validates :auto_generate_transaction_names, inclusion: { in: [ true, false ] }validates :investment_contributions_as_spending, inclusion: { in: [ true, false ] }validates :categories_locked, inclusion: { in: [ true, false ] }validate :timezone_must_be_a_known_zone, if: :timezone_changed?diff --git a/app/models/transaction/grouper/by_merchant_or_name.rb b/app/models/transaction/grouper/by_merchant_or_name.rbindex 8a80a83885..195e2e18e6 100644--- a/app/models/transaction/grouper/by_merchant_or_name.rb+++ b/app/models/transaction/grouper/by_merchant_or_name.rb@@ -27,15 +27,28 @@ class Transaction::Grouper::ByMerchantOrName < Transaction::Grouper.order(entries: { date: :desc })end+ # Entries with no merchant and a generic name (e.g. the auto-generated+ # "Unknown transaction" fallback) get their own singleton key instead of+ # being merged by name -- otherwise unrelated transactions that only share+ # a generic label would be bucketed together, and a rule built from that+ # bucket (Rule.create_from_grouping) would end up matching all of them.def grouping_key_for(entry)- name = entry.entryable.merchant&.name.presence || entry.name+ merchant_name = entry.entryable.merchant&.name.presencetype = entry.amount.negative? ? "income" : "expense"- [ name, type ]++ key = merchant_name || (entry.generic_name? ? "entry:#{entry.id}" : entry.name)+ [ key, type ]end+ # `key` is purely an internal merge key (may be a synthetic per-entry+ # token for generic names, see `grouping_key_for`) -- never surface it+ # directly. `grouping_key`/`display_name` on the Group must stay a+ # human-readable, real transaction name, since the categorize UI displays+ # it and seeds an editable "like" rule condition value from it.def build_group(key, entries)- name, type = key+ _, type = keymerchant = entries.find { |e| e.entryable.merchant.present? }&.entryable&.merchant+ name = merchant&.name || entries.first.nameTransaction::Grouper::Group.new(grouping_key: name,diff --git a/app/views/settings/appearances/show.html.erb b/app/views/settings/appearances/show.html.erbindex 94140313fd..5ff67d2ac5 100644--- a/app/views/settings/appearances/show.html.erb+++ b/app/views/settings/appearances/show.html.erb@@ -119,5 +119,24 @@) %></div><% end %>++ <% if @user.admin? %>+ <%= form_with url: settings_appearance_path, method: :patch,+ class: "p-3",+ data: { controller: "auto-submit-form" } do |f| %>+ <div class="flex cursor-pointer items-center gap-4 justify-between">+ <div class="text-sm space-y-1">+ <p class="text-primary font-medium"><%= t(".auto_generate_transaction_names_title") %></p>+ <p class="text-secondary"><%= t(".auto_generate_transaction_names_description") %></p>+ </div>+ <%= render DS::Toggle.new(+ id: "family_auto_generate_transaction_names",+ name: "family[auto_generate_transaction_names]",+ checked: Current.family.auto_generate_transaction_names?,+ data: { auto_submit_form_target: "auto" }+ ) %>+ </div>+ <% end %>+ <% end %></div><% end %>diff --git a/app/views/transactions/_form.html.erb b/app/views/transactions/_form.html.erbindex bf54959ef8..776ec0cfce 100644--- a/app/views/transactions/_form.html.erb+++ b/app/views/transactions/_form.html.erb@@ -1,6 +1,7 @@-<%# locals: (entry:, account_currencies:, manual_accounts:, categories:, merchants:, tags:) %>+<%# locals: (entry:, account_currencies:, manual_accounts:, categories:, merchants:, tags:, recent_transaction_names: []) %>+<% auto_generate_names = Current.family.auto_generate_transaction_names? %>-<%= styled_form_with model: entry, url: transactions_path, class: "space-y-4", data: { controller: "transaction-form", action: "turbo:before-cache@document->transaction-form#refreshIdempotencyKey pageshow@window->transaction-form#refreshIdempotencyKeyIfPersisted", transaction_form_exchange_rate_url_value: exchange_rate_path, transaction_form_account_currencies_value: account_currencies.to_json } do |f| %>+<%= styled_form_with model: entry, url: transactions_path, class: "space-y-4", data: { controller: auto_generate_names ? "transaction-form transaction-name-preview" : "transaction-form", action: "turbo:before-cache@document->transaction-form#refreshIdempotencyKey pageshow@window->transaction-form#refreshIdempotencyKeyIfPersisted", transaction_form_exchange_rate_url_value: exchange_rate_path, transaction_form_account_currencies_value: account_currencies.to_json } do |f| %><% if entry.errors.any? %><%= render "shared/form_errors", model: entry %><% end %>@@ -24,7 +25,39 @@</section><section class="space-y-2">- <%= f.text_field :name, label: t(".description"), placeholder: t(".description_placeholder"), required: true %>+ <div class="relative">+ <%= f.text_field :name, label: t(".description"),+ placeholder: auto_generate_names ? t(".description_placeholder_optional") : t(".description_placeholder"),+ required: !auto_generate_names,+ autocomplete: "off",+ role: (auto_generate_names && recent_transaction_names.present? ? "combobox" : nil),+ "aria-autocomplete": (auto_generate_names && recent_transaction_names.present? ? "list" : nil),+ "aria-expanded": (auto_generate_names && recent_transaction_names.present? ? "false" : nil),+ "aria-controls": (auto_generate_names && recent_transaction_names.present? ? "transaction_name_suggestions" : nil),+ data: {+ transaction_name_preview_target: "name",+ action: "input->transaction-name-preview#filterSuggestions focus->transaction-name-preview#showSuggestions blur->transaction-name-preview#scheduleHideSuggestions keydown->transaction-name-preview#handleKeydown"+ } %>++ <% if auto_generate_names && recent_transaction_names.present? %>+ <ul id="transaction_name_suggestions"+ role="listbox"+ class="absolute z-50 p-1.5 w-full min-w-48 max-h-64 overflow-auto rounded-lg shadow-lg bg-container mt-1.5 hidden"+ data-transaction-name-preview-target="suggestions">+ <% recent_transaction_names.each_with_index do |name, index| %>+ <li id="transaction_name_suggestion_<%= index %>"+ role="option"+ aria-selected="false"+ data-transaction-name-preview-target="suggestionOption"+ data-name="<%= name %>"+ data-action="mousedown->transaction-name-preview#selectSuggestion"+ class="flex items-center gap-2 w-full px-3 py-1.5 text-sm rounded-lg cursor-pointer hover:bg-container-inset-hover">+ <%= name %>+ </li>+ <% end %>+ </ul>+ <% end %>+ </div><% if @entry.account_id %><%= f.hidden_field :account_id, data: { transaction_form_target: "account" } %>diff --git a/app/views/transactions/new.html.erb b/app/views/transactions/new.html.erbindex 1e13162cd2..6ae791d5d8 100644--- a/app/views/transactions/new.html.erb+++ b/app/views/transactions/new.html.erb@@ -7,6 +7,7 @@manual_accounts: @manual_accounts,categories: @categories,merchants: @merchants,- tags: @tags %>+ tags: @tags,+ recent_transaction_names: @recent_transaction_names %><% end %><% end %>diff --git a/config/locales/views/settings/ca.yml b/config/locales/views/settings/ca.ymlindex f004217336..c7f8fefd5b 100644--- a/config/locales/views/settings/ca.yml+++ b/config/locales/views/settings/ca.yml@@ -53,6 +53,8 @@ ca:la seva matriu a la llista de transaccions. Si està desactivat, els fillsapareixen com a files individuals.split_grouped_title: Agrupa les transaccions dividides+ auto_generate_transaction_names_title: "Genera automàticament els noms de les transaccions"+ auto_generate_transaction_names_description: "Quan el nom d'una transacció introduïda manualment es deixa en blanc, s'omple a partir de la categoria i el comerç seleccionats (p. ex. «Entreteniment - Netflix»). Si no se'n selecciona cap, el nom continua sent obligatori. S'aplica a tota la llar i només a les transaccions noves."theme_dark: Fosctheme_light: Clartheme_subtitle: Tria el tema preferit per a l'aplicaciódiff --git a/config/locales/views/settings/de.yml b/config/locales/views/settings/de.ymlindex 6e04f34b51..0f95a7d208 100644--- a/config/locales/views/settings/de.yml+++ b/config/locales/views/settings/de.yml@@ -101,6 +101,8 @@ de:page_title: Darstellungsplit_grouped_description: Zeigt geteilte Transaktionen in der Liste gebündelt unter ihrer Ursprungsbuchung. Ist die Option aus, erscheint jede Teilbuchung als eigene Zeile.split_grouped_title: Geteilte Transaktionen gruppieren+ auto_generate_transaction_names_title: Transaktionsnamen automatisch erzeugen+ auto_generate_transaction_names_description: Bleibt der Name einer manuell erfassten Transaktion leer, wird er aus der gewählten Kategorie und dem Händler gebildet (z. B. „Unterhaltung - Netflix“). Ist beides nicht gewählt, bleibt der Name Pflicht. Gilt für den ganzen Haushalt und nur für neue Transaktionen.theme_dark: Dunkeltheme_light: Helltheme_subtitle: Wähle das Erscheinungsbild der Appdiff --git a/config/locales/views/settings/en.yml b/config/locales/views/settings/en.ymlindex 673d50e63f..f48d882711 100644--- a/config/locales/views/settings/en.yml+++ b/config/locales/views/settings/en.yml@@ -188,6 +188,8 @@ en:dashboard_account_groups_description: These account sections will start expanded on the dashboard and in the account sidebar. You can still collapse them manually at any time.split_grouped_title: Group split transactionssplit_grouped_description: Show split transactions grouped under their parent in the transaction list. When off, split children appear as individual rows.+ auto_generate_transaction_names_title: Auto-generate transaction names+ auto_generate_transaction_names_description: When a manually entered transaction's name is left blank, fill it in from the selected category and merchant (e.g. "Entertainment - Netflix"). A name is still required if neither is selected. Applies to the whole family, and only affects new transactions.preferences:show:country: Countrydiff --git a/config/locales/views/settings/es.yml b/config/locales/views/settings/es.ymlindex ec919961c2..35a3d60025 100644--- a/config/locales/views/settings/es.yml+++ b/config/locales/views/settings/es.yml@@ -118,6 +118,8 @@ es:dashboard_two_column_title: Diseño de dos columnasdashboard_two_column_description: Muestra los widgets del panel en dos columnas en pantallas grandes, con controles de ancho y alto por widget en la cabecera de cada uno. Si está desactivado, los widgets se apilan en una sola columna.split_grouped_title: Agrupar transacciones divididas+ auto_generate_transaction_names_title: "Generar nombres de transacciones automáticamente"+ auto_generate_transaction_names_description: "Si el nombre de una transacción introducida manualmente se deja en blanco, se rellena con la categoría y el comercio seleccionados (p. ej. «Entretenimiento - Netflix»). Si no se selecciona ninguno, el nombre sigue siendo obligatorio. Se aplica a todo el grupo familiar y solo a transacciones nuevas."split_grouped_description: Muestra las transacciones divididas agrupadas bajo su transacción principal en la lista. Si está desactivado, las divisiones aparecen como filas individuales.preferences:show:diff --git a/config/locales/views/settings/fr.yml b/config/locales/views/settings/fr.ymlindex 2e6c908ac4..f651e17679 100644--- a/config/locales/views/settings/fr.yml+++ b/config/locales/views/settings/fr.yml@@ -25,6 +25,8 @@ fr:page_title: Apparencesplit_grouped_description: Affiche les transactions fractionnées groupées sous leur parent dans la liste des transactions. Lorsque cette option est désactivée, les enfants fractionnés apparaissent comme des lignes individuelles.split_grouped_title: Grouper les transactions fractionnées+ auto_generate_transaction_names_title: "Générer automatiquement les noms des transactions"+ auto_generate_transaction_names_description: "Si le nom d'une transaction saisie manuellement est laissé vide, il est rempli à partir de la catégorie et du marchand sélectionnés (p. ex. « Divertissement - Netflix »). Un nom reste obligatoire si aucun des deux n'est sélectionné. S'applique à tout le foyer et uniquement aux nouvelles transactions."theme_dark: Sombretheme_light: Clairtheme_subtitle: Choisissez un thème préféré pour l'applicationdiff --git a/config/locales/views/settings/hu.yml b/config/locales/views/settings/hu.ymlindex 30c89691a3..03d0af0a8b 100644--- a/config/locales/views/settings/hu.yml+++ b/config/locales/views/settings/hu.yml@@ -82,6 +82,8 @@ hu:dashboard_two_column_title: Kétoszlopos elrendezésdashboard_two_column_description: Az irányítópult-widgetek megjelenítése két oszlopban nagy képernyőkön. Ha ki van kapcsolva, a widgetek egyetlen oszlopban egymás alatt jelennek meg.split_grouped_title: Felosztott tranzakciók csoportosítása+ auto_generate_transaction_names_title: "Tranzakciónevek automatikus létrehozása"+ auto_generate_transaction_names_description: "Ha egy kézzel rögzített tranzakció neve üresen marad, a kiválasztott kategóriából és kereskedőből töltődik ki (pl. „Szórakozás - Netflix”). Ha egyik sincs kiválasztva, a név továbbra is kötelező. Az egész háztartásra vonatkozik, és csak az új tranzakciókra."split_grouped_description: A felosztott tranzakciók megjelenítése szülőjük alatt csoportosítva a tranzakciólistában. Ha ki van kapcsolva, a felosztott tételek egyedi sorként jelennek meg.preferences:show:diff --git a/config/locales/views/settings/it.yml b/config/locales/views/settings/it.ymlindex 45ba7e2014..8ac8ad8fc1 100644--- a/config/locales/views/settings/it.yml+++ b/config/locales/views/settings/it.yml@@ -118,6 +118,8 @@ it:dashboard_two_column_title: Layout a due colonnedashboard_two_column_description: Visualizza i widget del dashboard in due colonne su schermi grandi, con controlli larghezza e altezza per widget nell'intestazione di ciascun widget. Se disattivato, i widget si impilano in una singola colonna.split_grouped_title: Raggruppa transazioni suddivise+ auto_generate_transaction_names_title: "Genera automaticamente i nomi delle transazioni"+ auto_generate_transaction_names_description: "Se il nome di una transazione inserita manualmente viene lasciato vuoto, viene compilato con la categoria e l'esercente selezionati (es. «Intrattenimento - Netflix»). Il nome resta obbligatorio se nessuno dei due è selezionato. Vale per tutto il nucleo familiare e solo per le nuove transazioni."split_grouped_description: Mostra le transazioni suddivise raggruppate sotto la voce principale nell'elenco transazioni. Se disattivato, le voci figlie appaiono come righe individuali.preferences:show:diff --git a/config/locales/views/settings/pl.yml b/config/locales/views/settings/pl.ymlindex c154f7a14b..0b3b95a4c7 100644--- a/config/locales/views/settings/pl.yml+++ b/config/locales/views/settings/pl.yml@@ -65,6 +65,8 @@ pl:nadrzędną na liście transakcji. Gdy opcja jest wyłączona, pozycje podrzędnepojawiają się jako osobne wiersze.split_grouped_title: Grupuj podzielone transakcje+ auto_generate_transaction_names_title: "Automatycznie generuj nazwy transakcji"+ auto_generate_transaction_names_description: "Jeśli nazwa ręcznie wprowadzonej transakcji pozostanie pusta, zostanie uzupełniona na podstawie wybranej kategorii i kontrahenta (np. „Rozrywka - Netflix”). Nazwa jest nadal wymagana, jeśli nie wybrano żadnego z nich. Dotyczy całego gospodarstwa domowego i tylko nowych transakcji."theme_dark: Ciemnytheme_light: Jasnytheme_subtitle: Wybierz preferowany motyw aplikacjidiff --git a/config/locales/views/settings/pt-BR.yml b/config/locales/views/settings/pt-BR.ymlindex f2d8b9f9f9..51fb3c0aec 100644--- a/config/locales/views/settings/pt-BR.yml+++ b/config/locales/views/settings/pt-BR.yml@@ -45,6 +45,8 @@ pt-BR:dashboard_two_column_title: Layout de duas colunasdashboard_two_column_description: Exibe os widgets do painel em duas colunas em telas grandes. Quando desativado, os widgets ficam empilhados em uma única coluna.split_grouped_title: Agrupar transações divididas+ auto_generate_transaction_names_title: "Gerar nomes de transações automaticamente"+ auto_generate_transaction_names_description: "Quando o nome de uma transação inserida manualmente fica em branco, ele é preenchido a partir da categoria e do comerciante selecionados (ex.: \"Entretenimento - Netflix\"). O nome continua obrigatório se nenhum dos dois for selecionado. Vale para toda a família e apenas para novas transações."split_grouped_description: Mostra as transações divididas agrupadas sob o registro principal na lista de transações. Quando desativado, as subdivisões aparecem como linhas individuais.preferences:show:diff --git a/config/locales/views/settings/pt-PT.yml b/config/locales/views/settings/pt-PT.ymlindex e66218d5fd..27775faa7d 100644--- a/config/locales/views/settings/pt-PT.yml+++ b/config/locales/views/settings/pt-PT.yml@@ -161,6 +161,8 @@ pt-PT:dashboard_two_column_title: Disposição de duas colunasdashboard_two_column_description: Apresenta os widgets da visão geral em duas colunas em ecrãs grandes, com controlos de largura e altura por widget no cabeçalho de cada widget. Quando desativado, os widgets são empilhados numa única coluna.split_grouped_title: Agrupar transações divididas+ auto_generate_transaction_names_title: "Gerar nomes de transações automaticamente"+ auto_generate_transaction_names_description: "Quando o nome de uma transação introduzida manualmente fica em branco, é preenchido a partir da categoria e do comerciante selecionados (ex.: \"Entretenimento - Netflix\"). O nome continua obrigatório se nenhum dos dois for selecionado. Aplica-se a todo o agregado familiar e apenas a novas transações."split_grouped_description: Apresenta as transações divididas agrupadas pela transação principal. Quando desativado, cada transação dividida é apresentada individualmente.preferences:show:diff --git a/config/locales/views/settings/ru.yml b/config/locales/views/settings/ru.ymlindex f64ba50cb5..0ce3be4962 100644--- a/config/locales/views/settings/ru.yml+++ b/config/locales/views/settings/ru.yml@@ -57,6 +57,8 @@ ru:под их родительской в списке операций. Если выключено, разделённые элементыотображаются как отдельные строки.split_grouped_title: Группировать разделённые операции+ auto_generate_transaction_names_title: "Автоматически создавать названия транзакций"+ auto_generate_transaction_names_description: "Если название вручную введённой транзакции оставлено пустым, оно заполняется по выбранной категории и продавцу (например, «Развлечения - Netflix»). Если ничего не выбрано, название по-прежнему обязательно. Действует для всего домохозяйства и только для новых транзакций."theme_dark: Тёмнаяtheme_light: Светлаяtheme_subtitle: Выберите предпочитаемую тему для приложенияdiff --git a/config/locales/views/settings/tr.yml b/config/locales/views/settings/tr.ymlindex 9ccfb7fb3b..95ddb38074 100644--- a/config/locales/views/settings/tr.yml+++ b/config/locales/views/settings/tr.yml@@ -58,6 +58,8 @@ tr:altında gruplandırılmış olarak gösterin. Kapalıyken bölünen alt işlemlerayrı satırlar olarak görünür.split_grouped_title: Bölünmüş işlemleri grupla+ auto_generate_transaction_names_title: "İşlem adlarını otomatik oluştur"+ auto_generate_transaction_names_description: "Elle girilen bir işlemin adı boş bırakılırsa, seçilen kategori ve satıcıdan doldurulur (ör. \"Eğlence - Netflix\"). İkisi de seçilmezse ad yine zorunludur. Tüm hane için geçerlidir ve yalnızca yeni işlemleri etkiler."theme_dark: Koyutheme_light: Açıktheme_subtitle: Uygulama için tercih edilen temayı seçindiff --git a/config/locales/views/settings/uk.yml b/config/locales/views/settings/uk.ymlindex d03ec5d267..6444e2635e 100644--- a/config/locales/views/settings/uk.yml+++ b/config/locales/views/settings/uk.yml@@ -184,6 +184,8 @@ uk:dashboard_two_column_title: Двоколонковий макетdashboard_two_column_description: Відображати віджети дашборду у двох колонках на великих екранах, з елементами керування шириною та висотою для кожного віджета в його заголовку. Коли вимкнено, віджети розташовуються в одній колонці.split_grouped_title: Групувати розділені транзакції+ auto_generate_transaction_names_title: "Автоматично створювати назви транзакцій"+ auto_generate_transaction_names_description: "Якщо назву вручну введеної транзакції залишено порожньою, її буде заповнено з вибраної категорії та продавця (наприклад, «Розваги - Netflix»). Якщо нічого не вибрано, назва залишається обов'язковою. Діє для всього домогосподарства й лише для нових транзакцій."split_grouped_description: Показувати розділені транзакції згрупованими під їхнім батьківським елементом у списку транзакцій. Коли вимкнено, дочірні елементи розділення відображаються як окремі рядки.dashboard_account_groups_title: Розгорнуті за замовчуваннямdashboard_account_groups_description: Ці розділи рахунків будуть розгорнуті за замовчуванням на дашборді та в бічній панелі рахунків. Ви можете будь-коли згорнути їх вручну.diff --git a/config/locales/views/settings/vi.yml b/config/locales/views/settings/vi.ymlindex 64c1eb7f17..d9c1501fdb 100644--- a/config/locales/views/settings/vi.yml+++ b/config/locales/views/settings/vi.yml@@ -118,6 +118,8 @@ vi:dashboard_two_column_title: Bố cục hai cộtdashboard_two_column_description: Hiển thị các widget bảng điều khiển thành hai cột trên màn hình lớn. Khi tắt, các widget xếp chồng thành một cột.split_grouped_title: Nhóm giao dịch phân chia+ auto_generate_transaction_names_title: "Tự động tạo tên giao dịch"+ auto_generate_transaction_names_description: "Khi tên của giao dịch nhập thủ công để trống, tên sẽ được điền từ danh mục và nhà cung cấp đã chọn (ví dụ: \"Giải trí - Netflix\"). Nếu không chọn cái nào, tên vẫn là bắt buộc. Áp dụng cho cả hộ gia đình và chỉ cho giao dịch mới."split_grouped_description: Hiển thị giao dịch phân chia được nhóm dưới giao dịch cha trong danh sách. Khi tắt, các mục con phân chia xuất hiện như các hàng riêng biệt.preferences:show:diff --git a/config/locales/views/settings/zh-CN.yml b/config/locales/views/settings/zh-CN.ymlindex 0a55954efa..69911444ff 100644--- a/config/locales/views/settings/zh-CN.yml+++ b/config/locales/views/settings/zh-CN.yml@@ -118,6 +118,8 @@ zh-CN:dashboard_two_column_title: 双栏布局dashboard_two_column_description: 在大屏幕上以两列显示仪表盘组件;关闭后,组件将以单列堆叠显示。split_grouped_title: 将拆分交易分组显示+ auto_generate_transaction_names_title: "自动生成交易名称"+ auto_generate_transaction_names_description: "手动输入的交易名称留空时,将根据所选分类和商户自动填写(例如“娱乐 - Netflix”)。如果两者都未选择,名称仍为必填。适用于整个家庭,且仅影响新交易。"split_grouped_description: 在交易列表中按父级分组显示拆分交易;关闭后,拆分子项将作为独立行显示。preferences:show:diff --git a/config/locales/views/settings/zh-TW.yml b/config/locales/views/settings/zh-TW.ymlindex fe99614bd4..b8f2e704b3 100644--- a/config/locales/views/settings/zh-TW.yml+++ b/config/locales/views/settings/zh-TW.yml@@ -161,6 +161,8 @@ zh-TW:dashboard_two_column_title: 雙欄版面dashboard_two_column_description: 在大螢幕上以兩欄顯示儀表板小工具,每個小工具的標題列都有各自的寬度與高度控制項。關閉時,小工具會排成單欄。split_grouped_title: 將拆分交易分組+ auto_generate_transaction_names_title: "自動產生交易名稱"+ auto_generate_transaction_names_description: "手動輸入的交易名稱留空時,會依所選類別和商家自動填入(例如「娛樂 - Netflix」)。若兩者皆未選擇,名稱仍為必填。適用於整個家庭,且僅影響新交易。"split_grouped_description: 在交易清單中,將拆分交易歸在其母交易之下顯示。關閉時,拆分出來的子項會各自成為一列。preferences:show:diff --git a/config/locales/views/transactions/ca.yml b/config/locales/views/transactions/ca.ymlindex cc60715222..d430061b50 100644--- a/config/locales/views/transactions/ca.yml+++ b/config/locales/views/transactions/ca.yml@@ -156,6 +156,7 @@ ca:date: Datadescription: Descripciódescription_placeholder: Descriu la transacció+ description_placeholder_optional: "Deixa-ho en blanc per usar el nom de la categoria/comerç, o selecciona'n un primer"details: Detallsexpense: Despesaincome: Ingrésdiff --git a/config/locales/views/transactions/de.yml b/config/locales/views/transactions/de.ymlindex 2d523ab68c..77f5207d00 100644--- a/config/locales/views/transactions/de.yml+++ b/config/locales/views/transactions/de.yml@@ -17,6 +17,7 @@ de:date: Datumdescription: Beschreibungdescription_placeholder: Transaktion beschreiben+ description_placeholder_optional: Leer lassen, um den Namen aus Kategorie/Händler zu übernehmen, oder zuerst eines davon wählenexpense: Ausgabeincome: Einnahmenone: (keine)diff --git a/config/locales/views/transactions/en.yml b/config/locales/views/transactions/en.ymlindex 16611bf9dc..8362bba343 100644--- a/config/locales/views/transactions/en.yml+++ b/config/locales/views/transactions/en.yml@@ -41,6 +41,7 @@ en:date: Datedescription: Descriptiondescription_placeholder: Describe transaction+ description_placeholder_optional: Leave blank to use the category/merchant name, or select one of those firstexpense: Expenseincome: Incomemerchant_label: Merchantdiff --git a/config/locales/views/transactions/es.yml b/config/locales/views/transactions/es.ymlindex 7432c1ca9c..174cf9511a 100644--- a/config/locales/views/transactions/es.yml+++ b/config/locales/views/transactions/es.yml@@ -35,6 +35,7 @@ es:date: Fechadescription: Descripcióndescription_placeholder: Describe la transacción+ description_placeholder_optional: "Déjalo en blanco para usar el nombre de la categoría/comercio, o selecciona uno primero"expense: Gastoincome: Ingresomerchant_label: Comerciodiff --git a/config/locales/views/transactions/fr.yml b/config/locales/views/transactions/fr.ymlindex 0530a0cf45..2d77195278 100644--- a/config/locales/views/transactions/fr.yml+++ b/config/locales/views/transactions/fr.yml@@ -150,6 +150,7 @@ fr:date: Datedescription: Libellédescription_placeholder: Libellé de la transaction+ description_placeholder_optional: "Laissez vide pour utiliser le nom de la catégorie/du marchand, ou sélectionnez-en un d'abord"details: Détailsexpense: Dépenseincome: Revenudiff --git a/config/locales/views/transactions/hu.yml b/config/locales/views/transactions/hu.ymlindex 69f03b4bc5..b247555ed4 100644--- a/config/locales/views/transactions/hu.yml+++ b/config/locales/views/transactions/hu.yml@@ -35,6 +35,7 @@ hu:date: Dátumdescription: Leírásdescription_placeholder: Tranzakció leírása+ description_placeholder_optional: "Hagyd üresen a kategória/kereskedő nevének használatához, vagy előbb válassz egyet"expense: Kiadásincome: Bevételmerchant_label: Kereskedődiff --git a/config/locales/views/transactions/it.yml b/config/locales/views/transactions/it.ymlindex 01e7893872..54a1b72ba5 100644--- a/config/locales/views/transactions/it.yml+++ b/config/locales/views/transactions/it.yml@@ -35,6 +35,7 @@ it:date: Datadescription: Descrizionedescription_placeholder: Descrivi la transazione+ description_placeholder_optional: "Lascia vuoto per usare il nome della categoria/dell'esercente, oppure selezionane prima uno"expense: Spesaincome: Entratamerchant_label: Esercentediff --git a/config/locales/views/transactions/nb.yml b/config/locales/views/transactions/nb.ymlindex 53f4fa7b62..e411f967a0 100644--- a/config/locales/views/transactions/nb.yml+++ b/config/locales/views/transactions/nb.yml@@ -10,6 +10,7 @@ nb:date: Datodescription: Beskrivelsedescription_placeholder: Beskriv transaksjonen+ description_placeholder_optional: "La stå tomt for å bruke kategori-/selgernavnet, eller velg ett av dem først"expense: Utgiftincome: Inntektnone: (ingen)diff --git a/config/locales/views/transactions/nl.yml b/config/locales/views/transactions/nl.ymlindex 4d2a3e1680..143e4e4284 100644--- a/config/locales/views/transactions/nl.yml+++ b/config/locales/views/transactions/nl.yml@@ -11,6 +11,7 @@ nl:date: Datumdescription: Beschrijvingdescription_placeholder: Beschrijf transactie+ description_placeholder_optional: "Laat leeg om de naam van de categorie/handelaar te gebruiken, of kies eerst een van beide"expense: Uitgaveincome: Inkomstennone: (geen)diff --git a/config/locales/views/transactions/pl.yml b/config/locales/views/transactions/pl.ymlindex ab0d516a31..3d68dffdf0 100644--- a/config/locales/views/transactions/pl.yml+++ b/config/locales/views/transactions/pl.yml@@ -173,6 +173,7 @@ pl:date: Datadescription: Opisdescription_placeholder: Opisz transakcję+ description_placeholder_optional: "Pozostaw puste, aby użyć nazwy kategorii/kontrahenta, lub najpierw wybierz jedno z nich"details: Szczegółyexpense: Wydatekincome: Przychóddiff --git a/config/locales/views/transactions/pt-BR.yml b/config/locales/views/transactions/pt-BR.ymlindex 0139766788..a495c993c8 100644--- a/config/locales/views/transactions/pt-BR.yml+++ b/config/locales/views/transactions/pt-BR.yml@@ -10,6 +10,7 @@ pt-BR:date: Datadescription: Descriçãodescription_placeholder: Descreva a transação+ description_placeholder_optional: "Deixe em branco para usar o nome da categoria/comerciante, ou selecione um deles primeiro"expense: Despesaincome: Receitanone: (nenhum)diff --git a/config/locales/views/transactions/pt-PT.yml b/config/locales/views/transactions/pt-PT.ymlindex 1b2e5f3e44..54721c7e75 100644--- a/config/locales/views/transactions/pt-PT.yml+++ b/config/locales/views/transactions/pt-PT.yml@@ -41,6 +41,7 @@ pt-PT:date: Datadescription: Descriçãodescription_placeholder: Descreva a transação+ description_placeholder_optional: "Deixe em branco para usar o nome da categoria/comerciante, ou selecione um deles primeiro"expense: Despesaincome: Rendimentomerchant_label: Comerciantediff --git a/config/locales/views/transactions/ro.yml b/config/locales/views/transactions/ro.ymlindex 1fd454ec61..7aa9a7e2c5 100644--- a/config/locales/views/transactions/ro.yml+++ b/config/locales/views/transactions/ro.yml@@ -10,6 +10,7 @@ ro:date: Datădescription: Descrieredescription_placeholder: Descrie tranzacția+ description_placeholder_optional: "Lasă gol pentru a folosi numele categoriei/comerciantului sau selectează mai întâi unul dintre ele"expense: Cheltuialăincome: Venitnone: (niciunul)diff --git a/config/locales/views/transactions/ru.yml b/config/locales/views/transactions/ru.ymlindex 1291afe808..37421782ee 100644--- a/config/locales/views/transactions/ru.yml+++ b/config/locales/views/transactions/ru.yml@@ -166,6 +166,7 @@ ru:date: Датаdescription: Описаниеdescription_placeholder: Опишите операцию+ description_placeholder_optional: "Оставьте пустым, чтобы использовать название категории/продавца, или сначала выберите одно из них"details: Деталиexpense: Расходincome: Доходdiff --git a/config/locales/views/transactions/tr.yml b/config/locales/views/transactions/tr.ymlindex 24c4be2978..d2444dc75b 100644--- a/config/locales/views/transactions/tr.yml+++ b/config/locales/views/transactions/tr.yml@@ -158,6 +158,7 @@ tr:date: Tarihdescription: Açıklamadescription_placeholder: İşlemi açıklayın+ description_placeholder_optional: "Kategori/satıcı adını kullanmak için boş bırakın veya önce birini seçin"details: Detaylarexpense: Giderincome: Gelirdiff --git a/config/locales/views/transactions/uk.yml b/config/locales/views/transactions/uk.ymlindex 0f0c98a34d..050ae9f376 100644--- a/config/locales/views/transactions/uk.yml+++ b/config/locales/views/transactions/uk.yml@@ -34,6 +34,7 @@ uk:date: Датаdescription: Описdescription_placeholder: Опишіть транзакцію+ description_placeholder_optional: "Залиште порожнім, щоб використати назву категорії/продавця, або спершу виберіть одне з них"expense: Витратаincome: Дохідmerchant_label: Продавецьdiff --git a/config/locales/views/transactions/vi.yml b/config/locales/views/transactions/vi.ymlindex 0be994d36b..73dee86a43 100644--- a/config/locales/views/transactions/vi.yml+++ b/config/locales/views/transactions/vi.yml@@ -35,6 +35,7 @@ vi:date: Ngàydescription: Mô tảdescription_placeholder: Mô tả giao dịch+ description_placeholder_optional: "Để trống để dùng tên danh mục/nhà cung cấp, hoặc chọn một trong hai trước"expense: Chi tiêuincome: Thu nhậpmerchant_label: Nhà cung cấpdiff --git a/config/locales/views/transactions/zh-CN.yml b/config/locales/views/transactions/zh-CN.ymlindex 3f14fc2187..4d91ca9b74 100644--- a/config/locales/views/transactions/zh-CN.yml+++ b/config/locales/views/transactions/zh-CN.yml@@ -35,6 +35,7 @@ zh-CN:date: 日期description: 描述description_placeholder: 描述交易+ description_placeholder_optional: "留空以使用分类/商户名称,或先选择其中一项"expense: 支出income: 收入merchant_label: 商户diff --git a/config/locales/views/transactions/zh-TW.yml b/config/locales/views/transactions/zh-TW.ymlindex ba31fa5a3e..626e7132c5 100644--- a/config/locales/views/transactions/zh-TW.yml+++ b/config/locales/views/transactions/zh-TW.yml@@ -35,6 +35,7 @@ zh-TW:date: 日期description: 描述description_placeholder: 描述此筆交易+ description_placeholder_optional: "留空以使用類別/商家名稱,或先選擇其中一項"expense: 支出income: 收入merchant_label: 商家diff --git a/db/migrate/20260903000000_add_auto_generate_transaction_names_to_families.rb b/db/migrate/20260903000000_add_auto_generate_transaction_names_to_families.rbnew file mode 100644index 0000000000..cb148d71c1--- /dev/null+++ b/db/migrate/20260903000000_add_auto_generate_transaction_names_to_families.rb@@ -0,0 +1,5 @@+class AddAutoGenerateTransactionNamesToFamilies < ActiveRecord::Migration[8.1]+ def change+ add_column :families, :auto_generate_transaction_names, :boolean, default: false, null: false+ end+enddiff --git a/db/schema.rb b/db/schema.rbindex 88acf644ac..ef3d06a738 100644--- a/db/schema.rb+++ b/db/schema.rb@@ -846,6 +846,7 @@ ActiveRecord::Schema[8.1].define(version: 2026_10_20_090001) docreate_table "families", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|t.jsonb "ai_prompt_overrides", default: {}, null: falset.string "assistant_type", default: "builtin", null: false+ t.boolean "auto_generate_transaction_names", default: false, null: falset.boolean "auto_match_transfers_disabled", default: false, null: falset.boolean "auto_sync_on_login", default: true, null: falset.jsonb "bayes_settings", default: {}, null: falsediff --git a/test/controllers/recurring_transactions/smart_fills_controller_test.rb b/test/controllers/recurring_transactions/smart_fills_controller_test.rbindex 003fa215f4..3096374944 100644--- a/test/controllers/recurring_transactions/smart_fills_controller_test.rb+++ b/test/controllers/recurring_transactions/smart_fills_controller_test.rb@@ -73,6 +73,33 @@ class RecurringTransactions::SmartFillsControllerTest < ActionDispatch::Integratassert_response :forbiddenend+ test "a generic entry name skips ILIKE evidence gathering, using only the picked entry" do+ unrelated = accounts(:depository).entries.create!(+ date: 3.days.ago.to_date, amount: 999, currency: "USD",+ name: I18n.t("transactions.unknown_name"), entryable: Transaction.new+ )+ generic_entry = accounts(:depository).entries.create!(+ date: Date.current, amount: 40, currency: "USD",+ name: I18n.t("transactions.unknown_name"), entryable: Transaction.new+ )++ stub_provider(raw)++ RecurringTransaction::AiSetupSuggester.any_instance.expects(:suggest_from_entries)+ .with([ generic_entry ])+ .returns(RecurringTransaction::AiSetupSuggester::Suggestion.new(+ name: nil, amount: nil, frequency: nil, day_of_month: nil, weekday: nil,+ month_of_year: nil, category_id: nil, category_name: nil, bill_type: nil, autopay: nil,+ confidence: nil, rationale: nil+ ))++ post smart_fill_recurring_transactions_url(entry_id: generic_entry.id),+ headers: { "Turbo-Frame" => "modal" }++ assert_response :success+ assert unrelated.persisted?, "sanity check: the unrelated same-name entry exists in the DB"+ end+test "an inaccessible entry never becomes evidence" dostub_provider(raw(name: "Should not appear"))hidden = accounts(:investment).entries.create!(diff --git a/test/controllers/settings/appearances_controller_test.rb b/test/controllers/settings/appearances_controller_test.rbnew file mode 100644index 0000000000..ab410ee147--- /dev/null+++ b/test/controllers/settings/appearances_controller_test.rb@@ -0,0 +1,33 @@+require "test_helper"++class Settings::AppearancesControllerTest < ActionDispatch::IntegrationTest+ test "admin can enable auto-generate transaction names for the whole family" do+ sign_in users(:family_admin)+ families(:dylan_family).update!(auto_generate_transaction_names: false)++ patch settings_appearance_path, params: { family: { auto_generate_transaction_names: "1" } }++ assert_redirected_to settings_appearance_path+ assert families(:dylan_family).reload.auto_generate_transaction_names?+ end++ test "admin can disable auto-generate transaction names for the whole family" do+ sign_in users(:family_admin)+ families(:dylan_family).update!(auto_generate_transaction_names: true)++ patch settings_appearance_path, params: { family: { auto_generate_transaction_names: "0" } }++ assert_redirected_to settings_appearance_path+ assert_not families(:dylan_family).reload.auto_generate_transaction_names?+ end++ test "non-admin family member cannot change the family-wide setting" do+ sign_in users(:family_member)+ families(:dylan_family).update!(auto_generate_transaction_names: false)++ patch settings_appearance_path, params: { family: { auto_generate_transaction_names: "1" } }++ assert_redirected_to settings_appearance_path+ assert_not families(:dylan_family).reload.auto_generate_transaction_names?+ end+enddiff --git a/test/controllers/transactions_controller_test.rb b/test/controllers/transactions_controller_test.rbindex 7f051a5701..9224644353 100644--- a/test/controllers/transactions_controller_test.rb+++ b/test/controllers/transactions_controller_test.rb@@ -325,6 +325,86 @@ class TransactionsControllerTest < ActionDispatch::IntegrationTestassert_response :unprocessable_entityend+ test "a blank auto-generated name is not silently kept when another field fails validation" do+ @entry.account.family.update!(auto_generate_transaction_names: true)++ # Name is blank but a category is selected, so Entry#set_default_name+ # fills it in during validation; the date is deliberately out of the+ # supported range so the record still fails to save for an unrelated+ # reason (an invalid currency would break rendering the money field+ # itself, not just validation). The re-rendered form must show the name+ # field blank again (not the generated text), or a resubmission after+ # changing the category would save that now-stale name instead of a+ # fresh one.+ post transactions_url, params: {+ entry: {+ account_id: @entry.account_id,+ name: "",+ date: 40.years.ago.to_date,+ currency: "USD",+ amount: 100,+ nature: "inflow",+ entryable_type: "Transaction",+ entryable_attributes: { category_id: categories(:food_and_drink).id }+ }+ }++ assert_response :unprocessable_entity+ assert_select "input[name='entry[name]'][value='']"+ end++ test "an explicitly provided name survives a failed submission unchanged" do+ @entry.account.family.update!(auto_generate_transaction_names: true)++ post transactions_url, params: {+ entry: {+ account_id: @entry.account_id,+ name: "Explicit name",+ date: 40.years.ago.to_date,+ currency: "USD",+ amount: 100,+ nature: "inflow",+ entryable_type: "Transaction",+ entryable_attributes: { category_id: categories(:food_and_drink).id }+ }+ }++ assert_response :unprocessable_entity+ assert_select "input[name='entry[name]'][value='Explicit name']"+ end++ test "recent name suggestions never include entries from accounts inaccessible to the current user" do+ @entry.account.family.update!(auto_generate_transaction_names: true)++ private_account = Account.create!(+ family: @entry.account.family,+ owner: users(:family_member),+ name: "Family Member Private Account",+ balance: 100,+ currency: "USD",+ accountable: Depository.new,+ status: "active"+ )+ create_transaction(account: private_account, name: "Private Merchant XYZ")++ get new_transaction_url++ assert_response :success+ assert_no_match "Private Merchant XYZ", response.body+ end++ test "recent name suggestions exclude the unknown-name fallback in every supported locale, not just the current one" do+ @entry.account.family.update!(auto_generate_transaction_names: true)++ create_transaction(account: @entry.account, name: I18n.t("transactions.unknown_name", locale: :en))+ create_transaction(account: @entry.account, name: I18n.t("transactions.unknown_name", locale: :de))++ get new_transaction_url++ assert_response :success+ assert_no_match I18n.t("transactions.unknown_name", locale: :de), response.body+ end+# Regression: the sync window must start at the old date, or the incremental# balance calculation counts the moved transaction twice.test "moving a transaction later syncs from its original date" dodiff --git a/test/i18n_test.rb b/test/i18n_test.rbindex fbcef29417..d01f102303 100644--- a/test/i18n_test.rb+++ b/test/i18n_test.rb@@ -132,6 +132,27 @@ class I18nTest < ActiveSupport::TestCaseassert_empty missing, "bills.index.notices_heading is missing for: #{missing.join(", ")}"end+ # The family setting that fills a blank transaction name and the form+ # placeholder that explains it. Fallbacks would show English, so each locale+ # that translates the neighbouring key must translate these too.+ def test_auto_generate_transaction_name_keys_exist_beside_their_siblings+ {+ "settings.appearances.show.split_grouped_title" => %w[+ settings.appearances.show.auto_generate_transaction_names_title+ settings.appearances.show.auto_generate_transaction_names_description+ ],+ "transactions.form.description_placeholder" => %w[transactions.form.description_placeholder_optional]+ }.each do |sibling, keys|+ locales = I18n.available_locales.select { |locale| I18n.t(sibling, locale: locale, fallback: false, default: nil) }+ assert_includes locales, :de++ locales.each do |locale|+ missing = keys.reject { |key| I18n.t(key, locale: locale, fallback: false, default: nil) }+ assert_empty missing, "missing in #{locale}: #{missing.join(", ")}"+ end+ end+ end+def test_trade_republic_activity_labels_exist_for_each_localerequired_labels = %w[contribution withdrawal interest dividend card_payment cash_withdrawaldiff --git a/test/models/entry_test.rb b/test/models/entry_test.rbindex 2e935c2180..fa841bbf62 100644--- a/test/models/entry_test.rb+++ b/test/models/entry_test.rb@@ -48,6 +48,189 @@ class EntryTest < ActiveSupport::TestCaseassert_not_nil category.reload.last_used_atend+ test "blank name is invalid when auto-generate transaction names is off" do+ families(:dylan_family).update!(auto_generate_transaction_names: false)++ entry = Entry.new(+ account: accounts(:depository),+ name: "",+ date: Date.current,+ currency: "USD",+ amount: 100,+ entryable: Transaction.new+ )++ assert_not entry.valid?+ assert_includes entry.errors[:name], "can't be blank"+ end++ test "auto-generates name from merchant when blank and merchant is set" do+ families(:dylan_family).update!(auto_generate_transaction_names: true)++ entry = create_transaction(+ account: accounts(:depository),+ name: "",+ merchant: merchants(:netflix)+ )++ assert_equal merchants(:netflix).name, entry.name+ end++ test "auto-generates name from category when blank and only category is set" do+ families(:dylan_family).update!(auto_generate_transaction_names: true)++ entry = create_transaction(+ account: accounts(:depository),+ name: "",+ category: categories(:food_and_drink)+ )++ assert_equal categories(:food_and_drink).display_name, entry.name+ end++ test "blank name is still invalid when auto-generate is on but neither merchant nor category is set" do+ families(:dylan_family).update!(auto_generate_transaction_names: true)++ entry = Entry.new(+ account: accounts(:depository),+ name: "",+ date: Date.current,+ currency: "USD",+ amount: 100,+ entryable: Transaction.new+ )++ assert_not entry.valid?+ assert_includes entry.errors[:name], "can't be blank"+ end++ test "combines merchant and category with a dash when both are set" do+ families(:dylan_family).update!(auto_generate_transaction_names: true)++ entry = create_transaction(+ account: accounts(:depository),+ name: "",+ merchant: merchants(:netflix),+ category: categories(:food_and_drink)+ )++ assert_equal "#{categories(:food_and_drink).display_name} - #{merchants(:netflix).name}", entry.name+ end++ test "does not overwrite an explicitly provided name even when auto-generate is on" do+ families(:dylan_family).update!(auto_generate_transaction_names: true)++ entry = create_transaction(+ account: accounts(:depository),+ name: "Explicit name",+ merchant: merchants(:netflix)+ )++ assert_equal "Explicit name", entry.name+ end++ test "generic_name? is true for the auto-generated fallback label" do+ entry = create_transaction(account: accounts(:depository), name: I18n.t("transactions.unknown_name"))++ assert entry.generic_name?+ end++ test "generic_name? is true when the name exactly matches the entry's category" do+ entry = create_transaction(+ account: accounts(:depository),+ name: categories(:food_and_drink).display_name,+ category: categories(:food_and_drink)+ )++ assert entry.generic_name?+ end++ test "generic_name? is false for a distinguishing name" do+ entry = create_transaction(account: accounts(:depository), name: "Starbucks #4521")++ assert_not entry.generic_name?+ end++ test "generic_name? recognizes the unknown-name fallback saved under a different locale" do+ entry = create_transaction(account: accounts(:depository), name: "Unbekannte Transaktion")++ assert entry.generic_name?+ end++ test "generic_name? recognizes a category name saved under a different locale" do+ entry = create_transaction(+ account: accounts(:depository),+ name: "Restaurants & Bars", # German translation of categories(:food_and_drink)+ category: categories(:food_and_drink)+ )++ assert entry.generic_name?+ end++ test "does not auto-generate a name for an already-persisted entry" do+ families(:dylan_family).update!(auto_generate_transaction_names: true)+ entry = create_transaction(account: accounts(:depository), name: "Original name")++ entry.entryable.category = categories(:food_and_drink)+ entry.name = ""++ assert_not entry.valid?+ assert_includes entry.errors[:name], "can't be blank"+ end++ test "does not auto-generate a name for an imported entry" do+ families(:dylan_family).update!(auto_generate_transaction_names: true)+ import = imports(:transaction)++ entry = Entry.new(+ account: accounts(:depository),+ import: import,+ name: "",+ date: Date.current,+ currency: "USD",+ amount: 100,+ entryable: Transaction.new(category: categories(:food_and_drink))+ )++ assert_not entry.valid?+ assert_includes entry.errors[:name], "can't be blank"+ end++ test "does not auto-generate a name for a provider-synced entry" do+ families(:dylan_family).update!(auto_generate_transaction_names: true)++ entry = Entry.new(+ account: accounts(:depository),+ external_id: "plaid_txn_123",+ source: "plaid",+ name: "",+ date: Date.current,+ currency: "USD",+ amount: 100,+ entryable: Transaction.new(category: categories(:food_and_drink))+ )++ assert_not entry.valid?+ assert_includes entry.errors[:name], "can't be blank"+ end++ test "set_default_name does not raise when entryable is missing" do+ families(:dylan_family).update!(auto_generate_transaction_names: true)++ entry = Entry.new(+ account: accounts(:depository),+ entryable_type: "Transaction",+ name: "",+ date: Date.current,+ currency: "USD",+ amount: 100+ )++ assert_nothing_raised { entry.valid? }+ assert_not entry.valid?+ assert_includes entry.errors[:name], "can't be blank"+ end+test "descriptive edits do not affect balances" doentry = create_transaction(account: accounts(:depository), amount: 100)entry = Entry.find(entry.id)diff --git a/test/models/transaction/grouper/by_merchant_or_name_test.rb b/test/models/transaction/grouper/by_merchant_or_name_test.rbindex adb6320fa1..49367824aa 100644--- a/test/models/transaction/grouper/by_merchant_or_name_test.rb+++ b/test/models/transaction/grouper/by_merchant_or_name_test.rb@@ -119,6 +119,29 @@ class Transaction::Grouper::ByMerchantOrNameTest < ActiveSupport::TestCaseassert_equal "Netflix", groups.last.grouping_keyend+ test "does not merge unrelated transactions that share the generic fallback name" do+ create_transaction(account: @account, name: I18n.t("transactions.unknown_name"))+ create_transaction(account: @account, name: I18n.t("transactions.unknown_name"))++ groups = Transaction::Grouper::ByMerchantOrName.call(@family.entries)++ assert_equal 2, groups.size+ assert groups.all? { |g| g.entries.size == 1 }+ assert(groups.all? { |g| g.grouping_key == I18n.t("transactions.unknown_name") })+ end++ test "still groups matching non-generic names together" do+ create_transaction(account: @account, name: "AMZN MKTP US")+ create_transaction(account: @account, name: "AMZN MKTP US")+ create_transaction(account: @account, name: I18n.t("transactions.unknown_name"))++ groups = Transaction::Grouper::ByMerchantOrName.call(@family.entries)++ assert_equal 2, groups.size+ amzn_group = groups.find { |g| g.grouping_key == "AMZN MKTP US" }+ assert_equal 2, amzn_group.entries.size+ end+test "respects limit and offset" docreate_transaction(account: @account, name: "A")create_transaction(account: @account, name: "B")