Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Update field structure so notes is displayed in its own category (#1404)

Leendert de Borst510a220a5a89
diff --git a/apps/browser-extension/src/entrypoints/popup/components/Credentials/Details/FieldBlock.tsx b/apps/browser-extension/src/entrypoints/popup/components/Credentials/Details/FieldBlock.tsx
index 165eab43c..22d08a3f6 100644
--- a/apps/browser-extension/src/entrypoints/popup/components/Credentials/Details/FieldBlock.tsx
+++ b/apps/browser-extension/src/entrypoints/popup/components/Credentials/Details/FieldBlock.tsx
@@ -12,6 +12,8 @@ import FieldHistoryModal from './FieldHistoryModal';
type FieldBlockProps = {
field: ItemField;
itemId?: string;
+ /** Whether to hide the label (useful when label is already shown as section header) */
+ hideLabel?: boolean;
}
/**
@@ -30,7 +32,7 @@ const convertUrlsToLinks = (text: string): string => {
* Dynamic field block component that renders based on field type.
* Uses the same FormInputCopyToClipboard component as existing credential blocks.
*/
-const FieldBlock: React.FC<FieldBlockProps> = ({ field, itemId }) => {
+const FieldBlock: React.FC<FieldBlockProps> = ({ field, itemId, hideLabel = false }) => {
const { t } = useTranslation();
const dbContext = useDb();
const [showHistoryModal, setShowHistoryModal] = useState(false);
@@ -131,9 +133,11 @@ const FieldBlock: React.FC<FieldBlockProps> = ({ field, itemId }) => {
// Use NotesBlock-style rendering for multi-line text
return (
<div>
- <label className="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">
- {label}
- </label>
+ {!hideLabel && (
+ <label className="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">
+ {label}
+ </label>
+ )}
<div className="p-4 bg-gray-50 rounded-lg dark:bg-gray-700">
<p
className="text-gray-900 dark:text-gray-100 whitespace-pre-wrap"
diff --git a/apps/browser-extension/src/entrypoints/popup/pages/credentials/ItemAddEdit.tsx b/apps/browser-extension/src/entrypoints/popup/pages/credentials/ItemAddEdit.tsx
index 6396206d2..ff2fe0af8 100644
--- a/apps/browser-extension/src/entrypoints/popup/pages/credentials/ItemAddEdit.tsx
+++ b/apps/browser-extension/src/entrypoints/popup/pages/credentials/ItemAddEdit.tsx
@@ -227,10 +227,10 @@ const ItemAddEdit: React.FC = () => {
}, [item]);
/**
- * The notes field (metadata.notes) - handled separately for collapsible UI.
+ * The notes field (notes.content) - handled separately for collapsible UI.
*/
const notesField = useMemo(() => {
- return applicableSystemFields.find(field => field.FieldKey === 'metadata.notes');
+ return applicableSystemFields.find(field => field.FieldKey === 'notes.content');
}, [applicableSystemFields]);
/**
@@ -270,7 +270,11 @@ const ItemAddEdit: React.FC = () => {
const groups: Record<string, typeof applicableSystemFields> = {};
applicableSystemFields.forEach(field => {
- // Skip metadata fields (notes) - handled separately
+ // Skip notes fields - handled separately
+ if (field.Category === FieldCategories.Notes) {
+ return;
+ }
+ // Skip metadata fields - handled separately
if (field.Category === FieldCategories.Metadata) {
return;
}
@@ -329,7 +333,7 @@ const ItemAddEdit: React.FC = () => {
// Check if notes should be shown by default for this type
const typeFields = getSystemFieldsForItemType(effectiveType);
- const notesFieldDef = typeFields.find(f => f.FieldKey === 'metadata.notes');
+ const notesFieldDef = typeFields.find(f => f.FieldKey === 'notes.content');
if (notesFieldDef && isFieldShownByDefault(notesFieldDef, effectiveType)) {
setShowNotes(true);
}
@@ -750,9 +754,9 @@ const ItemAddEdit: React.FC = () => {
}
// Check if notes should be shown by default for the new type
- const newNotesField = newTypeFields.find(f => f.FieldKey === 'metadata.notes');
+ const newNotesField = newTypeFields.find(f => f.FieldKey === 'notes.content');
const notesShownByDefault = newNotesField ? isFieldShownByDefault(newNotesField, newType) : false;
- setShowNotes(notesShownByDefault || (isEditMode && !!fieldValues['metadata.notes']));
+ setShowNotes(notesShownByDefault || !!fieldValues['notes.content']);
// Update 2FA visibility - supported for types with login fields
const newTypeHasLoginFields = newTypeFields.some(f => f.FieldKey === 'login.username' || f.FieldKey === 'login.password');
@@ -775,7 +779,7 @@ const ItemAddEdit: React.FC = () => {
const handleRemoveNotesSection = useCallback(() => {
setFieldValues(prev => ({
...prev,
- 'metadata.notes': ''
+ 'notes.content': ''
}));
setShowNotes(false);
}, []);
@@ -961,9 +965,11 @@ const ItemAddEdit: React.FC = () => {
case FieldTypes.TextArea:
return wrapWithRemoveButton(
<div>
- <label htmlFor={fieldKey} className="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">
- {label}
- </label>
+ {label && (
+ <label htmlFor={fieldKey} className="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">
+ {label}
+ </label>
+ )}
<textarea
id={fieldKey}
value={stringValue}
@@ -1226,7 +1232,7 @@ const ItemAddEdit: React.FC = () => {
)}
{/* Notes Section */}
- {notesField && (showNotes || isEditMode || fieldValues['metadata.notes']) && (
+ {notesField && (showNotes || fieldValues['notes.content']) && (
<FormSection
title={t('credentials.notes')}
actions={
@@ -1247,7 +1253,7 @@ const ItemAddEdit: React.FC = () => {
>
{renderFieldInput(
notesField.FieldKey,
- t(`fieldLabels.${notesField.FieldKey}`, { defaultValue: notesField.FieldKey }),
+ '', // No label - FormSection title is sufficient
notesField.FieldType,
notesField.IsHidden,
notesField.IsMultiValue
diff --git a/apps/browser-extension/src/entrypoints/popup/pages/credentials/ItemDetails.tsx b/apps/browser-extension/src/entrypoints/popup/pages/credentials/ItemDetails.tsx
index 71067bc1f..a90258243 100644
--- a/apps/browser-extension/src/entrypoints/popup/pages/credentials/ItemDetails.tsx
+++ b/apps/browser-extension/src/entrypoints/popup/pages/credentials/ItemDetails.tsx
@@ -235,6 +235,17 @@ const ItemDetails: React.FC = (): React.ReactElement => {
))}
</div>
)}
+
+ {groupedFields[FieldCategories.Notes] && groupedFields[FieldCategories.Notes].length > 0 && (
+ groupedFields[FieldCategories.Notes].map((field) => (
+ <div key={field.FieldKey} className="space-y-2">
+ <h2 className="text-xl font-semibold text-gray-900 dark:text-white">
+ {t(`fieldLabels.${field.FieldKey}`, { defaultValue: field.Label || field.FieldKey })}
+ </h2>
+ <FieldBlock field={field} itemId={item.Id} hideLabel />
+ </div>
+ ))
+ )}
</>
)}
diff --git a/apps/browser-extension/src/i18n/locales/en.json b/apps/browser-extension/src/i18n/locales/en.json
index 39a80188b..5fbe63754 100644
--- a/apps/browser-extension/src/i18n/locales/en.json
+++ b/apps/browser-extension/src/i18n/locales/en.json
@@ -360,7 +360,7 @@
"card.expiry_year": "Expiry Year",
"card.cvv": "CVV",
"card.pin": "PIN",
- "metadata.notes": "Notes"
+ "notes.content": "Notes"
},
"totp": {
"addCode": "Add 2FA Code",
diff --git a/apps/browser-extension/src/utils/dist/core/models/vault/index.d.ts b/apps/browser-extension/src/utils/dist/core/models/vault/index.d.ts
index 5471bc7c1..98f6fd3ca 100644
--- a/apps/browser-extension/src/utils/dist/core/models/vault/index.d.ts
+++ b/apps/browser-extension/src/utils/dist/core/models/vault/index.d.ts
@@ -290,6 +290,11 @@ declare const FieldKey: {
* Type: Date
*/
readonly AliasBirthdate: "alias.birthdate";
+ /**
+ * Notes content field
+ * Type: TextArea
+ */
+ readonly NotesContent: "notes.content";
};
/**
* Type representing all valid field key values
@@ -404,7 +409,7 @@ declare function hasField(item: Item, fieldKey: string): boolean;
*/
declare function groupFields(item: Item, grouper: (field: ItemField) => string): Record<string, ItemField[]>;
/**
- * Group fields by standard categories (Login, Alias, Card, Custom)
+ * Group fields by standard categories (Login, Alias, Card, Notes, Custom)
*/
declare function groupFieldsByCategory(item: Item): Record<string, ItemField[]>;
/**
@@ -431,6 +436,7 @@ declare const FieldCategories: {
readonly Alias: "Alias";
readonly Card: "Card";
readonly Custom: "Custom";
+ readonly Notes: "Notes";
readonly Metadata: "Metadata";
};
/**
diff --git a/apps/browser-extension/src/utils/dist/core/models/vault/index.js b/apps/browser-extension/src/utils/dist/core/models/vault/index.js
index 6fc8386bd..5005cd11d 100644
--- a/apps/browser-extension/src/utils/dist/core/models/vault/index.js
+++ b/apps/browser-extension/src/utils/dist/core/models/vault/index.js
@@ -143,7 +143,12 @@ var FieldKey = {
* Alias birth date field
* Type: Date
*/
- AliasBirthdate: "alias.birthdate"
+ AliasBirthdate: "alias.birthdate",
+ /**
+ * Notes content field
+ * Type: TextArea
+ */
+ NotesContent: "notes.content"
};
// src/vault/Item.ts
@@ -172,6 +177,7 @@ var FieldCategories = {
Alias: "Alias",
Card: "Card",
Custom: "Custom",
+ Notes: "Notes",
Metadata: "Metadata"
};
var SystemFieldRegistry = {
@@ -350,9 +356,9 @@ var SystemFieldRegistry = {
Category: FieldCategories.Card,
DefaultDisplayOrder: 60
},
- /* =================== METADATA FIELDS =================== */
- "metadata.notes": {
- FieldKey: "metadata.notes",
+ /* =================== NOTES FIELDS =================== */
+ "notes.content": {
+ FieldKey: "notes.content",
FieldType: "TextArea",
IsHidden: false,
IsMultiValue: false,
@@ -363,7 +369,7 @@ var SystemFieldRegistry = {
Note: { ShowByDefault: true }
},
EnableHistory: false,
- Category: FieldCategories.Metadata,
+ Category: FieldCategories.Notes,
DefaultDisplayOrder: 100
}
};
@@ -396,7 +402,7 @@ function getAllSystemFieldKeys() {
return Object.keys(SystemFieldRegistry);
}
function isSystemFieldPrefix(fieldKey) {
- return fieldKey.startsWith("login.") || fieldKey.startsWith("alias.") || fieldKey.startsWith("card.") || fieldKey.startsWith("identity.") || fieldKey.startsWith("api.") || fieldKey.startsWith("note.") || fieldKey.startsWith("metadata.");
+ return fieldKey.startsWith("login.") || fieldKey.startsWith("alias.") || fieldKey.startsWith("card.") || fieldKey.startsWith("identity.") || fieldKey.startsWith("api.") || fieldKey.startsWith("notes.") || fieldKey.startsWith("metadata.");
}
// src/vault/ItemMethods.ts
@@ -440,6 +446,12 @@ function groupFieldsByCategory(item) {
if (field.FieldKey.startsWith("card.")) {
return FieldCategories.Card;
}
+ if (field.FieldKey.startsWith("notes.")) {
+ return FieldCategories.Notes;
+ }
+ if (field.FieldKey.startsWith("metadata.")) {
+ return FieldCategories.Metadata;
+ }
return FieldCategories.Custom;
});
}
@@ -451,7 +463,7 @@ function itemToCredential(item) {
ServiceName: item.Name || "",
ServiceUrl: getFieldValue(item, FieldKey.LoginUrl),
Logo: item.Logo,
- Notes: getFieldValue(item, FieldKey.LoginNotes),
+ Notes: getFieldValue(item, FieldKey.NotesContent),
Alias: {
FirstName: getFieldValue(item, FieldKey.AliasFirstName),
LastName: getFieldValue(item, FieldKey.AliasLastName),
diff --git a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/models/FieldKey.kt b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/models/FieldKey.kt
index 7550b232d..d73dd82c4 100644
--- a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/models/FieldKey.kt
+++ b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/models/FieldKey.kt
@@ -148,4 +148,9 @@ object FieldKey {
* Type: Date.
*/
const val ALIAS_BIRTHDATE = "alias.birthdate"
+
+ /**
+ * Type: TextArea.
+ */
+ const val NOTES_CONTENT = "notes.content"
}
diff --git a/apps/mobile-app/ios/VaultModels/FieldKey.swift b/apps/mobile-app/ios/VaultModels/FieldKey.swift
index fede6fab2..2a5b2f649 100644
--- a/apps/mobile-app/ios/VaultModels/FieldKey.swift
+++ b/apps/mobile-app/ios/VaultModels/FieldKey.swift
@@ -90,4 +90,7 @@ public struct FieldKey {
/// Type: Date
public static let aliasBirthdate = "alias.birthdate"
+
+ /// Type: TextArea
+ public static let notesContent = "notes.content"
}
diff --git a/apps/mobile-app/utils/dist/core/models/vault/index.d.ts b/apps/mobile-app/utils/dist/core/models/vault/index.d.ts
index 5471bc7c1..98f6fd3ca 100644
--- a/apps/mobile-app/utils/dist/core/models/vault/index.d.ts
+++ b/apps/mobile-app/utils/dist/core/models/vault/index.d.ts
@@ -290,6 +290,11 @@ declare const FieldKey: {
* Type: Date
*/
readonly AliasBirthdate: "alias.birthdate";
+ /**
+ * Notes content field
+ * Type: TextArea
+ */
+ readonly NotesContent: "notes.content";
};
/**
* Type representing all valid field key values
@@ -404,7 +409,7 @@ declare function hasField(item: Item, fieldKey: string): boolean;
*/
declare function groupFields(item: Item, grouper: (field: ItemField) => string): Record<string, ItemField[]>;
/**
- * Group fields by standard categories (Login, Alias, Card, Custom)
+ * Group fields by standard categories (Login, Alias, Card, Notes, Custom)
*/
declare function groupFieldsByCategory(item: Item): Record<string, ItemField[]>;
/**
@@ -431,6 +436,7 @@ declare const FieldCategories: {
readonly Alias: "Alias";
readonly Card: "Card";
readonly Custom: "Custom";
+ readonly Notes: "Notes";
readonly Metadata: "Metadata";
};
/**
diff --git a/apps/mobile-app/utils/dist/core/models/vault/index.js b/apps/mobile-app/utils/dist/core/models/vault/index.js
index 6fc8386bd..5005cd11d 100644
--- a/apps/mobile-app/utils/dist/core/models/vault/index.js
+++ b/apps/mobile-app/utils/dist/core/models/vault/index.js
@@ -143,7 +143,12 @@ var FieldKey = {
* Alias birth date field
* Type: Date
*/
- AliasBirthdate: "alias.birthdate"
+ AliasBirthdate: "alias.birthdate",
+ /**
+ * Notes content field
+ * Type: TextArea
+ */
+ NotesContent: "notes.content"
};
// src/vault/Item.ts
@@ -172,6 +177,7 @@ var FieldCategories = {
Alias: "Alias",
Card: "Card",
Custom: "Custom",
+ Notes: "Notes",
Metadata: "Metadata"
};
var SystemFieldRegistry = {
@@ -350,9 +356,9 @@ var SystemFieldRegistry = {
Category: FieldCategories.Card,
DefaultDisplayOrder: 60
},
- /* =================== METADATA FIELDS =================== */
- "metadata.notes": {
- FieldKey: "metadata.notes",
+ /* =================== NOTES FIELDS =================== */
+ "notes.content": {
+ FieldKey: "notes.content",
FieldType: "TextArea",
IsHidden: false,
IsMultiValue: false,
@@ -363,7 +369,7 @@ var SystemFieldRegistry = {
Note: { ShowByDefault: true }
},
EnableHistory: false,
- Category: FieldCategories.Metadata,
+ Category: FieldCategories.Notes,
DefaultDisplayOrder: 100
}
};
@@ -396,7 +402,7 @@ function getAllSystemFieldKeys() {
return Object.keys(SystemFieldRegistry);
}
function isSystemFieldPrefix(fieldKey) {
- return fieldKey.startsWith("login.") || fieldKey.startsWith("alias.") || fieldKey.startsWith("card.") || fieldKey.startsWith("identity.") || fieldKey.startsWith("api.") || fieldKey.startsWith("note.") || fieldKey.startsWith("metadata.");
+ return fieldKey.startsWith("login.") || fieldKey.startsWith("alias.") || fieldKey.startsWith("card.") || fieldKey.startsWith("identity.") || fieldKey.startsWith("api.") || fieldKey.startsWith("notes.") || fieldKey.startsWith("metadata.");
}
// src/vault/ItemMethods.ts
@@ -440,6 +446,12 @@ function groupFieldsByCategory(item) {
if (field.FieldKey.startsWith("card.")) {
return FieldCategories.Card;
}
+ if (field.FieldKey.startsWith("notes.")) {
+ return FieldCategories.Notes;
+ }
+ if (field.FieldKey.startsWith("metadata.")) {
+ return FieldCategories.Metadata;
+ }
return FieldCategories.Custom;
});
}
@@ -451,7 +463,7 @@ function itemToCredential(item) {
ServiceName: item.Name || "",
ServiceUrl: getFieldValue(item, FieldKey.LoginUrl),
Logo: item.Logo,
- Notes: getFieldValue(item, FieldKey.LoginNotes),
+ Notes: getFieldValue(item, FieldKey.NotesContent),
Alias: {
FirstName: getFieldValue(item, FieldKey.AliasFirstName),
LastName: getFieldValue(item, FieldKey.AliasLastName),
diff --git a/apps/server/AliasVault.Client/Main/Models/Vault/FieldKey.cs b/apps/server/AliasVault.Client/Main/Models/Vault/FieldKey.cs
index 6121babcd..bb2b4366a 100644
--- a/apps/server/AliasVault.Client/Main/Models/Vault/FieldKey.cs
+++ b/apps/server/AliasVault.Client/Main/Models/Vault/FieldKey.cs
@@ -149,4 +149,9 @@ public static class FieldKey
/// Type: Date
/// </summary>
public const string AliasBirthdate = "alias.birthdate";
+
+ /// <summary>
+ /// Type: TextArea
+ /// </summary>
+ public const string NotesContent = "notes.content";
}
diff --git a/core/models/src/vault/FieldKey.ts b/core/models/src/vault/FieldKey.ts
index 990cefeb0..50c0f944c 100644
--- a/core/models/src/vault/FieldKey.ts
+++ b/core/models/src/vault/FieldKey.ts
@@ -186,6 +186,12 @@ export const FieldKey = {
* Type: Date
*/
AliasBirthdate: 'alias.birthdate',
+
+ /**
+ * Notes content field
+ * Type: TextArea
+ */
+ NotesContent: 'notes.content',
} as const;
/**
diff --git a/core/models/src/vault/ItemMethods.ts b/core/models/src/vault/ItemMethods.ts
index 50c53e976..9613ec648 100644
--- a/core/models/src/vault/ItemMethods.ts
+++ b/core/models/src/vault/ItemMethods.ts
@@ -58,7 +58,7 @@ export function groupFields(
}
/**
- * Group fields by standard categories (Login, Alias, Card, Custom)
+ * Group fields by standard categories (Login, Alias, Card, Notes, Custom)
*/
export function groupFieldsByCategory(item: Item): Record<string, ItemField[]> {
return groupFields(item, (field) => {
@@ -71,6 +71,12 @@ export function groupFieldsByCategory(item: Item): Record<string, ItemField[]> {
if (field.FieldKey.startsWith('card.')) {
return FieldCategories.Card;
}
+ if (field.FieldKey.startsWith('notes.')) {
+ return FieldCategories.Notes;
+ }
+ if (field.FieldKey.startsWith('metadata.')) {
+ return FieldCategories.Metadata;
+ }
return FieldCategories.Custom;
});
}
@@ -87,7 +93,7 @@ export function itemToCredential(item: Item): Credential {
ServiceName: item.Name || '',
ServiceUrl: getFieldValue(item, FieldKey.LoginUrl),
Logo: item.Logo,
- Notes: getFieldValue(item, FieldKey.LoginNotes),
+ Notes: getFieldValue(item, FieldKey.NotesContent),
Alias: {
FirstName: getFieldValue(item, FieldKey.AliasFirstName),
LastName: getFieldValue(item, FieldKey.AliasLastName),
diff --git a/core/models/src/vault/SystemFieldRegistry.ts b/core/models/src/vault/SystemFieldRegistry.ts
index 09d4e6c03..141b2d297 100644
--- a/core/models/src/vault/SystemFieldRegistry.ts
+++ b/core/models/src/vault/SystemFieldRegistry.ts
@@ -19,6 +19,7 @@ export const FieldCategories = {
Alias: 'Alias',
Card: 'Card',
Custom: 'Custom',
+ Notes: 'Notes',
Metadata: 'Metadata',
} as const;
@@ -243,9 +244,9 @@ export const SystemFieldRegistry: Record<string, SystemFieldDefinition> = {
DefaultDisplayOrder: 60
},
- /* =================== METADATA FIELDS =================== */
- 'metadata.notes': {
- FieldKey: 'metadata.notes',
+ /* =================== NOTES FIELDS =================== */
+ 'notes.content': {
+ FieldKey: 'notes.content',
FieldType: 'TextArea',
IsHidden: false,
IsMultiValue: false,
@@ -256,7 +257,7 @@ export const SystemFieldRegistry: Record<string, SystemFieldDefinition> = {
Note: { ShowByDefault: true }
},
EnableHistory: false,
- Category: FieldCategories.Metadata,
+ Category: FieldCategories.Notes,
DefaultDisplayOrder: 100
}
};
@@ -348,6 +349,6 @@ export function isSystemFieldPrefix(fieldKey: string): boolean {
fieldKey.startsWith('card.') ||
fieldKey.startsWith('identity.') ||
fieldKey.startsWith('api.') ||
- fieldKey.startsWith('note.') ||
+ fieldKey.startsWith('notes.') ||
fieldKey.startsWith('metadata.');
}