<?php

final class HarbormasterBuildStepPHIDType extends PhabricatorPHIDType {

  const TYPECONST = 'HMCS';

  public function getTypeName() {
    return pht('Build Step');
  }

  public function newObject() {
    return new HarbormasterBuildStep();
  }

  protected function buildQueryForObjects(
    PhabricatorObjectQuery $query,
    array $phids) {

    return id(new HarbormasterBuildStepQuery())
      ->withPHIDs($phids);
  }

  public function loadHandles(
    PhabricatorHandleQuery $query,
    array $handles,
    array $objects) {

    foreach ($handles as $phid => $handle) {
      $build_step = $objects[$phid];

      $id = $build_step->getID();
      $name = $build_step->getName();

      $handle
        ->setName($name)
        ->setFullName(pht('Build Step %d: %s', $id, $name))
        ->setURI("/harbormaster/step/{$id}/edit/");
    }
  }

}

<?php

final class HarbormasterBuildStepPHIDType extends PhabricatorPHIDType {

  const TYPECONST = 'HMCS';

  public function getTypeName() {
    return pht('Build Step');
  }

  public function newObject() {
    return new HarbormasterBuildStep();
  }

  protected function buildQueryForObjects(
    PhabricatorObjectQuery $query,
    array $phids) {

    return id(new HarbormasterBuildStepQuery())
      ->withPHIDs($phids);
  }

  public function loadHandles(
    PhabricatorHandleQuery $query,
    array $handles,
    array $objects) {

    foreach ($handles as $phid => $handle) {
      $build_step = $objects[$phid];

      $id = $build_step->getID();
      $name = $build_step->getName();

      $handle
        ->setName($name)
        ->setFullName(pht('Build Step %d: %s', $id, $name))
        ->setURI("/harbormaster/step/view/{$id}/");
    }
  }

}

Correct the handle URI for build steps
Correct the handle URI for build steps

Summary: Fixes T9674. This was wrong to start with (URI is `/edit/X/`, not `/X/edit/`) but we have a new view page anyway.

Test Plan:
  - Visited an exmaple URI in my browser.
  - Followed a build step link from "Authorized By: ..." in Drydock.

Reviewers: joshuaspence, chad

Reviewed By: chad

Maniphest Tasks: T9674

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