fix: get_categories always includes custom categories (v0.4.12)
Custom categories (rights.canDelete=true) have no locale field set by the API and were silently excluded by the locale filter. They now bypass both the locale and taskListType filters so they always appear in get_categories output regardless of the locale parameter. Also: deleted 7 test categories (TEmojiApple, Obst & Gemüse (old), TestKategorie, ProbeKat2, [TEST]emoji=apple, ProbeKat1, TDelMeta) and restored 'Obst & Gemüse' (emoji 🍎) as a clean custom category. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -391,12 +391,17 @@ def get_categories(list_id: str, locale: str = "de") -> str:
|
||||
# Filter by locale (exact match) and taskListType (when known).
|
||||
# sortingIndexByTaskList is NOT used for filtering: all categories are
|
||||
# assigned to all lists regardless of type, making it an unreliable signal.
|
||||
#
|
||||
# Custom categories (rights.canDelete=true) bypass both filters: they have
|
||||
# no locale or taskListType set by the API and must always be returned.
|
||||
matched: list[tuple[int, dict[str, Any]]] = []
|
||||
for cat in raw_cats:
|
||||
if cat.get("locale") != locale:
|
||||
continue
|
||||
if list_type is not None and cat.get("taskListType") != list_type:
|
||||
continue
|
||||
is_custom = cat.get("rights", {}).get("canDelete") == "true"
|
||||
if not is_custom:
|
||||
if cat.get("locale") != locale:
|
||||
continue
|
||||
if list_type is not None and cat.get("taskListType") != list_type:
|
||||
continue
|
||||
sort_val = int(cat.get("initialSortingIndex") or 0)
|
||||
matched.append((sort_val, cat))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user