Fix two minor issues with Pholio
Summary: - One bad method call. - One fatal when handling a mock with no images. These "can't" exist, but we have a few old ones I think and it's probably better not to fatal. We could filter the object out completely, but this doesn't seem like a bad fix? Test Plan: Viewed `/pholio/` (although I don't think I have any imageless mocks) and viewed an outdated image. Reviewers: btrahan, chad Reviewed By: chad CC: aran Differential Revision: https://secure.phabricator.com/D6574
This commit is contained in:
		@@ -134,7 +134,7 @@ final class PholioMockViewController extends PholioController {
 | 
				
			|||||||
    $image = idx($images, $image_id);
 | 
					    $image = idx($images, $image_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if ($image) {
 | 
					    if ($image) {
 | 
				
			||||||
      $history = $mock->getImageUpdateSet($image_id);
 | 
					      $history = $mock->getImageHistorySet($image_id);
 | 
				
			||||||
      $latest_image = last($history);
 | 
					      $latest_image = last($history);
 | 
				
			||||||
      $href = $this->getApplicationURI(
 | 
					      $href = $this->getApplicationURI(
 | 
				
			||||||
        'image/history/'.$latest_image->getID().'/');
 | 
					        'image/history/'.$latest_image->getID().'/');
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -122,7 +122,7 @@ final class PholioMockQuery
 | 
				
			|||||||
    $image_groups = mgroup($all_images, 'getMockID');
 | 
					    $image_groups = mgroup($all_images, 'getMockID');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    foreach ($mocks as $mock) {
 | 
					    foreach ($mocks as $mock) {
 | 
				
			||||||
      $mock_images = $image_groups[$mock->getID()];
 | 
					      $mock_images = idx($image_groups, $mock->getID(), array());
 | 
				
			||||||
      $mock->attachAllImages($mock_images);
 | 
					      $mock->attachAllImages($mock_images);
 | 
				
			||||||
      $mock->attachImages(mfilter($mock_images, 'getIsObsolete', true));
 | 
					      $mock->attachImages(mfilter($mock_images, 'getIsObsolete', true));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user