fix(plan): keep retired category usable when editing an entry's note
Update validates the category only when it changes, so a note-only edit on an entry whose category was later hidden/deleted no longer 400s. The edit select also shows the current (retired) category marked '(skryta)' instead of silently snapping to the first active option; create defaults to an active category. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -502,7 +502,9 @@ export async function updateEntry(
|
||||
return { error: "Datum do musí být stejné nebo po datumu od", status: 400 };
|
||||
}
|
||||
|
||||
if (input.category) {
|
||||
// Only validate the category when it actually changes — so editing just the
|
||||
// note of an entry whose category was later retired/hidden still saves.
|
||||
if (input.category && input.category !== existing.category) {
|
||||
const catErr = await assertActiveCategory(input.category);
|
||||
if (catErr) return catErr;
|
||||
}
|
||||
@@ -695,7 +697,8 @@ export async function updateOverride(
|
||||
const lock = assertNotPastDate(dateStr, force);
|
||||
if (lock) return lock;
|
||||
|
||||
if (input.category) {
|
||||
// Only validate the category when it actually changes (see updateEntry).
|
||||
if (input.category && input.category !== existing.category) {
|
||||
const catErr = await assertActiveCategory(input.category);
|
||||
if (catErr) return catErr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user