@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix a problem with recording image replacement, every other mock update

Summary:
This fixes a weird issue which currently doesn't have much impact on things, but starts to matter if we do the grid.

We're incorrectly initializing the form with `replacesPHID` as the //previously replaced Image PHID//. It is supposed to be the //current File PHID//.

Every other time, this is `null` and things work properly. On even updates (2, 4, 6, etc.), it's wrong and we don't record the replacement completely correctly.

Test Plan: Replaced images twice, saw three rows of thumb grid.

Reviewers: chad

Reviewed By: chad

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D9541

+7 -5
+7 -5
src/applications/pholio/controller/PholioMockEditController.php
··· 135 135 $replaces_image_phid = null; 136 136 if (isset($replaces_map[$file_phid])) { 137 137 $old_file_phid = $replaces_map[$file_phid]; 138 - $old_image = idx($mock_images, $old_file_phid); 139 - if ($old_image) { 140 - $replaces_image_phid = $old_image->getPHID(); 138 + if ($old_file_phid != $file_phid) { 139 + $old_image = idx($mock_images, $old_file_phid); 140 + if ($old_image) { 141 + $replaces_image_phid = $old_image->getPHID(); 142 + } 141 143 } 142 144 } 143 145 ··· 158 160 $xactions[] = id(new PholioTransaction()) 159 161 ->setTransactionType( 160 162 PholioTransactionType::TYPE_IMAGE_REPLACE) 161 - ->setNewValue($replace_image); 163 + ->setNewValue($replace_image); 162 164 $posted_mock_images[] = $replace_image; 163 165 } else if (!$existing_image) { // this is an add 164 166 $add_image = id(new PholioImage()) ··· 256 258 $image_elements[] = id(new PholioUploadedImageView()) 257 259 ->setUser($user) 258 260 ->setImage($mock_image) 259 - ->setReplacesPHID($mock_image->getReplacesImagePHID()); 261 + ->setReplacesPHID($mock_image->getFilePHID()); 260 262 } 261 263 262 264 $list_id = celerity_generate_unique_node_id();