1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-12 00:26:13 +01:00
phorge-phorge/src/applications/ponder/herald/HeraldPonderQuestionAdapter.php
Chad Little dc687dbd92 Add basic Herald support to Ponder
Summary: Ref T6919, Just a basic herald adapter (new questions) for Ponder

Test Plan: Created a Personal Rule, got subscribed to new question, saw transcript.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T6919

Differential Revision: https://secure.phabricator.com/D13828
2015-08-08 10:22:18 -07:00

62 lines
1.3 KiB
PHP

<?php
final class HeraldPonderQuestionAdapter extends HeraldAdapter {
private $question;
protected function newObject() {
return new PonderQuestion();
}
public function getAdapterApplicationClass() {
return 'PhabricatorPonderApplication';
}
public function getAdapterContentDescription() {
return pht('React to questions being created or updated.');
}
protected function initializeNewAdapter() {
$this->question = $this->newObject();
}
public function supportsApplicationEmail() {
return true;
}
public function getRepetitionOptions() {
return array(
HeraldRepetitionPolicyConfig::EVERY,
HeraldRepetitionPolicyConfig::FIRST,
);
}
public function supportsRuleType($rule_type) {
switch ($rule_type) {
case HeraldRuleTypeConfig::RULE_TYPE_GLOBAL:
case HeraldRuleTypeConfig::RULE_TYPE_PERSONAL:
return true;
case HeraldRuleTypeConfig::RULE_TYPE_OBJECT:
default:
return false;
}
}
public function setQuestion(PonderQuestion $question) {
$this->question = $question;
return $this;
}
public function getObject() {
return $this->question;
}
public function getAdapterContentName() {
return pht('Ponder Questions');
}
public function getHeraldName() {
return 'Q'.$this->getObject()->getID();
}
}