mirror of
https://we.phorge.it/source/phorge.git
synced 2025-03-11 03:44:48 +01:00
Allow pastes to be destroyed
Summary: Fixes T6186. Test Plan: - Used `bin/remove destroy Pxxx` to destroy a paste. - Verified file, transactions, etc., were destroyed. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T6186 Differential Revision: https://secure.phabricator.com/D10563
This commit is contained in:
parent
3c527cc472
commit
9dee67618d
2 changed files with 41 additions and 1 deletions
|
@ -4855,6 +4855,8 @@ phutil_register_library_map(array(
|
|||
'PhabricatorMentionableInterface',
|
||||
'PhabricatorPolicyInterface',
|
||||
'PhabricatorProjectInterface',
|
||||
'PhabricatorDestructibleInterface',
|
||||
'PhabricatorApplicationTransactionInterface',
|
||||
),
|
||||
'PhabricatorPasteApplication' => 'PhabricatorApplication',
|
||||
'PhabricatorPasteCommentController' => 'PhabricatorPasteController',
|
||||
|
|
|
@ -7,7 +7,9 @@ final class PhabricatorPaste extends PhabricatorPasteDAO
|
|||
PhabricatorFlaggableInterface,
|
||||
PhabricatorMentionableInterface,
|
||||
PhabricatorPolicyInterface,
|
||||
PhabricatorProjectInterface {
|
||||
PhabricatorProjectInterface,
|
||||
PhabricatorDestructibleInterface,
|
||||
PhabricatorApplicationTransactionInterface {
|
||||
|
||||
protected $title;
|
||||
protected $authorPHID;
|
||||
|
@ -152,4 +154,40 @@ final class PhabricatorPaste extends PhabricatorPasteDAO
|
|||
return pht('The author of a paste can always view and edit it.');
|
||||
}
|
||||
|
||||
|
||||
/* -( PhabricatorDestructibleInterface )----------------------------------- */
|
||||
|
||||
|
||||
public function destroyObjectPermanently(
|
||||
PhabricatorDestructionEngine $engine) {
|
||||
|
||||
if ($this->filePHID) {
|
||||
$file = id(new PhabricatorFileQuery())
|
||||
->setViewer(PhabricatorUser::getOmnipotentUser())
|
||||
->withPHIDs(array($this->filePHID))
|
||||
->executeOne();
|
||||
if ($file) {
|
||||
$engine->destroyObject($file);
|
||||
}
|
||||
}
|
||||
|
||||
$this->delete();
|
||||
}
|
||||
|
||||
|
||||
/* -( PhabricatorApplicationTransactionInterface )------------------------- */
|
||||
|
||||
|
||||
public function getApplicationTransactionEditor() {
|
||||
return new PhabricatorPasteEditor();
|
||||
}
|
||||
|
||||
public function getApplicationTransactionObject() {
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getApplicationTransactionTemplate() {
|
||||
return new PhabricatorPasteTransaction();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue