mirror of
https://we.phorge.it/source/phorge.git
synced 2025-03-11 20:04:53 +01:00
Implement DestructibleInterface for dashboards and panels
Summary: Fixes T5471. Test Plan: Used `bin/remove destroy` to destroy a dashboard and a panel. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T5471 Differential Revision: https://secure.phabricator.com/D10283
This commit is contained in:
parent
cd82b90c15
commit
211a93529b
3 changed files with 39 additions and 2 deletions
|
@ -4231,6 +4231,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorDashboard' => array(
|
'PhabricatorDashboard' => array(
|
||||||
'PhabricatorDashboardDAO',
|
'PhabricatorDashboardDAO',
|
||||||
'PhabricatorPolicyInterface',
|
'PhabricatorPolicyInterface',
|
||||||
|
'PhabricatorDestructibleInterface',
|
||||||
),
|
),
|
||||||
'PhabricatorDashboardAddPanelController' => 'PhabricatorDashboardController',
|
'PhabricatorDashboardAddPanelController' => 'PhabricatorDashboardController',
|
||||||
'PhabricatorDashboardApplication' => 'PhabricatorApplication',
|
'PhabricatorDashboardApplication' => 'PhabricatorApplication',
|
||||||
|
@ -4249,6 +4250,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorDashboardDAO',
|
'PhabricatorDashboardDAO',
|
||||||
'PhabricatorPolicyInterface',
|
'PhabricatorPolicyInterface',
|
||||||
'PhabricatorCustomFieldInterface',
|
'PhabricatorCustomFieldInterface',
|
||||||
|
'PhabricatorDestructibleInterface',
|
||||||
),
|
),
|
||||||
'PhabricatorDashboardPanelArchiveController' => 'PhabricatorDashboardController',
|
'PhabricatorDashboardPanelArchiveController' => 'PhabricatorDashboardController',
|
||||||
'PhabricatorDashboardPanelCoreCustomField' => array(
|
'PhabricatorDashboardPanelCoreCustomField' => array(
|
||||||
|
|
|
@ -4,7 +4,9 @@
|
||||||
* A collection of dashboard panels with a specific layout.
|
* A collection of dashboard panels with a specific layout.
|
||||||
*/
|
*/
|
||||||
final class PhabricatorDashboard extends PhabricatorDashboardDAO
|
final class PhabricatorDashboard extends PhabricatorDashboardDAO
|
||||||
implements PhabricatorPolicyInterface {
|
implements
|
||||||
|
PhabricatorPolicyInterface,
|
||||||
|
PhabricatorDestructibleInterface {
|
||||||
|
|
||||||
protected $name;
|
protected $name;
|
||||||
protected $viewPolicy;
|
protected $viewPolicy;
|
||||||
|
@ -104,4 +106,24 @@ final class PhabricatorDashboard extends PhabricatorDashboardDAO
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* -( PhabricatorDestructibleInterface )----------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
|
public function destroyObjectPermanently(
|
||||||
|
PhabricatorDestructionEngine $engine) {
|
||||||
|
|
||||||
|
$this->openTransaction();
|
||||||
|
$installs = id(new PhabricatorDashboardInstall())->loadAllWhere(
|
||||||
|
'dashboardPHID = %s',
|
||||||
|
$this->getPHID());
|
||||||
|
foreach ($installs as $install) {
|
||||||
|
$install->delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->delete();
|
||||||
|
$this->saveTransaction();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,8 @@ final class PhabricatorDashboardPanel
|
||||||
extends PhabricatorDashboardDAO
|
extends PhabricatorDashboardDAO
|
||||||
implements
|
implements
|
||||||
PhabricatorPolicyInterface,
|
PhabricatorPolicyInterface,
|
||||||
PhabricatorCustomFieldInterface {
|
PhabricatorCustomFieldInterface,
|
||||||
|
PhabricatorDestructibleInterface {
|
||||||
|
|
||||||
protected $name;
|
protected $name;
|
||||||
protected $panelType;
|
protected $panelType;
|
||||||
|
@ -131,4 +132,16 @@ final class PhabricatorDashboardPanel
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* -( PhabricatorDestructibleInterface )----------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
|
public function destroyObjectPermanently(
|
||||||
|
PhabricatorDestructionEngine $engine) {
|
||||||
|
|
||||||
|
$this->openTransaction();
|
||||||
|
$this->delete();
|
||||||
|
$this->saveTransaction();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue