mealie-recipes / mealie

Mealie is a self hosted recipe manager and meal planner with a RestAPI backend and a reactive frontend application built in Vue for a pleasant user experience for the whole family. Easily add recipes into your database by providing the url and mealie will automatically import the relevant data or add a family recipe with the UI editor
https://docs.mealie.io
GNU Affero General Public License v3.0
5.59k stars 608 forks source link

fix: Comments Disappear After Edit #3767

Closed michael-genson closed 1 week ago

michael-genson commented 1 week ago

What type of PR is this?

(REQUIRED)

What this PR does / why we need it:

(REQUIRED)

As reported in https://github.com/mealie-recipes/mealie/issues/3766, comments don't update properly if they're created/updated right before another recipe edit. This is because the recipe's state isn't updated, so when it sends the PUT request it sends the old data.

I noticed while testing that comments are hidden to anonymous users, so I re-enabled them. They still can't post their own comment, of course. There is a consequence to our logic though: if another user from a different group visits the recipe, they can comment (since they're logged-in). I think this makes sense? I don't see a reason to prevent this behavior.

Which issue(s) this PR fixes:

(REQUIRED)

Fixes https://github.com/mealie-recipes/mealie/issues/3766

Special notes for your reviewer:

(fill-in or delete this section)

Testing

(fill-in or delete this section)

Manually, including the cross-group comment.