mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +01:00
Slowvote - add ability to destroy a poll
Summary: Fixes T5773. Test Plan: Made a poll and voted on it. Deleted it via ./bin/remove destory V1. No errors and the poll is gone. Reviewers: epriestley Reviewed By: epriestley Subscribers: epriestley, Korvin Maniphest Tasks: T5773 Differential Revision: https://secure.phabricator.com/D10167
This commit is contained in:
parent
77fa7c8939
commit
50a393913c
1 changed files with 24 additions and 1 deletions
|
@ -6,7 +6,8 @@ final class PhabricatorSlowvotePoll extends PhabricatorSlowvoteDAO
|
|||
PhabricatorSubscribableInterface,
|
||||
PhabricatorFlaggableInterface,
|
||||
PhabricatorTokenReceiverInterface,
|
||||
PhabricatorProjectInterface {
|
||||
PhabricatorProjectInterface,
|
||||
PhabricatorDestructibleInterface {
|
||||
|
||||
const RESPONSES_VISIBLE = 0;
|
||||
const RESPONSES_VOTERS = 1;
|
||||
|
@ -139,4 +140,26 @@ final class PhabricatorSlowvotePoll extends PhabricatorSlowvoteDAO
|
|||
return array($this->getAuthorPHID());
|
||||
}
|
||||
|
||||
/* -( PhabricatorDestructableInterface )----------------------------------- */
|
||||
|
||||
public function destroyObjectPermanently(
|
||||
PhabricatorDestructionEngine $engine) {
|
||||
|
||||
$this->openTransaction();
|
||||
$choices = id(new PhabricatorSlowvoteChoice())->loadAllWhere(
|
||||
'pollID = %d',
|
||||
$this->getID());
|
||||
foreach ($choices as $choice) {
|
||||
$choice->delete();
|
||||
}
|
||||
$options = id(new PhabricatorSlowvoteOption())->loadAllWhere(
|
||||
'pollID = %d',
|
||||
$this->getID());
|
||||
foreach ($options as $option) {
|
||||
$option->delete();
|
||||
}
|
||||
$this->delete();
|
||||
$this->saveTransaction();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue