[PR #376] [CLOSED] [WIP] No longer allow duplicate account names #3097

Closed
opened 2026-02-28 20:36:18 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/376
Author: @CharlesEkkel
Created: 10/29/2022
Status: Closed

Base: masterHead: feature/disallow-duplicate-account-names


📝 Commits (7)

  • bff5bc1 feat: validation check for existing account names
  • dca3013 Merge branch 'master' into feature/disallow-duplicate-account-names
  • 28bf9c6 Merge branch 'actualbudget:master' into feature/disallow-duplicate-account-names
  • 4eb435e feat: disallow creating duplicate accounts in loot-core
  • a28f4ff fix: export custom notification
  • b785cbb fix: remove incorrect autoformatting
  • 98eec34 fix: forgot to propogate error in one place

📊 Changes

7 files changed (+75 additions, -12 deletions)

View changed files

📝 packages/desktop-client/src/components/Modals.js (+1 -0)
📝 packages/loot-core/src/client/actions/notifications.js (+9 -0)
📝 packages/loot-core/src/client/actions/queries.js (+27 -6)
📝 packages/loot-core/src/server/db/index.js (+18 -1)
📝 packages/loot-core/src/server/main.js (+4 -2)
📝 packages/loot-core/src/shared/accounts.js (+10 -0)
📝 packages/loot-design/src/components/modals/CreateLocalAccount.js (+6 -3)

📄 Description

Description

Issue #316 has demonstrated that duplicate account names are currently permitted - the existing behaviour is that following the creation of duplicate accounts, there will henceforth be two entries in any autocompletion dropdown with the same name. They are logically distinct, but difficult to differentiate.

Please note that given this is my first PR for this repo, I'd very much appreciate feedback on how to improve it! I figured I'd start with something small.

Changes

  • Added a new validation rule which checks if the incoming account name matches any of the existing accounts.
  • Added a function in packages/loot-core/src/shared/accounts.js which returns different validation error messages based on an input errors.name. I've done this to move the conditional logic out of the component and make it easier to add more validation rules in future if necessary.
  • The default error message is the same as the one for 'required' because this is the current behaviour (currently the value of the error name is not checked at all). I'm happy to add a different default message to be more comprehensive if necessary.

Demo and Screenshots

See a demo running this code here: https://actual-demo.fly.dev

2022-10-29T12:34:02,800958803+11:00


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/actualbudget/actual/pull/376 **Author:** [@CharlesEkkel](https://github.com/CharlesEkkel) **Created:** 10/29/2022 **Status:** ❌ Closed **Base:** `master` ← **Head:** `feature/disallow-duplicate-account-names` --- ### 📝 Commits (7) - [`bff5bc1`](https://github.com/actualbudget/actual/commit/bff5bc199ccf88aec9b3460db0ef16ce63fb9702) feat: validation check for existing account names - [`dca3013`](https://github.com/actualbudget/actual/commit/dca3013eaa5d61d34671efde6ef76e9f408a597d) Merge branch 'master' into feature/disallow-duplicate-account-names - [`28bf9c6`](https://github.com/actualbudget/actual/commit/28bf9c66f00530c1853e8e45fb7b914c33d88c9f) Merge branch 'actualbudget:master' into feature/disallow-duplicate-account-names - [`4eb435e`](https://github.com/actualbudget/actual/commit/4eb435e9e6b047a3bdd6c78dd83082c3cea2520c) feat: disallow creating duplicate accounts in loot-core - [`a28f4ff`](https://github.com/actualbudget/actual/commit/a28f4ff24c9db05bdd35d43f2b5c60d25ccf9c4a) fix: export custom notification - [`b785cbb`](https://github.com/actualbudget/actual/commit/b785cbbfdadaf2a57d5dddb7db2d71d3f0f1086f) fix: remove incorrect autoformatting - [`98eec34`](https://github.com/actualbudget/actual/commit/98eec3428323772cb1ffe6397d49e65f28a9c273) fix: forgot to propogate error in one place ### 📊 Changes **7 files changed** (+75 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `packages/desktop-client/src/components/Modals.js` (+1 -0) 📝 `packages/loot-core/src/client/actions/notifications.js` (+9 -0) 📝 `packages/loot-core/src/client/actions/queries.js` (+27 -6) 📝 `packages/loot-core/src/server/db/index.js` (+18 -1) 📝 `packages/loot-core/src/server/main.js` (+4 -2) 📝 `packages/loot-core/src/shared/accounts.js` (+10 -0) 📝 `packages/loot-design/src/components/modals/CreateLocalAccount.js` (+6 -3) </details> ### 📄 Description ## Description Issue #316 has demonstrated that duplicate account names are currently permitted - the existing behaviour is that following the creation of duplicate accounts, there will henceforth be two entries in any autocompletion dropdown with the same name. They are logically distinct, but difficult to differentiate. Please note that given this is my first PR for this repo, I'd very much appreciate feedback on how to improve it! I figured I'd start with something small. ## Changes - Added a new validation rule which checks if the incoming account name matches any of the existing accounts. - Added a function in `packages/loot-core/src/shared/accounts.js` which returns different validation error messages based on an input `errors.name`. I've done this to move the conditional logic out of the component and make it easier to add more validation rules in future if necessary. - The default error message is the same as the one for `'required'` because this is the current behaviour (currently the value of the error name is not checked at all). I'm happy to add a different default message to be more comprehensive if necessary. ## Demo and Screenshots See a demo running this code here: https://actual-demo.fly.dev ![2022-10-29T12:34:02,800958803+11:00](https://user-images.githubusercontent.com/54133784/198781814-03d8aad6-c623-4ea3-a07d-bc4449230d36.png) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-02-28 20:36:18 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#3097