1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-24 15:52:41 +01:00
phorge-phorge/src/applications/project/herald/PhabricatorProjectHeraldAdapter.php
epriestley a8dd74d292 Add Herald support for projects
Summary:
Ref T10054. Ref T6113. I'm going to remove subscribers from projects to fix the confusion between "watch" and "subscribe".

Users who have unusual use cases where they legitimately want to know when a project's description is updated or members change can use Herald to follow it.

This is also useful in general and improves consistency, although I don't have too many use cases for it.

Test Plan: Wrote a Herald rule, edited a project, saw the rule fire and send me email about the change.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T6113, T10054

Differential Revision: https://secure.phabricator.com/D15061
2016-01-19 19:37:54 -08:00

66 lines
1.4 KiB
PHP

<?php
final class PhabricatorProjectHeraldAdapter extends HeraldAdapter {
private $project;
protected function newObject() {
return new PhabricatorProject();
}
public function getAdapterApplicationClass() {
return 'PhabricatorProjectApplication';
}
public function getAdapterContentDescription() {
return pht('React to projects being created or updated.');
}
protected function initializeNewAdapter() {
$this->project = $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 setProject(PhabricatorProject $project) {
$this->project = $project;
return $this;
}
public function getProject() {
return $this->project;
}
public function getObject() {
return $this->project;
}
public function getAdapterContentName() {
return pht('Projects');
}
public function getHeraldName() {
return pht('Project %s', $this->getProject()->getName());
}
}