@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.

Pholio Mock: fix altered breadcrumb and header on image validation error

Summary:
For years, when editing a Pholio Mock and causing an image title
validation error, then the breadcrumb and the page header were altered.

The cause was a variable, $title, re-used by mistake in this corner case.

After this change, the "Edit Mock: The mock name" is not overwritten by mistake.

Closes T16492

Test Plan:
Edit an already-existing Pholio Mock.

http://phorge.localhost/pholio/edit/1/

In the field "Name", set "The mock name".

Then change the image title (field "Title") setting a very long title,
more than 128 characters, like this:

THE IMAGE VERY LONG TITLE BLA BLA BLA BLA BLA BLA BLA BLA BLA BLA BLA BLA BLA BLA BLA BLA BLA BLABLA BLA BLA BLA BLA BLA BLA BLA!

Save. You will see the usual error, but now you finally see the normal breadcrumb, like this:

{nav Pholio > M1 > Edit Mock: The mock name}

So, you don't see anymore this nonsense breadcrumb:

{nav Pholio > M1 > THE IMAGE VERY LONG TITLE BLA BLA BLA BLA BLA B...}

Plus, you finally see this page header:

Edit Mock: The mock name

So, you don't see anymore this nonsense page header:

Edit Mock: THE IMAGE VERY LONG TITLE BLA BLA BLA BLA BLA BLA BLA BLA BLA BLA BLA BLA BLA BLA BLA BLA BLA BLABLA BLA BLA BLA BLA BLA BLA BLA!

Such wow!

Reviewers: O1 Blessed Committers, aklapper

Reviewed By: O1 Blessed Committers, aklapper

Subscribers: aklapper, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T16492

Differential Revision: https://we.phorge.it/D26734

+4 -4
+4 -4
src/applications/pholio/controller/PholioMockEditController.php
··· 136 136 137 137 $existing_image = idx($mock_images, $file_phid); 138 138 139 - $title = (string)$request->getStr('title_'.$file_phid); 139 + $img_title = (string)$request->getStr('title_'.$file_phid); 140 140 $description = (string)$request->getStr('description_'.$file_phid); 141 141 $sequence = $sequence_map[$file_phid]; 142 142 ··· 146 146 ->setReplacesImagePHID($replaces_image_phid) 147 147 ->setFilePHID($file_phid) 148 148 ->attachFile($file) 149 - ->setName(strlen($title) ? $title : $file->getName()) 149 + ->setName(strlen($img_title) ? $img_title : $file->getName()) 150 150 ->setDescription($description) 151 151 ->setSequence($sequence) 152 152 ->save(); ··· 161 161 ->setAuthorPHID($viewer->getPHID()) 162 162 ->setFilePHID($file_phid) 163 163 ->attachFile($file) 164 - ->setName(strlen($title) ? $title : $file->getName()) 164 + ->setName(strlen($img_title) ? $img_title : $file->getName()) 165 165 ->setDescription($description) 166 166 ->setSequence($sequence) 167 167 ->save(); ··· 175 175 $xactions[] = id(new PholioTransaction()) 176 176 ->setTransactionType(PholioImageNameTransaction::TRANSACTIONTYPE) 177 177 ->setNewValue( 178 - array($existing_image->getPHID() => $title)); 178 + array($existing_image->getPHID() => $img_title)); 179 179 $xactions[] = id(new PholioTransaction()) 180 180 ->setTransactionType( 181 181 PholioImageDescriptionTransaction::TRANSACTIONTYPE)