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

Read synthetic inline comments from Harbormaster

Summary: Ref T8096. These are still reading out of the old diff property, but should read from Harbormaster instead.

Test Plan: {F698346}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T8096

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

+58 -18
+58 -18
src/applications/differential/controller/DifferentialChangesetViewController.php
··· 203 203 $inlines = array(); 204 204 } 205 205 206 + if ($left_new || $right_new) { 207 + $diff_map = array(); 208 + if ($left) { 209 + $diff_map[] = $left->getDiff(); 210 + } 211 + if ($right) { 212 + $diff_map[] = $right->getDiff(); 213 + } 214 + $diff_map = mpull($diff_map, null, 'getPHID'); 215 + 216 + $buildables = id(new HarbormasterBuildableQuery()) 217 + ->setViewer($viewer) 218 + ->withBuildablePHIDs(array_keys($diff_map)) 219 + ->withManualBuildables(false) 220 + ->needBuilds(true) 221 + ->needTargets(true) 222 + ->execute(); 223 + $buildables = mpull($buildables, null, 'getBuildablePHID'); 224 + foreach ($diff_map as $diff_phid => $changeset_diff) { 225 + $changeset_diff->attachBuildable(idx($buildables, $diff_phid)); 226 + } 227 + } 228 + 206 229 if ($left_new) { 207 230 $inlines = array_merge( 208 231 $inlines, ··· 356 379 } 357 380 358 381 private function buildLintInlineComments($changeset) { 359 - $lint = id(new DifferentialDiffProperty())->loadOneWhere( 360 - 'diffID = %d AND name = %s', 361 - $changeset->getDiffID(), 362 - 'arc:lint'); 363 - if (!$lint) { 382 + $diff = $changeset->getDiff(); 383 + 384 + $buildable = $diff->getBuildable(); 385 + if (!$buildable) { 364 386 return array(); 365 387 } 366 - $lint = $lint->getData(); 367 388 368 - $inlines = array(); 369 - foreach ($lint as $msg) { 370 - if ($msg['path'] != $changeset->getFilename()) { 371 - continue; 389 + $target_phids = array(); 390 + foreach ($buildable->getBuilds() as $build) { 391 + foreach ($build->getBuildTargets() as $target) { 392 + $target_phids[] = $target->getPHID(); 372 393 } 373 - $inline = new DifferentialInlineComment(); 374 - $inline->setChangesetID($changeset->getID()); 375 - $inline->setIsNewFile(1); 376 - $inline->setSyntheticAuthor(pht('Lint: %s', $msg['name'])); 377 - $inline->setLineNumber($msg['line']); 378 - $inline->setLineLength(0); 394 + } 395 + 396 + if (!$target_phids) { 397 + return array(); 398 + } 399 + 400 + $messages = id(new HarbormasterBuildLintMessage())->loadAllWhere( 401 + 'buildTargetPHID IN (%Ls) AND path = %s', 402 + $target_phids, 403 + $changeset->getFilename()); 379 404 380 - $inline->setContent('%%%'.$msg['description'].'%%%'); 405 + if (!$messages) { 406 + return array(); 407 + } 381 408 382 - $inlines[] = $inline; 409 + $template = id(new DifferentialInlineComment()) 410 + ->setChangesetID($changeset->getID()) 411 + ->setIsNewFile(1) 412 + ->setLineLength(0); 413 + 414 + $inlines = array(); 415 + foreach ($messages as $message) { 416 + $description = $message->getProperty('description'); 417 + $description = '%%%'.$description.'%%%'; 418 + 419 + $inlines[] = id(clone $template) 420 + ->setSyntheticAuthor(pht('Lint: %s', $message->getName())) 421 + ->setLineNumber($message->getLine()) 422 + ->setContent($description); 383 423 } 384 424 385 425 return $inlines;