Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: "I Made This" Dialog #1801

Merged
merged 10 commits into from
Nov 13, 2022

Conversation

michael-genson
Copy link
Collaborator

What type of PR is this?

(REQUIRED)

  • feature

What this PR does / why we need it:

(REQUIRED)

This adds a "Last Made" property to recipes and a new "I Made This" dialog on the recipe page. It creates a new event on the recipe event timeline and updates the recipe's lastMade timestamp to today (unless the user chooses a specific date).

The last made date is also displayed on the recipe page, and recipes can be sorted by this property.
image
Works on both landscape and non-landscape view, and does not appear on the public recipe page. The date format is localized

image
If the recipe has never been made

image
The comment isn't viewable in the UI yet, pending a recipe timeline view

Which issue(s) this PR fixes:

(REQUIRED)

Works towards #1451. This utilizes the timeline API, but does not implement the timeline frontend.

Special notes for your reviewer:

(fill-in or delete this section)

Originally I had this in the recipe Action/Context menus, but I moved it to the recipe header/title instead since I think it works better there. It also made manipulating the last made date significantly easier.

I wasn't sure how to add new text localizations, so at the moment everything is just in English. If we want to add localizations in this PR I'm happy to do so, if you could help point me in the right direction. Not too much text was added, and it was only added in two places (the new component and the sort menu) so it should be pretty easy.

Also, to avoid the plugin conflict we talked about on discord, I modified the timeline event API to use event_message instead of message. This ended up being the easiest solution by far, since the plugin directly accesses the POST response. I also needed a new database migration for this PR anyway.

Testing

(fill-in or delete this section)

I ran through the following scenarios:

  1. Verify the dialog reactively updates the "last made" date without a refresh
  2. Verify if the last made date is updated, then the user edits and saves the recipe without leaving the page, then the last made date is still the new date and not the old one (i.e. checking for the issue in [v1.0.0b] - Rating is discarded if recipe is edited upon creating #1397)
  3. Verify the dialog can't be accessed when the recipe is being viewed publicly (i.e. there is no user)

Release Notes

(REQUIRED)

added tracking for when a recipe was last made ("I made this")
added sorting recipes by last made date

changed timeline event "message" -> "event_message"
added "last made" timestamp to recipe
removed references in action menu and context menu
refactored dialog to be triggered by a button instead
added route to update recipe last made timestamp
added visual for last made timestamp to recipe header and title
Copy link
Collaborator

@hay-kot hay-kot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me overall. Just need to take another look at the Migration and see if we can use a Pydantic Alias to avoid altering the column since SQLite doesn't support that feature which will put is in a weird state.

@michael-genson
Copy link
Collaborator Author

@hay-kot should be good now :)

@hay-kot hay-kot merged commit a2dcdc1 into mealie-recipes:mealie-next Nov 13, 2022
@michael-genson michael-genson deleted the feat/I-made-this branch November 14, 2022 01:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants