Skip to content

Commit

Permalink
[Third-Party] Add extension to kick back to author
Browse files Browse the repository at this point in the history
  • Loading branch information
grimreaper committed Jul 21, 2015
1 parent 6002117 commit 8e442fc
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions src/extensions/herald/customaction/KickBackAction.php
@@ -0,0 +1,54 @@
<?php

class KickBackAction extends HeraldCustomAction {

public function appliesToAdapter(HeraldAdapter $adapter) {
return ($adapter instanceof HeraldManiphestTaskAdapter);
}

public function appliesToRuleType($rule_type) {
switch ($rule_type) {
case HeraldRuleTypeConfig::RULE_TYPE_GLOBAL:
return true;
case HeraldRuleTypeConfig::RULE_TYPE_PERSONAL:
case HeraldRuleTypeConfig::RULE_TYPE_OBJECT:
default:
return false;
}
}

public function getActionKey() {
return "swisspol.kick";
}

public function getActionName() {
return pht('Reassign to author');
}

public function getActionType() {
return HeraldAdapter::VALUE_NONE;
}

public function applyEffect(
HeraldAdapter $adapter,
$object,
HeraldEffect $effect) {

$task = $object;

$xactions = array();

$xactions[] = id(new ManiphestTransaction())
->setTransactionType(ManiphestTransaction::TYPE_OWNER)
->setNewValue($original_author);

foreach ($xactions as $xaction) {
$adapter->queueTransaction($xaction);
}

return new HeraldApplyTranscript(
$effect,
true,
pht('Reassigned to original author'));
}
}

0 comments on commit 8e442fc

Please sign in to comment.