<?php

final class PhabricatorHomeMenuItemController
  extends PhabricatorHomeController {

  public function handleRequest(AphrontRequest $request) {
    $viewer = $this->getViewer();
    $type = $request->getURIData('type');
    $custom_phid = null;
    if ($type == 'personal') {
      $custom_phid = $viewer->getPHID();
    }

    $application = 'PhabricatorHomeApplication';
    $home_app = id(new PhabricatorApplicationQuery())
      ->setViewer($viewer)
      ->withClasses(array($application))
      ->withInstalled(true)
      ->executeOne();

    $engine = id(new PhabricatorHomeProfileMenuEngine())
      ->setProfileObject($home_app)
      ->setCustomPHID($custom_phid)
      ->setController($this);

    return $engine->buildResponse();
  }

}

<?php

final class PhabricatorHomeMenuItemController
  extends PhabricatorHomeController {

  public function handleRequest(AphrontRequest $request) {
    $viewer = $this->getViewer();
    $type = $request->getURIData('type');
    $custom_phid = null;
    $menu = PhabricatorProfileMenuEngine::MENU_GLOBAL;
    if ($type == 'personal') {
      $custom_phid = $viewer->getPHID();
      $menu = PhabricatorProfileMenuEngine::MENU_PERSONAL;
    }

    $application = 'PhabricatorHomeApplication';
    $home_app = id(new PhabricatorApplicationQuery())
      ->setViewer($viewer)
      ->withClasses(array($application))
      ->withInstalled(true)
      ->executeOne();

    $engine = id(new PhabricatorHomeProfileMenuEngine())
      ->setProfileObject($home_app)
      ->setCustomPHID($custom_phid)
      ->setMenuType($menu)
      ->setController($this)
      ->setShowNavigation(false);

    return $engine->buildResponse();
  }

}

Use new menu contsants in home menu item
Use new menu contsants in home menu item

Summary: Ref T11957, just lays in some minor bug fixes. Sets correct menu, removes sidebar on edit.

Test Plan: Test /menu/ on home with Admin and Normal accounts.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T11957

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