<?php

final class HarbormasterBuildPlanDatasource
  extends PhabricatorTypeaheadDatasource {

  public function getPlaceholderText() {
    return pht('Type a build plan name...');
  }

  public function getDatasourceApplicationClass() {
    return 'PhabricatorHarbormasterApplication';
  }

  public function loadResults() {
    $viewer = $this->getViewer();
    $raw_query = $this->getRawQuery();

    $results = array();

    $plans = id(new HarbormasterBuildPlanQuery())
      ->setViewer($viewer)
      ->execute();
    foreach ($plans as $plan) {
      $results[] = id(new PhabricatorTypeaheadResult())
        ->setName($plan->getName())
        ->setPHID($plan->getPHID());
    }

    return $results;
  }

}

<?php

final class HarbormasterBuildPlanDatasource
  extends PhabricatorTypeaheadDatasource {

  public function getPlaceholderText() {
    return pht('Type a build plan name...');
  }

  public function getDatasourceApplicationClass() {
    return 'PhabricatorHarbormasterApplication';
  }

  public function loadResults() {
    $viewer = $this->getViewer();
    $raw_query = $this->getRawQuery();

    $results = array();

    $plans = id(new HarbormasterBuildPlanQuery())
      ->setViewer($viewer)
      ->execute();
    foreach ($plans as $plan) {
      $closed = null;
      if ($plan->isDisabled()) {
        $closed = pht('Disabled');
      }

      $results[] = id(new PhabricatorTypeaheadResult())
        ->setName($plan->getName())
        ->setClosed($closed)
        ->setPHID($plan->getPHID());
    }

    return $results;
  }

}

Fix buildplan ac on Herald.
T7646: Fix buildplan ac on Herald.

Summary: Fixes T7646.

Test Plan: Repeat steps described in T7646 and expect disabled build plans not displayed.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T7646

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