@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: do not allow to unset the image title

Summary:
Do not allow to unset the image title from Pholio mock images,
in order to avoid at least 3 related UX bugs shown in T16478.

Also remove the broken method 'shouldHide()',
because it always returns false, which is the default from
the parent call, PhabricatorModularTransactionType#shouldHide().
The 'shouldHide()' was also broken in PHP 8.5.

Also improve one error message to talk about "image titles"
(and not "image names"), so to be consistent with the "Title"
field in the UX.

Thanks to @aklapper for the original troubleshooting.

Closes T16478
Ref T16460

Test Plan:
Create a Pholio mock with at least one image and save.
Try to unset one image title (not the mock title, but the image title)
and enjoy the new validation message: "Mock images must have a name."

Reviewers: aklapper, O1 Blessed Committers

Reviewed By: aklapper, O1 Blessed Committers

Subscribers: tobiaswiese, Matthew, aklapper, Cigaryno

Maniphest Tasks: T16478, T16460

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

+8 -9
+5 -6
src/applications/pholio/xaction/PholioImageNameTransaction.php
··· 58 58 return null; 59 59 } 60 60 61 - public function shouldHide() { 62 - $old = $this->getOldValue(); 63 - return ($old === array(null => null)); 64 - } 65 - 66 61 public function validateTransactions($object, array $xactions) { 67 62 $errors = array(); 68 63 ··· 73 68 if ($new_length > $max_length) { 74 69 $errors[] = $this->newInvalidError( 75 70 pht( 76 - 'Mock image names must not be longer than %s character(s).', 71 + 'Mock image titles must not be longer than %s character(s).', 77 72 new PhutilNumber($max_length))); 73 + } else if ($new_length === 0) { 74 + $errors[] = $this->newInvalidError( 75 + pht( 76 + 'Mock images must have a title.')); 78 77 } 79 78 } 80 79
+3 -3
src/infrastructure/internationalization/translation/PhabricatorUSEnglishTranslation.php
··· 2093 2093 'Source names must not be longer than %s character.', 2094 2094 'Source names must not be longer than %s characters.', 2095 2095 ), 2096 - 'Mock image names must not be longer than %s character(s).' => array( 2097 - 'Mock image names must not be longer than %s character.', 2098 - 'Mock image names must not be longer than %s characters.', 2096 + 'Mock image titles must not be longer than %s character(s).' => array( 2097 + 'Mock image titles must not be longer than %s character.', 2098 + 'Mock image titles must not be longer than %s characters.', 2099 2099 ), 2100 2100 'Mock names must not be longer than %s character(s).' => array( 2101 2101 'Mock names must not be longer than %s character.',