modrinth / code

The Modrinth monorepo containing all code which powers Modrinth!
https://modrinth.com
Other
920 stars 171 forks source link

Deleted versions still influence `updated:` #2766

Open triphora opened 3 years ago

triphora commented 3 years ago

Describe the bug In my testing for #205 over on Knossos, I found that the updated field of projects is not changed upon deletion of a version.

To Reproduce Steps to reproduce the behavior:

  1. Note the updated datetime for a mod
  2. Create a version on that mod, preferably one that hasn't been updated in a while
  3. Delete that version
  4. Check the updated datetime

Expected behavior The updated datetime should be set to the previous version's rather than that of the deleted version

Additional context For an example of this, see https://api.modrinth.com/api/v1/mod/hd1Vej58 "updated":"2021-05-12T01:51:11.638722Z" newest still-published version at time of writing is psv457zv, yet for that version: "date_published":"2021-05-11T23:52:08.142291Z"

MagnusHJensen commented 1 year ago

That doesn't make sense does it?

If I have project A which I just create now. Updated time is now: now

Then I create a version 5 minutes later. Update time is now: now + 5min

Then I create a new version a day later. Updated time is now now + 5min + 1day

Then I delete the newest version another day later. Updated time should then be now + 5min + 1day + 1day And it should not revert back to the old date_published for the newest version: now + 5min

Which from my testing, having a project that is last updated 10 days ago, then deleting a version does not update the updated field, which sounds incorrect. Deleting a version is also modifying the project, hence the updated field should receive a new timestamp. Is that wrong?

Minenash commented 1 year ago

The updated date is not when the modrinth project is updated, but when the mod was last updated. That's why changing the description doesn't and shouldn't affect it. If you delete the newest version, it should go back to the date of the (now) newest update, as for the user, there's the least time the mod has an update (they can use)

MagnusHJensen commented 1 year ago

Well, then I think it's either named wrong or in the wrong table. A updated field on mod signals that is when any update has happened to the mod including anything it includes, versions, loaders and game versions etc. If it ONLY goes by when any versions have been UPLOADED not MODIFIED, then I think a rename is appropriate (last_version_update) or just making up that field, by retrieving the latest version published_date and then adding that to the response model, but not directly on the mod table.