fix(meal-plan) Share via list-shareable using a generic ShareDialog #52
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "generic-share-dialog"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Merge order: merge #47 (shopping lists) first. This branch is based on
001-shopping-lists, because it needs what #47 introduces (GET /user/list-shareablein the app,CompactUserModel,UserDisplayModel,IconButton'stouchTarget). Until #47 is merged, the diff below also shows #47's changes; its own changes are024a898and8d21e3b. After #47 is in, this PR's diff shrinks to those two commits.Fixes #46. Follow-up to the review of #47 (comment on
ShoppingListShareDialog: "isn't this basically the same as for meal plans? Something to generalize?").The bug (#46)
MealPlanShareDialogloaded its user list withfetchAllUsers()(GET /user/all), which is admin-only: for every other user it returned 403 and the user dropdown stayed empty, so non-admins could not share a meal plan. Verified against the dev backend: asuser,GET /user/all→ 403,GET /user/list-shareable→ 200.Changes
hooks/useShareableUsers: loads the share candidates fromGET /user/list-shareable(any authenticated user) once on mount, withreload. Used by both dialogs; this is the fix.basics/ShareDialog: one generic "Teilen" dialog, generic over the permission enum:ShoppingListShareDialog: now a thin wrapper. Same behaviour as before: owner row, two levels, the context's mutations and error texts.MealPlanShareDialog: now a thin wrapper with the three meal plan levels. Meal plans gain:MealPlanPagegets a handler that callssaveMealPlanSharewith id and version; the API already supported it. A concurrent change gives a 409 and an inline message.A meal plan carries no owner name, so it has no owner row. Errors are now shown inline; before they surfaced as unhandled promise rejections.
docs/architecture.mdupdated:ShareDialog,useShareableUsers,MealPlanShareDialog.BasicDialogscrolls when taller than the screen (8d21e3b): the overlay scrolls and the card is centred withmy-autoinstead ofitems-center. A dialog that fits stays centred; a taller one starts at the top and scrolls to its actions. Affects every dialog; found while verifying this PR on a phone in landscape. Verified: short dialogs still centred, backdrop click still closes, the tall share dialog scrolls from its close button to "Hinzufügen", no horizontal overflow on the five viewports.Verification
npm run build,npm run lint(only the 2 existing warnings inMealPlanDayProvider) andnpm run test(372 tests) pass./verify-uias the non-adminuser:pro, changing the level to Vollzugriff and removing the share all work, with no errors.BasicDialogcouldn't scroll. Fixed in8d21e3b(below).🤖 Generated with Claude Code