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

Compability with revisions? #16

Open
mmodler opened this issue Feb 2, 2024 · 3 comments
Open

Compability with revisions? #16

mmodler opened this issue Feb 2, 2024 · 3 comments

Comments

@mmodler
Copy link

mmodler commented Feb 2, 2024

Hey,

thanks for this great addon! Yesterday i was thinking about using it in a bigger project with revisions. As far as i see there might be issues with revisions? I looked at https://statamic.dev/revisions#workflow and i think the working copy might be a problem:

Saving a published entry https://statamic.dev/revisions#saving-a-published-entry
The working copy is saved.
The actual entry is not saved.

It is therefore possible that I am using an asset in the working copy, which may be deleted. When I then publish the entry, I am surprised that the asset is gone.

Of course, this is an edge case and you could also argue that "in use" is the same as "published".

Hm, could the solution be to scan all working.yaml files in the revisions folder as well?

@mmodler mmodler changed the title Compability with revision? Compability with revisions? Feb 2, 2024
@aozisik
Copy link
Contributor

aozisik commented Feb 2, 2024

Hi @mmodler

Thanks for raising this issue.

I'm not familiar with this revisions feature myself yet. But a quick look at the docs tells me the revisions are stored under content/revisions. The add-on recursively scans the content folder, so any files in revisions folder referencing the assets should be picked up and those assets should be marked as used.

From the docs:

Revision#
Revisions are stored as YAML files and include all the data for your entries at the time of revisions, including additional meta data about the author, timestamp, and so on. Revisions can be previewed and restored as the working copy so you can edit and/or publish them if you wish.

Please let me know if this is not how it works, and the assets in the working copy are not picked up by the add-on as being used.

@aozisik aozisik closed this as completed Feb 2, 2024
@mmodler
Copy link
Author

mmodler commented Feb 2, 2024

I don't think its so easy:

  • You can move revisions to content folder, but by default they are in storage folder
  • For revision support, you need so scan working.yaml files - because the user seems to plan to use assets referenced there in near future
  • I don't think it useful to scan the [timestamp].yaml revision files because then every assets ever used in the past won't get deleted. Or is this intended?

@aozisik aozisik reopened this Feb 10, 2024
@aozisik
Copy link
Contributor

aozisik commented Feb 10, 2024

@mmodler these are valid points, unfortunately I don't have answers. I'm not using revisions actively myself yet.

About every asset ever used in the past part, how would you expect it to work? We could perhaps not protect assets in past revisions, and plus the package user could use the minimum_age_in_days setting to preserve assets uploaded recently (in case they want to roll back or something).

Would you be willing to contribute a PR for this?

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

No branches or pull requests

2 participants