fix(recipes): two bugs in recipe categories (v0.8.1)
Bug 1: update_recipe(category_ids=[]) didn't remove categories - Fixed: send empty string "" to API to remove all categories - Non-empty lists continue to work as expected - Verified via FW_DEBUG=1 testing Bug 2: get_recipe_categories() only showed used categories - Fixed: always return 5 free-tier standard categories - Added _get_family_id() helper to extract family ID - Now returns all available category IDs even on new accounts - Standard categories: category/<familyId>_2 through _6 Version: 0.8.0 → 0.8.1 Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -160,7 +160,9 @@ def build_create_params(
|
||||
if url is not None:
|
||||
params["recipe.url"] = url
|
||||
if category_ids is not None:
|
||||
params["recipe.recipeCategoryIdList"] = category_ids
|
||||
# For create: empty list just means no categories (don't send parameter).
|
||||
if len(category_ids) > 0:
|
||||
params["recipe.recipeCategoryIdList"] = category_ids
|
||||
return params
|
||||
|
||||
|
||||
@@ -225,5 +227,11 @@ def build_update_params(
|
||||
if url is not None:
|
||||
params["recipe.url"] = url
|
||||
if category_ids is not None:
|
||||
params["recipe.recipeCategoryIdList"] = category_ids
|
||||
# Empty list: send empty string to remove all categories.
|
||||
# Non-empty list: send as-is (httpx sends list values multiple times).
|
||||
# Verified via testing: empty string "" removes categories, empty list [] does not.
|
||||
if len(category_ids) == 0:
|
||||
params["recipe.recipeCategoryIdList"] = ""
|
||||
else:
|
||||
params["recipe.recipeCategoryIdList"] = category_ids
|
||||
return params
|
||||
|
||||
Reference in New Issue
Block a user