diff --git a/resources/sql/patches/20131006.hdisable.sql b/resources/sql/patches/20131006.hdisable.sql new file mode 100644 index 0000000000..c7afca13d8 --- /dev/null +++ b/resources/sql/patches/20131006.hdisable.sql @@ -0,0 +1,2 @@ +ALTER TABLE {$NAMESPACE}_herald.herald_rule + ADD isDisabled INT UNSIGNED NOT NULL DEFAULT 0; diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 8293955dbe..f785604e2f 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -631,8 +631,8 @@ phutil_register_library_map(array( 'HeraldConditionTranscript' => 'applications/herald/storage/transcript/HeraldConditionTranscript.php', 'HeraldController' => 'applications/herald/controller/HeraldController.php', 'HeraldDAO' => 'applications/herald/storage/HeraldDAO.php', - 'HeraldDeleteController' => 'applications/herald/controller/HeraldDeleteController.php', 'HeraldDifferentialRevisionAdapter' => 'applications/herald/adapter/HeraldDifferentialRevisionAdapter.php', + 'HeraldDisableController' => 'applications/herald/controller/HeraldDisableController.php', 'HeraldEditLogQuery' => 'applications/herald/query/HeraldEditLogQuery.php', 'HeraldEffect' => 'applications/herald/engine/HeraldEffect.php', 'HeraldEngine' => 'applications/herald/engine/HeraldEngine.php', @@ -651,6 +651,7 @@ phutil_register_library_map(array( 'HeraldRuleEdit' => 'applications/herald/storage/HeraldRuleEdit.php', 'HeraldRuleEditHistoryController' => 'applications/herald/controller/HeraldRuleEditHistoryController.php', 'HeraldRuleEditHistoryView' => 'applications/herald/view/HeraldRuleEditHistoryView.php', + 'HeraldRuleEditor' => 'applications/herald/editor/HeraldRuleEditor.php', 'HeraldRuleListController' => 'applications/herald/controller/HeraldRuleListController.php', 'HeraldRuleQuery' => 'applications/herald/query/HeraldRuleQuery.php', 'HeraldRuleSearchEngine' => 'applications/herald/query/HeraldRuleSearchEngine.php', @@ -660,6 +661,7 @@ phutil_register_library_map(array( 'HeraldRuleTypeConfig' => 'applications/herald/config/HeraldRuleTypeConfig.php', 'HeraldRuleViewController' => 'applications/herald/controller/HeraldRuleViewController.php', 'HeraldTestConsoleController' => 'applications/herald/controller/HeraldTestConsoleController.php', + 'HeraldTransactionQuery' => 'applications/herald/query/HeraldTransactionQuery.php', 'HeraldTranscript' => 'applications/herald/storage/transcript/HeraldTranscript.php', 'HeraldTranscriptController' => 'applications/herald/controller/HeraldTranscriptController.php', 'HeraldTranscriptListController' => 'applications/herald/controller/HeraldTranscriptListController.php', @@ -2724,8 +2726,8 @@ phutil_register_library_map(array( 'HeraldCondition' => 'HeraldDAO', 'HeraldController' => 'PhabricatorController', 'HeraldDAO' => 'PhabricatorLiskDAO', - 'HeraldDeleteController' => 'HeraldController', 'HeraldDifferentialRevisionAdapter' => 'HeraldAdapter', + 'HeraldDisableController' => 'HeraldController', 'HeraldEditLogQuery' => 'PhabricatorOffsetPagedQuery', 'HeraldInvalidActionException' => 'Exception', 'HeraldInvalidConditionException' => 'Exception', @@ -2744,6 +2746,7 @@ phutil_register_library_map(array( 'HeraldRuleEdit' => 'HeraldDAO', 'HeraldRuleEditHistoryController' => 'HeraldController', 'HeraldRuleEditHistoryView' => 'AphrontView', + 'HeraldRuleEditor' => 'PhabricatorApplicationTransactionEditor', 'HeraldRuleListController' => array( 0 => 'HeraldController', @@ -2755,6 +2758,7 @@ phutil_register_library_map(array( 'HeraldRuleTransactionComment' => 'PhabricatorApplicationTransactionComment', 'HeraldRuleViewController' => 'HeraldController', 'HeraldTestConsoleController' => 'HeraldController', + 'HeraldTransactionQuery' => 'PhabricatorApplicationTransactionQuery', 'HeraldTranscript' => array( 0 => 'HeraldDAO', diff --git a/src/applications/herald/application/PhabricatorApplicationHerald.php b/src/applications/herald/application/PhabricatorApplicationHerald.php index 692e37d8be..13d3a91bba 100644 --- a/src/applications/herald/application/PhabricatorApplicationHerald.php +++ b/src/applications/herald/application/PhabricatorApplicationHerald.php @@ -41,8 +41,9 @@ final class PhabricatorApplicationHerald extends PhabricatorApplication { => 'HeraldNewController', 'rule/(?P[1-9]\d*)/' => 'HeraldRuleViewController', 'edit/(?:(?P[1-9]\d*)/)?' => 'HeraldRuleController', + 'disable/(?P[1-9]\d*)/(?P\w+)/' => + 'HeraldDisableController', 'history/(?:(?P[1-9]\d*)/)?' => 'HeraldRuleEditHistoryController', - 'delete/(?P[1-9]\d*)/' => 'HeraldDeleteController', 'test/' => 'HeraldTestConsoleController', 'transcript/' => 'HeraldTranscriptListController', 'transcript/(?P[1-9]\d*)/(?:(?P\w+)/)?' diff --git a/src/applications/herald/controller/HeraldDeleteController.php b/src/applications/herald/controller/HeraldDeleteController.php deleted file mode 100644 index 3abc9dc1eb..0000000000 --- a/src/applications/herald/controller/HeraldDeleteController.php +++ /dev/null @@ -1,57 +0,0 @@ -id = $data['id']; - } - - public function processRequest() { - - $rule = id(new HeraldRule())->load($this->id); - if (!$rule) { - return new Aphront404Response(); - } - - $request = $this->getRequest(); - $user = $request->getUser(); - - // Anyone can delete a global rule, but only the rule owner can delete a - // personal one. - if ($rule->getRuleType() == HeraldRuleTypeConfig::RULE_TYPE_PERSONAL) { - if ($user->getPHID() != $rule->getAuthorPHID()) { - return new Aphront400Response(); - } - } - - if ($request->isFormPost()) { - $rule->openTransaction(); - $rule->logEdit($user->getPHID(), 'delete'); - $rule->delete(); - $rule->saveTransaction(); - return id(new AphrontReloadResponse())->setURI('/herald/'); - } - - $dialog = new AphrontDialogView(); - $dialog->setUser($request->getUser()); - $dialog->setTitle(pht('Really delete this rule?')); - $dialog->appendChild(pht( - "Are you sure you want to delete the rule: %s?", - $rule->getName())); - $dialog->addSubmitButton(pht('Delete')); - $dialog->addCancelButton('/herald/'); - $dialog->setSubmitURI($request->getPath()); - - return id(new AphrontDialogResponse())->setDialog($dialog); - - } - -} diff --git a/src/applications/herald/controller/HeraldDisableController.php b/src/applications/herald/controller/HeraldDisableController.php new file mode 100644 index 0000000000..0313af86e4 --- /dev/null +++ b/src/applications/herald/controller/HeraldDisableController.php @@ -0,0 +1,74 @@ +id = $data['id']; + $this->action = $data['action']; + } + + public function processRequest() { + $request = $this->getRequest(); + $viewer = $request->getUser(); + $id = $this->id; + + $rule = id(new HeraldRuleQuery()) + ->setViewer($viewer) + ->withIDs(array($id)) + ->requireCapabilities( + array( + PhabricatorPolicyCapability::CAN_VIEW, + PhabricatorPolicyCapability::CAN_EDIT, + )) + ->executeOne(); + if (!$rule) { + return new Aphront404Response(); + } + + if ($rule->getRuleType() == HeraldRuleTypeConfig::RULE_TYPE_GLOBAL) { + $this->requireApplicationCapability( + PhabricatorApplicationHerald::CAN_CREATE_GLOBAL_RULE); + } + + $view_uri = $this->getApplicationURI("rule/{$id}/"); + + $is_disable = ($this->action === 'disable'); + + if ($request->isFormPost()) { + $xaction = id(new HeraldRuleTransaction()) + ->setTransactionType(HeraldRuleTransaction::TYPE_DISABLE) + ->setNewValue($is_disable); + + id(new HeraldRuleEditor()) + ->setActor($viewer) + ->setContinueOnNoEffect(true) + ->setContentSourceFromRequest($request) + ->applyTransactions($rule, array($xaction)); + + return id(new AphrontRedirectResponse())->setURI($view_uri); + } + + if ($is_disable) { + $title = pht('Really disable this rule?'); + $body = pht('This rule will no longer activate.'); + $button = pht('Disable Rule'); + } else { + $title = pht('Really enable this rule?'); + $body = pht('This rule will become active again.'); + $button = pht('Enable Rule'); + } + + $dialog = id(new AphrontDialogView()) + ->setUser($viewer) + ->setTitle($title) + ->appendChild($body) + ->addSubmitButton($button) + ->addCancelButton($view_uri); + + return id(new AphrontDialogResponse())->setDialog($dialog); + } + +} diff --git a/src/applications/herald/controller/HeraldRuleListController.php b/src/applications/herald/controller/HeraldRuleListController.php index 9a937c37e9..bb52435d65 100644 --- a/src/applications/herald/controller/HeraldRuleListController.php +++ b/src/applications/herald/controller/HeraldRuleListController.php @@ -54,18 +54,17 @@ final class HeraldRuleListController extends HeraldController $item->addIcon('world', pht('Global Rule')); } + if ($rule->getIsDisabled()) { + $item->setDisabled(true); + $item->addIcon('disable-grey', pht('Disabled')); + } + $item->addAction( id(new PHUIListItemView()) ->setHref($this->getApplicationURI("history/{$id}/")) ->setIcon('transcript') ->setName(pht('Edit Log'))); - $item->addAction( - id(new PHUIListItemView()) - ->setHref('/herald/delete/'.$rule->getID().'/') - ->setIcon('delete') - ->setWorkflow(true)); - $content_type_name = idx($content_type_map, $rule->getContentType()); $item->addAttribute(pht('Affects: %s', $content_type_name)); diff --git a/src/applications/herald/controller/HeraldRuleViewController.php b/src/applications/herald/controller/HeraldRuleViewController.php index 13dbf9e75e..eeeecaf6d8 100644 --- a/src/applications/herald/controller/HeraldRuleViewController.php +++ b/src/applications/herald/controller/HeraldRuleViewController.php @@ -22,7 +22,21 @@ final class HeraldRuleViewController extends HeraldController { } $header = id(new PHUIHeaderView()) - ->setHeader($rule->getName()); + ->setUser($viewer) + ->setHeader($rule->getName()) + ->setPolicyObject($rule); + + if ($rule->getIsDisabled()) { + $header->setStatus( + 'oh-open', + 'red', + pht('Disabled')); + } else { + $header->setStatus( + 'oh-open', + null, + pht('Active')); + } $actions = $this->buildActionView($rule); $properties = $this->buildPropertyView($rule); @@ -37,10 +51,13 @@ final class HeraldRuleViewController extends HeraldController { ->setActionList($actions) ->setPropertyList($properties); + $timeline = $this->buildTimeline($rule); + return $this->buildApplicationPage( array( $crumbs, $object_box, + $timeline, ), array( 'title' => $rule->getName(), @@ -70,6 +87,25 @@ final class HeraldRuleViewController extends HeraldController { ->setDisabled(!$can_edit) ->setWorkflow(!$can_edit)); + if ($rule->getIsDisabled()) { + $disable_uri = "disable/{$id}/enable/"; + $disable_icon = 'enable'; + $disable_name = pht('Enable Rule'); + } else { + $disable_uri = "disable/{$id}/disable/"; + $disable_icon = 'disable'; + $disable_name = pht('Disable Rule'); + } + + $view->addAction( + id(new PhabricatorActionView()) + ->setName(pht('Disable Rule')) + ->setHref($this->getApplicationURI($disable_uri)) + ->setIcon($disable_icon) + ->setName($disable_name) + ->setDisabled(!$can_edit) + ->setWorkflow(true)); + return $view; } @@ -115,4 +151,31 @@ final class HeraldRuleViewController extends HeraldController { return $view; } + private function buildTimeline(HeraldRule $rule) { + $viewer = $this->getRequest()->getUser(); + + $xactions = id(new HeraldTransactionQuery()) + ->setViewer($viewer) + ->withObjectPHIDs(array($rule->getPHID())) + ->needComments(true) + ->execute(); + + $engine = id(new PhabricatorMarkupEngine()) + ->setViewer($viewer); + foreach ($xactions as $xaction) { + if ($xaction->getComment()) { + $engine->addObject( + $xaction->getComment(), + PhabricatorApplicationTransactionComment::MARKUP_FIELD_COMMENT); + } + } + $engine->process(); + + return id(new PhabricatorApplicationTransactionView()) + ->setUser($viewer) + ->setObjectPHID($rule->getPHID()) + ->setTransactions($xactions) + ->setMarkupEngine($engine); + } + } diff --git a/src/applications/herald/controller/HeraldTestConsoleController.php b/src/applications/herald/controller/HeraldTestConsoleController.php index 0b36b9a41f..4ee5cab5d2 100644 --- a/src/applications/herald/controller/HeraldTestConsoleController.php +++ b/src/applications/herald/controller/HeraldTestConsoleController.php @@ -59,6 +59,7 @@ final class HeraldTestConsoleController extends HeraldController { $rules = id(new HeraldRuleQuery()) ->setViewer($user) ->withContentTypes(array($adapter->getAdapterContentType())) + ->withDisabled(false) ->needConditionsAndActions(true) ->needAppliedToPHIDs(array($object->getPHID())) ->needValidateAuthors(true) diff --git a/src/applications/herald/editor/HeraldRuleEditor.php b/src/applications/herald/editor/HeraldRuleEditor.php new file mode 100644 index 0000000000..2b995099ba --- /dev/null +++ b/src/applications/herald/editor/HeraldRuleEditor.php @@ -0,0 +1,54 @@ +getTransactionType()) { + case HeraldRuleTransaction::TYPE_DISABLE: + return (int)$object->getIsDisabled(); + } + + } + + protected function getCustomTransactionNewValue( + PhabricatorLiskDAO $object, + PhabricatorApplicationTransaction $xaction) { + + switch ($xaction->getTransactionType()) { + case HeraldRuleTransaction::TYPE_DISABLE: + return (int)$xaction->getNewValue(); + } + + } + + protected function applyCustomInternalTransaction( + PhabricatorLiskDAO $object, + PhabricatorApplicationTransaction $xaction) { + + switch ($xaction->getTransactionType()) { + case HeraldRuleTransaction::TYPE_DISABLE: + return $object->setIsDisabled($xaction->getNewValue()); + } + + } + + protected function applyCustomExternalTransaction( + PhabricatorLiskDAO $object, + PhabricatorApplicationTransaction $xaction) { + return; + } + +} diff --git a/src/applications/herald/engine/HeraldEngine.php b/src/applications/herald/engine/HeraldEngine.php index 28eeee7ff4..71961db083 100644 --- a/src/applications/herald/engine/HeraldEngine.php +++ b/src/applications/herald/engine/HeraldEngine.php @@ -27,6 +27,7 @@ final class HeraldEngine { public static function loadAndApplyRules(HeraldAdapter $adapter) { $rules = id(new HeraldRuleQuery()) ->setViewer(PhabricatorUser::getOmnipotentUser()) + ->withDisabled(false) ->withContentTypes(array($adapter->getAdapterContentType())) ->needConditionsAndActions(true) ->needAppliedToPHIDs(array($adapter->getPHID())) diff --git a/src/applications/herald/query/HeraldRuleQuery.php b/src/applications/herald/query/HeraldRuleQuery.php index e153888090..374bcc0c29 100644 --- a/src/applications/herald/query/HeraldRuleQuery.php +++ b/src/applications/herald/query/HeraldRuleQuery.php @@ -8,6 +8,7 @@ final class HeraldRuleQuery private $authorPHIDs; private $ruleTypes; private $contentTypes; + private $disabled; private $needConditionsAndActions; private $needAppliedToPHIDs; @@ -43,6 +44,11 @@ final class HeraldRuleQuery return $this; } + public function withDisabled($disabled) { + $this->disabled = $disabled; + return $this; + } + public function needConditionsAndActions($need) { $this->needConditionsAndActions = $need; return $this; @@ -82,6 +88,7 @@ final class HeraldRuleQuery $types = HeraldAdapter::getEnabledAdapterMap($this->getViewer()); foreach ($rules as $key => $rule) { if (empty($types[$rule->getContentType()])) { + $this->didRejectResult($rule); unset($rules[$key]); } } @@ -171,6 +178,13 @@ final class HeraldRuleQuery $this->contentTypes); } + if ($this->disabled !== null) { + $where[] = qsprintf( + $conn_r, + 'rule.isDisabled = %d', + (int)$this->disabled); + } + $where[] = $this->buildPagingClause($conn_r); return $this->formatWhereClause($where); diff --git a/src/applications/herald/query/HeraldRuleSearchEngine.php b/src/applications/herald/query/HeraldRuleSearchEngine.php index 0ad2416181..ccafc360d5 100644 --- a/src/applications/herald/query/HeraldRuleSearchEngine.php +++ b/src/applications/herald/query/HeraldRuleSearchEngine.php @@ -12,6 +12,9 @@ final class HeraldRuleSearchEngine $saved->setParameter('contentType', $request->getStr('contentType')); $saved->setParameter('ruleType', $request->getStr('ruleType')); + $saved->setParameter( + 'disabled', + $this->readBoolFromRequest($request, 'disabled')); return $saved; } @@ -36,6 +39,11 @@ final class HeraldRuleSearchEngine $query->withRuleTypes(array($rule_type)); } + $disabled = $saved->getParameter('disabled'); + if ($disabled !== null) { + $query->withDisabled($disabled); + } + return $query; } @@ -71,7 +79,18 @@ final class HeraldRuleSearchEngine ->setName('ruleType') ->setLabel(pht('Rule Type')) ->setValue($rule_type) - ->setOptions($this->getRuleTypeOptions())); + ->setOptions($this->getRuleTypeOptions())) + ->appendChild( + id(new AphrontFormSelectControl()) + ->setName('disabled') + ->setLabel(pht('Rule Status')) + ->setValue($this->getBoolFromQuery($saved_query, 'disabled')) + ->setOptions( + array( + '' => pht('Show Enabled and Disabled Rules'), + 'false' => pht('Show Only Enabled Rules'), + 'true' => pht('Show Only Disabled Rules'), + ))); } protected function getURI($path) { @@ -85,6 +104,7 @@ final class HeraldRuleSearchEngine $names['authored'] = pht('Authored'); } + $names['active'] = pht('Active'); $names['all'] = pht('All'); return $names; @@ -95,13 +115,17 @@ final class HeraldRuleSearchEngine $query = $this->newSavedQuery(); $query->setQueryKey($query_key); + $viewer_phid = $this->requireViewer()->getPHID(); + switch ($query_key) { case 'all': return $query; + case 'active': + return $query->setParameter('disabled', false); case 'authored': - return $query->setParameter( - 'authorPHIDs', - array($this->requireViewer()->getPHID())); + return $query + ->setParameter('authorPHIDs', array($viewer_phid)) + ->setParameter('disabled', false); } return parent::buildSavedQueryFromBuiltin($query_key); diff --git a/src/applications/herald/query/HeraldTransactionQuery.php b/src/applications/herald/query/HeraldTransactionQuery.php new file mode 100644 index 0000000000..ac33da2070 --- /dev/null +++ b/src/applications/herald/query/HeraldTransactionQuery.php @@ -0,0 +1,10 @@ +isGlobalRule()) { - return PhabricatorPolicies::POLICY_USER; + switch ($capability) { + case PhabricatorPolicyCapability::CAN_VIEW: + return PhabricatorPolicies::POLICY_USER; + case PhabricatorPolicyCapability::CAN_EDIT: + $app = 'PhabricatorApplicationHerald'; + $herald = PhabricatorApplication::getByClass($app); + $global = PhabricatorApplicationHerald::CAN_CREATE_GLOBAL_RULE; + return $herald->getPolicy($global); + } } else { return PhabricatorPolicies::POLICY_NOONE; } @@ -213,9 +222,11 @@ final class HeraldRule extends HeraldDAO } public function describeAutomaticCapability($capability) { - // TODO: (T603) Sort this out. + if ($this->isPersonalRule()) { + return pht("A personal rule's owner can always view and edit it."); + } + return null; } - } diff --git a/src/applications/herald/storage/HeraldRuleTransaction.php b/src/applications/herald/storage/HeraldRuleTransaction.php index 192430846b..d63c477253 100644 --- a/src/applications/herald/storage/HeraldRuleTransaction.php +++ b/src/applications/herald/storage/HeraldRuleTransaction.php @@ -4,6 +4,7 @@ final class HeraldRuleTransaction extends PhabricatorApplicationTransaction { const TYPE_EDIT = 'herald:edit'; + const TYPE_DISABLE = 'herald:disable'; public function getApplicationName() { return 'herald'; @@ -17,5 +18,75 @@ final class HeraldRuleTransaction return new HeraldRuleTransactionComment(); } -} + public function getColor() { + $old = $this->getOldValue(); + $new = $this->getNewValue(); + switch ($this->getTransactionType()) { + case self::TYPE_DISABLE: + if ($new) { + return 'red'; + } else { + return 'green'; + } + } + + return parent::getColor(); + } + + public function getActionName() { + $old = $this->getOldValue(); + $new = $this->getNewValue(); + + switch ($this->getTransactionType()) { + case self::TYPE_DISABLE: + if ($new) { + return pht('Disabled'); + } else { + return pht('Enabled'); + } + } + + return parent::getActionName(); + } + + public function getIcon() { + $old = $this->getOldValue(); + $new = $this->getNewValue(); + + switch ($this->getTransactionType()) { + case self::TYPE_DISABLE: + if ($new) { + return 'disable'; + } else { + return 'enable'; + } + } + + return parent::getIcon(); + } + + + public function getTitle() { + $author_phid = $this->getAuthorPHID(); + + $old = $this->getOldValue(); + $new = $this->getNewValue(); + + switch ($this->getTransactionType()) { + case self::TYPE_DISABLE: + if ($new) { + return pht( + '%s disabled this rule.', + $this->renderHandleLink($author_phid)); + } else { + return pht( + '%s enabled this rule.', + $this->renderHandleLink($author_phid)); + } + } + + return parent::getTitle(); + } + +} diff --git a/src/applications/meta/query/PhabricatorAppSearchEngine.php b/src/applications/meta/query/PhabricatorAppSearchEngine.php index d3c82e6d79..5f25c1739e 100644 --- a/src/applications/meta/query/PhabricatorAppSearchEngine.php +++ b/src/applications/meta/query/PhabricatorAppSearchEngine.php @@ -12,9 +12,15 @@ final class PhabricatorAppSearchEngine $saved->setParameter('name', $request->getStr('name')); - $saved->setParameter('installed', $this->readBool($request, 'installed')); - $saved->setParameter('beta', $this->readBool($request, 'beta')); - $saved->setParameter('firstParty', $this->readBool($request, 'firstParty')); + $saved->setParameter( + 'installed', + $this->readBoolFromRequest($request, 'installed')); + $saved->setParameter( + 'beta', + $this->readBoolFromRequest($request, 'beta')); + $saved->setParameter( + 'firstParty', + $this->readBoolFromRequest($request, 'firstParty')); return $saved; } @@ -61,7 +67,7 @@ final class PhabricatorAppSearchEngine id(new AphrontFormSelectControl()) ->setLabel(pht('Installed')) ->setName('installed') - ->setValue($this->getBool($saved, 'installed')) + ->setValue($this->getBoolFromQuery($saved, 'installed')) ->setOptions( array( '' => pht('Show All Applications'), @@ -72,7 +78,7 @@ final class PhabricatorAppSearchEngine id(new AphrontFormSelectControl()) ->setLabel(pht('Beta')) ->setName('beta') - ->setValue($this->getBool($saved, 'beta')) + ->setValue($this->getBoolFromQuery($saved, 'beta')) ->setOptions( array( '' => pht('Show All Applications'), @@ -83,7 +89,7 @@ final class PhabricatorAppSearchEngine id(new AphrontFormSelectControl()) ->setLabel(pht('Provenance')) ->setName('firstParty') - ->setValue($this->getBool($saved, 'firstParty')) + ->setValue($this->getBoolFromQuery($saved, 'firstParty')) ->setOptions( array( '' => pht('Show All Applications'), @@ -118,19 +124,4 @@ final class PhabricatorAppSearchEngine return parent::buildSavedQueryFromBuiltin($query_key); } - private function readBool(AphrontRequest $request, $key) { - if (!strlen($request->getStr($key))) { - return null; - } - return $request->getBool($key); - } - - private function getBool(PhabricatorSavedQuery $query, $key) { - $value = $query->getParameter($key); - if ($value === null) { - return $value; - } - return $value ? 'true' : 'false'; - } - } diff --git a/src/applications/repository/worker/PhabricatorRepositoryCommitHeraldWorker.php b/src/applications/repository/worker/PhabricatorRepositoryCommitHeraldWorker.php index 6a5cd05f10..2bd77e38fe 100644 --- a/src/applications/repository/worker/PhabricatorRepositoryCommitHeraldWorker.php +++ b/src/applications/repository/worker/PhabricatorRepositoryCommitHeraldWorker.php @@ -29,6 +29,7 @@ final class PhabricatorRepositoryCommitHeraldWorker $rules = id(new HeraldRuleQuery()) ->setViewer(PhabricatorUser::getOmnipotentUser()) ->withContentTypes(array($adapter->getAdapterContentType())) + ->withDisabled(false) ->needConditionsAndActions(true) ->needAppliedToPHIDs(array($adapter->getPHID())) ->needValidateAuthors(true) diff --git a/src/applications/search/engine/PhabricatorApplicationSearchEngine.php b/src/applications/search/engine/PhabricatorApplicationSearchEngine.php index f960631a13..3011671e3a 100644 --- a/src/applications/search/engine/PhabricatorApplicationSearchEngine.php +++ b/src/applications/search/engine/PhabricatorApplicationSearchEngine.php @@ -299,6 +299,25 @@ abstract class PhabricatorApplicationSearchEngine { } + protected function readBoolFromRequest( + AphrontRequest $request, + $key) { + if (!strlen($request->getStr($key))) { + return null; + } + return $request->getBool($key); + } + + + protected function getBoolFromQuery(PhabricatorSavedQuery $query, $key) { + $value = $query->getParameter($key); + if ($value === null) { + return $value; + } + return $value ? 'true' : 'false'; + } + + /* -( Dates )-------------------------------------------------------------- */ diff --git a/src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php b/src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php index 84f72cc5d5..39ca97046e 100644 --- a/src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php +++ b/src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php @@ -1660,6 +1660,10 @@ final class PhabricatorBuiltinPatchList extends PhabricatorSQLPatchList { 'type' => 'php', 'name' => $this->getPatchPath('20131004.dxreviewers.php'), ), + '20131006.hdisable.sql' => array( + 'type' => 'sql', + 'name' => $this->getPatchPath('20131006.hdisable.sql'), + ), ); } } diff --git a/src/view/phui/PHUIHeaderView.php b/src/view/phui/PHUIHeaderView.php index 97cdce12f0..1c960c98a7 100644 --- a/src/view/phui/PHUIHeaderView.php +++ b/src/view/phui/PHUIHeaderView.php @@ -65,6 +65,31 @@ final class PHUIHeaderView extends AphrontView { return $this; } + public function setStatus($icon, $color, $name) { + $header_class = 'phui-header-status'; + + if ($color) { + $icon = $icon.'-'.$color; + $header_class = $header_class.'-'.$color; + } + + $img = id(new PHUIIconView()) + ->setSpriteSheet(PHUIIconView::SPRITE_STATUS) + ->setSpriteIcon($icon); + + $tag = phutil_tag( + 'span', + array( + 'class' => "{$header_class} plr", + ), + array( + $img, + $name, + )); + + return $this->addProperty(self::PROPERTY_STATUS, $tag); + } + public function render() { require_celerity_resource('phui-header-view-css');