Transformed Pictures: Make them non-orphan
Summary:
Before this change, most image transforms were just orphan as default.
This change introduces a new internal file API:
PhabricatorFileTransform#executeTransformExplicit(PhabricatorFile)
This new API can be used to easily create the transform, plus, create a PhabricatorTransformedFile,
so that the transformed file is related to the original one.
If the original file is a builtin, we don't persist that relationship,
just like before it was orphan. Just as additional caution to don't clog the "transforms" UX.
This new API pratically brings D25475 to an higher level.
So, this new API is adopted by these calls of executeTransform():
- ManiphestTaskCoverImageTransaction (D25475) - just a refactor
- PhabricatorPeopleProfilePictureController
- PhabricatorProjectEditPictureController
- PhameBlogProfilePictureController
- PhortuneMerchantPictureController
For example, in PhabricatorPeopleProfilePictureController:
Now the original picture is mentioned from the cropped thumbnail.
So, you can now at least "more easily" find the original picture and delete that,
starting from that thumbnail.
Deletion considerations:
Before and after this change, you were able to delete the parent file.
It was just a bit tricky to find it out. For example, from the Manage Profile
you see only the mention to the thumbnail, not the original file.
After this change, the parent file is related to transforms, so the phd
daemon will delete them as well as usual for transforms.
This is just a preliminary improvement on the deletion workflow reported
from T15407. Any other improvement is welcome.
After this change, you can more easily find and delete your profile image.
Note that we already closed T16074 so this kind of deletions do not cause 404 errors in the UX of profile pictures.
Closes T15814
Ref T15407
Ref T15768
Test Plan:
Test profile images:
- Top Menu > Manage > Edit Profile Picture > Use Picture
- still works
- Top Menu > Manage > Edit Profile Picture > Upload New Picture
- still works
- Left menu > Manage > click on first Mentioned File
- click on View Transforms - you now see the parent file
- delete the parent file, with phd daemon running:
now the transforms is deleted as well
Do the same test plan for Diffusion.
Do the same test for Phame blob.
Do the same test for a Project tag image.
Test again the same test plan of D25475. Still works.
We have not tested Merchant. Nobody knows what Merchant is.
Reviewers: O1 Blessed Committers, aklapper
Reviewed By: O1 Blessed Committers, aklapper
Subscribers: aklapper, tobiaswiese, Matthew, Cigaryno
Tags: #files
Maniphest Tasks: T15814, T15407, T15768, T16074
Differential Revision: https://we.phorge.it/D25622