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

Add "and" support to "ref"

Summary: Fixes T8038. Allow `PhabricatorCustomFieldMonogramParser` to handle "and". This means that `Ref Tx, Ty and Tz` will correctly return `array('monograms' => array('Tx', 'Ty', 'Tz')`.

Test Plan: Added unit tests.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley

Maniphest Tasks: T2, T3, T1, T8038

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

+19 -2
+10
src/applications/maniphest/field/parser/__tests__/ManiphestCustomFieldStatusParserTestCase.php
··· 60 60 'offset' => 0, 61 61 ), 62 62 ), 63 + 'Fixes T123, T456, and T789.' => array( 64 + array( 65 + 'match' => 'Fixes T123, T456, and T789', 66 + 'prefix' => 'Fixes', 67 + 'infix' => '', 68 + 'monograms' => array('T123', 'T456', 'T789'), 69 + 'suffix' => '', 70 + 'offset' => 0, 71 + ), 72 + ), 63 73 ); 64 74 65 75 foreach ($map as $input => $expect) {
+9 -2
src/infrastructure/customfield/parser/PhabricatorCustomFieldMonogramParser.php
··· 25 25 $prefix_regex. 26 26 $infix_regex. 27 27 '((?:'.$monogram_pattern.'[,\s]*)+)'. 28 + '(?:\band\s+('.$monogram_pattern.'))?'. 28 29 $suffix_regex. 29 30 '(?:$|\b)'. 30 31 '/'; ··· 42 43 43 44 $results = array(); 44 45 foreach ($matches as $set) { 46 + $monograms = array_filter(preg_split('/[,\s]+/', $set[3][0])); 47 + 48 + if (isset($set[4]) && $set[4][0]) { 49 + $monograms[] = $set[4][0]; 50 + } 51 + 45 52 $results[] = array( 46 53 'match' => $set[0][0], 47 54 'prefix' => $set[1][0], 48 55 'infix' => $set[2][0], 49 - 'monograms' => array_filter(preg_split('/[,\s]+/', $set[3][0])), 50 - 'suffix' => idx(idx($set, 4, array()), 0, ''), 56 + 'monograms' => $monograms, 57 + 'suffix' => idx(idx($set, 5, array()), 0, ''), 51 58 'offset' => $set[0][1], 52 59 ); 53 60 }