Pholio - add concept of replacing images and primitive history view
Summary: Now you can actually replace an image! Ref T3572. This ended up needing a wee bit of infrastructure to work... - add replace image transaction to pholio - add replacesImagePHID to PholioImage - tweaks to editor to properly update images with respect to replacement - add edges to track replacement - expose getNodes on graph query infrastructure to query the entire graph of who replaced who - move pholio image to new phid infrastructure Still TODO - the history view should get chopped out a bit from the current view - no more inline comments / generally less functionality plus maybe a tweak or two to make this more sensical. Test Plan: replaced images and played with history controller a little. works okay. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T3572 Differential Revision: https://secure.phabricator.com/D6560
This commit is contained in:
@@ -76,6 +76,8 @@ final class PholioMockViewController extends PholioController {
|
||||
require_celerity_resource('pholio-css');
|
||||
require_celerity_resource('pholio-inline-comments-css');
|
||||
|
||||
$image_status = $this->getImageStatus($mock, $this->imageID);
|
||||
|
||||
$comment_form_id = celerity_generate_unique_node_id();
|
||||
$output = id(new PholioMockImagesView())
|
||||
->setRequestURI($request->getRequestURI())
|
||||
@@ -100,6 +102,7 @@ final class PholioMockViewController extends PholioController {
|
||||
|
||||
$content = array(
|
||||
$crumbs,
|
||||
$image_status,
|
||||
$header,
|
||||
$actions,
|
||||
$properties,
|
||||
@@ -117,6 +120,43 @@ final class PholioMockViewController extends PholioController {
|
||||
));
|
||||
}
|
||||
|
||||
private function getImageStatus(PholioMock $mock, $image_id) {
|
||||
$status = null;
|
||||
$images = $mock->getImages();
|
||||
foreach ($images as $image) {
|
||||
if ($image->getID() == $image_id) {
|
||||
return $status;
|
||||
}
|
||||
}
|
||||
|
||||
$images = $mock->getAllImages();
|
||||
$images = mpull($images, null, 'getID');
|
||||
$image = idx($images, $image_id);
|
||||
|
||||
if ($image) {
|
||||
$history = $mock->getImageUpdateSet($image_id);
|
||||
$latest_image = last($history);
|
||||
$href = $this->getApplicationURI(
|
||||
'image/history/'.$latest_image->getID().'/');
|
||||
$status = id(new AphrontErrorView())
|
||||
->setSeverity(AphrontErrorView::SEVERITY_NOTICE)
|
||||
->setTitle(pht('The requested image is obsolete.'))
|
||||
->appendChild(phutil_tag(
|
||||
'p',
|
||||
array(),
|
||||
array(
|
||||
pht('You are viewing this mock with the latest image set.'),
|
||||
' ',
|
||||
phutil_tag(
|
||||
'a',
|
||||
array('href' => $href),
|
||||
pht(
|
||||
'Click here to see the history of the now obsolete image.')))));
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
private function buildActionView(PholioMock $mock) {
|
||||
$user = $this->getRequest()->getUser();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user