Skip to content

Comments

fix: publish all mealplan create, update, and delete events#7015

Open
francisferrell wants to merge 2 commits intomealie-recipes:mealie-nextfrom
francisferrell:notify-mealplan-crud
Open

fix: publish all mealplan create, update, and delete events#7015
francisferrell wants to merge 2 commits intomealie-recipes:mealie-nextfrom
francisferrell:notify-mealplan-crud

Conversation

@francisferrell
Copy link

What this PR does / why we need it:

The goal of this PR is to have notifier events for all create, update, and delete API endpoints of the mealplan.

  • POST /api/households/mealplans/random now publishes the notifier event for creation of the mealplan same as POST /api/households/mealplans already does
  • PUT /api/households/mealplans/{item_id} now publishes a new notifier event for mealplan update
  • DELETE /api/households/mealplans/{item_id} now publishes a new notifier event for mealplan update
  • notifier settings GUI now has 3 check boxes for whether or not the corresponding CUD operations should publish their events

I'm not sure how to answer "Include anything here that you didn't include in Release Notes above". Also, there isn't a release notes section above. Sorry, at a loss here.

Before
issue 6914 before

After
issue 6914 after

Which issue(s) this PR fixes:

Fixes #6914

Special notes for your reviewer:

I'm a first time Mealie contributor. Most of this changeset was achieved by recursive grep for mealplan\w*created and then duplicating what I found with -updated and -deleted, without actually understanding the code in question. I have relatively low confidence that I touched every part of the project that this fix actually needs.

I have zero experience with alembic. I'm not confident that the change I made is complete from a database perspective.

I don't know if I should manually update docs/docs/overrides/api.html or if it is auto-generated, but it had a hit on my grep and I skipped it because it's like 360k characters on one line.

Testing

First I started up a troubleshooting tool...

docker run -p 8080:8080 --rm -t mendhak/http-https-echo

... and configured a notifier with the apprise address json://localhost:8080, the http echo container. Then, I recreated the behavior described in #6914.

After making the code changes in this PR, I tested different scenarios, again using the http echo container as a notification receiver.

Smooth migration for existing notifiers

  • the exiting notifier in the UI had Create checked, so the migration didn't regress it
  • the existing notifier in the UI had Update and Delete unchecked, so the default of False works as expected

Events happen as expected when all 3 are checked:

  • clicking + in the UI still fires an event, as it did before this change
  • clicking Random dinner or Random side in the UI fires the same type of event as the +, where it did not before
  • modifying the mealplan fires the new Updated event
  • deleting the mealplan fires the new Deleted event

Events happen only for what was checked in the notifier settings:

  • for each check box Create, Update, and Delete, only check one
  • create, update, and delete mealplans and observe that only the event corresponding to the checked event type is actually published, the other 2 are not published

Events happen whether the mealplan has a recipe or not

  • go through full create, update, and delete cycles and observe that all events are published when a recipe is selected for the mealplan
  • go through full create, update, and delete cycles and observe that all events are published when the mealplan is "note only" with the 2 text fields filled in

@github-actions github-actions bot added the bugfix label Feb 6, 2026
This adds publising of event notifiers for mealplan creation using the
/random API endpoint. This also adds new event types for mealplan update
and deletion.
This changes EventMealplanCreatedData and the Update and Delete variants
from the previous commit to be like other event types with just
EventMealplanData and the caller providing the EventOperation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] - Notifier for meal plan not firing when meals are planned

1 participant