1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-28 00:10:57 +01:00

Forbid construction of dashboard panels on various Phortune objects

Summary:
Fixes T7102. These panels don't work, aren't meaningful, and don't seem very useful.

We could eventually support providing context to dashboards somehow ("merchant dashboard") but don't have much of an apparent need for this.

Test Plan:
  - Tried to create cart/subscription/charge dashboard panels.
  - Unable to create new ones.
  - The ones from before the change show a relevant error now.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T7102

Differential Revision: https://secure.phabricator.com/D11953
This commit is contained in:
epriestley 2015-03-03 10:39:43 -08:00
parent e1d09fd035
commit 6b65c578c7
4 changed files with 23 additions and 0 deletions

View file

@ -130,6 +130,14 @@ final class PhabricatorDashboardQueryPanelType
$class));
}
if (!$engine->canUseInPanelContext()) {
throw new Exception(
pht(
'Application search engines of class "%s" can not be used to build '.
'dashboard panels.',
$class));
}
return $engine;
}

View file

@ -7,6 +7,11 @@ final class PhortuneCartSearchEngine
private $account;
private $subscription;
public function canUseInPanelContext() {
// These only make sense in an account or merchant context.
return false;
}
public function setAccount(PhortuneAccount $account) {
$this->account = $account;
return $this;

View file

@ -5,6 +5,11 @@ final class PhortuneChargeSearchEngine
private $account;
public function canUseInPanelContext() {
// These only make sense in an account context.
return false;
}
public function setAccount(PhortuneAccount $account) {
$this->account = $account;
return $this;

View file

@ -6,6 +6,11 @@ final class PhortuneSubscriptionSearchEngine
private $merchant;
private $account;
public function canUseInPanelContext() {
// These only make sense in an account or merchant context.
return false;
}
public function setAccount(PhortuneAccount $account) {
$this->account = $account;
return $this;