Page MenuHomePhabricator

D12682.diff
No OneTemporary

D12682.diff

diff --git a/src/applications/maniphest/field/parser/__tests__/ManiphestCustomFieldStatusParserTestCase.php b/src/applications/maniphest/field/parser/__tests__/ManiphestCustomFieldStatusParserTestCase.php
--- a/src/applications/maniphest/field/parser/__tests__/ManiphestCustomFieldStatusParserTestCase.php
+++ b/src/applications/maniphest/field/parser/__tests__/ManiphestCustomFieldStatusParserTestCase.php
@@ -60,6 +60,16 @@
'offset' => 0,
),
),
+ 'Fixes T123, T456, and T789.' => array(
+ array(
+ 'match' => 'Fixes T123, T456, and T789',
+ 'prefix' => 'Fixes',
+ 'infix' => '',
+ 'monograms' => array('T123', 'T456', 'T789'),
+ 'suffix' => '',
+ 'offset' => 0,
+ ),
+ ),
);
foreach ($map as $input => $expect) {
diff --git a/src/infrastructure/customfield/parser/PhabricatorCustomFieldMonogramParser.php b/src/infrastructure/customfield/parser/PhabricatorCustomFieldMonogramParser.php
--- a/src/infrastructure/customfield/parser/PhabricatorCustomFieldMonogramParser.php
+++ b/src/infrastructure/customfield/parser/PhabricatorCustomFieldMonogramParser.php
@@ -25,6 +25,7 @@
$prefix_regex.
$infix_regex.
'((?:'.$monogram_pattern.'[,\s]*)+)'.
+ '(?:\band\s+('.$monogram_pattern.'))?'.
$suffix_regex.
'(?:$|\b)'.
'/';
@@ -42,12 +43,18 @@
$results = array();
foreach ($matches as $set) {
+ $monograms = array_filter(preg_split('/[,\s]+/', $set[3][0]));
+
+ if (isset($set[4]) && $set[4][0]) {
+ $monograms[] = $set[4][0];
+ }
+
$results[] = array(
'match' => $set[0][0],
'prefix' => $set[1][0],
'infix' => $set[2][0],
- 'monograms' => array_filter(preg_split('/[,\s]+/', $set[3][0])),
- 'suffix' => idx(idx($set, 4, array()), 0, ''),
+ 'monograms' => $monograms,
+ 'suffix' => idx(idx($set, 5, array()), 0, ''),
'offset' => $set[0][1],
);
}

File Metadata

Mime Type
text/plain
Expires
Wed, Mar 26, 1:49 AM (3 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7228160
Default Alt Text
D12682.diff (1 KB)

Event Timeline