1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-14 19:02:41 +01:00
phorge-phorge/src/applications/pholio
epriestley 991bbb6242 Provide "builtin" files and use them to fix Pholio when files are deleted
Summary:
Fixes T3132. Currently, if a user deletes a file which is present in a mock, that mock throws an exception when loading. If the file is also the cover photo, the mock list throws an exception as well.

In other applications, we can sometimes deal with this (a sub-object vanishing) by implicitly hiding the parent object (for example, we can just vanish feed stories about objects which no longer exist). We can also sometimes deal with it by preventing sub-objects from being directly deleted.

However, neither approach is reasonable in this case.

If we vanish the whole mock, we'll lose all the comments and it will generally be weird. Vanishing a mock is a big deal compared to vanishing a feed story. We'll also need to load more data on the list view to prevent showing a mock on the list view and then realizing we need to vanish it on the detail view (because all of its images have been deleted).

We permit total deletion of files to allow users to recover from accidentally uploading sensitive files (which has happened a few times), and I'm hesitant to remove this capability because I think it serves a real need, so we can't prevent sub-objects from being deleted.

So we're left in a relatively unique situation. To solve this, I've added a "builtin" mechanism, which allows us to expose some resource we ship with as a PhabricatorFile. Then we just swap it out in place of the original file and proceed forward normally, as though nothing happened. The user sees a placeholder image instead of the original, but everything else works reasonably and this seems like a fairly acceptable outcome.

I believe we can use this mechanism to simplify some other code too, like default profile pictures.

Test Plan: Deleted a Pholio mock cover image's file. Implemented change, saw functional Pholio again with beautiful life-affirming "?" art replacing soul-shattering exception.

Reviewers: btrahan, chad

Reviewed By: chad

CC: aran

Maniphest Tasks: T3132

Differential Revision: https://secure.phabricator.com/D5870
2013-05-08 18:12:52 -07:00
..
application Pholio inline comment now include a thumbnail and link 2013-03-20 05:39:36 -07:00
config MetaMTA: Owners, Pholio, Macro 2013-01-16 10:52:30 -08:00
constants Drafts are saved as inline comments for images when user comments mock 2013-02-07 08:02:52 -08:00
controller Add actions to mobile crumbs 2013-04-10 13:08:36 -07:00
editor Implicitly CC inline commenters in Pholio 2013-03-09 17:55:14 -08:00
lipsum xDiffs and Revisions Generating 2013-05-06 14:11:37 -07:00
mail Remove some more copyright headers that survived in branches, etc., through the great header purge. See D3886. 2012-12-05 09:27:27 -08:00
query Provide "builtin" files and use them to fix Pholio when files are deleted 2013-05-08 18:12:52 -07:00
remarkup Remarkup allows to point a specific image in a Mock set 2013-03-14 09:38:56 -07:00
search Support search indexing in ApplicationTransaction 2012-12-21 14:21:50 -08:00
storage Group inline transactions in Pholio 2013-03-09 19:23:50 -08:00
view Pholio inline comment now include a thumbnail and link 2013-03-20 05:39:36 -07:00