1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 05:50:55 +01:00

Only recognize "Fixes ..." in main revision content like the Summary or Test Plan

Summary:
Fixes T12642. Currently, writing "Fixes T..." in a comment gets picked up as a formal "fixes".

This is a bit confusing, and can also give you a "no effect" error if you "fixes ..." a task which is already "fixes"'d.

We could make the duplicate action a non-error, but just prevent the text from having an effect instead, which seems cleaner.

Test Plan:
  - Wrote "Fixes ..." in a summary, saw a "fixes" relationship established.
  - Wrote "Fixes ..." in a comment, got a "mention" instead.
  - `var_dump()`'d some stuff as a sanity check, looked reasonable.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12642

Differential Revision: https://secure.phabricator.com/D17805
This commit is contained in:
epriestley 2017-04-30 12:44:59 -07:00
parent 89d0c8e388
commit b7c4f60e23

View file

@ -1191,12 +1191,23 @@ final class DifferentialTransactionEditor
array $changes,
PhutilMarkupEngine $engine) {
$flat_blocks = mpull($changes, 'getNewValue');
$huge_block = implode("\n\n", $flat_blocks);
// For "Fixes ..." and "Depends on ...", we're only going to look at
// content blocks which are part of the revision itself (like "Summary"
// and "Test Plan"), not comments.
$content_parts = array();
foreach ($changes as $change) {
if ($change->getTransaction()->isCommentTransaction()) {
continue;
}
$content_parts[] = $change->getNewValue();
}
if (!$content_parts) {
return array();
}
$content_block = implode("\n\n", $content_parts);
$task_map = array();
$task_refs = id(new ManiphestCustomFieldStatusParser())
->parseCorpus($huge_block);
->parseCorpus($content_block);
foreach ($task_refs as $match) {
foreach ($match['monograms'] as $monogram) {
$task_id = (int)trim($monogram, 'tT');
@ -1206,7 +1217,7 @@ final class DifferentialTransactionEditor
$rev_map = array();
$rev_refs = id(new DifferentialCustomFieldDependsOnParser())
->parseCorpus($huge_block);
->parseCorpus($content_block);
foreach ($rev_refs as $match) {
foreach ($match['monograms'] as $monogram) {
$rev_id = (int)trim($monogram, 'dD');