1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-26 15:30:58 +01:00

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
This commit is contained in:
epriestley 2016-01-19 17:18:17 -08:00
parent 9f36594100
commit a8dd74d292
7 changed files with 140 additions and 2 deletions

View file

@ -152,7 +152,7 @@ return array(
'rsrc/css/phui/phui-text.css' => 'cf019f54',
'rsrc/css/phui/phui-timeline-view.css' => '2efceff8',
'rsrc/css/phui/phui-two-column-view.css' => '39ecafb1',
'rsrc/css/phui/phui-workboard-view.css' => '95a54f74',
'rsrc/css/phui/phui-workboard-view.css' => '8330bca5',
'rsrc/css/phui/phui-workpanel-view.css' => 'adec7699',
'rsrc/css/sprite-login.css' => '60e8560e',
'rsrc/css/sprite-menu.css' => '9dd65b92',
@ -829,7 +829,7 @@ return array(
'phui-theme-css' => '981a58f8',
'phui-timeline-view-css' => '2efceff8',
'phui-two-column-view-css' => '39ecafb1',
'phui-workboard-view-css' => '95a54f74',
'phui-workboard-view-css' => '8330bca5',
'phui-workpanel-view-css' => 'adec7699',
'phuix-action-list-view' => 'b5c256b8',
'phuix-action-view' => '8cf6d262',

View file

@ -1147,6 +1147,7 @@ phutil_register_library_map(array(
'HeraldEffect' => 'applications/herald/engine/HeraldEffect.php',
'HeraldEmptyFieldValue' => 'applications/herald/value/HeraldEmptyFieldValue.php',
'HeraldEngine' => 'applications/herald/engine/HeraldEngine.php',
'HeraldExactProjectsField' => 'applications/project/herald/HeraldExactProjectsField.php',
'HeraldField' => 'applications/herald/field/HeraldField.php',
'HeraldFieldGroup' => 'applications/herald/field/HeraldFieldGroup.php',
'HeraldFieldTestCase' => 'applications/herald/field/__tests__/HeraldFieldTestCase.php',
@ -2883,6 +2884,8 @@ phutil_register_library_map(array(
'PhabricatorProjectEditPictureController' => 'applications/project/controller/PhabricatorProjectEditPictureController.php',
'PhabricatorProjectFulltextEngine' => 'applications/project/search/PhabricatorProjectFulltextEngine.php',
'PhabricatorProjectHeraldAction' => 'applications/project/herald/PhabricatorProjectHeraldAction.php',
'PhabricatorProjectHeraldAdapter' => 'applications/project/herald/PhabricatorProjectHeraldAdapter.php',
'PhabricatorProjectHeraldFieldGroup' => 'applications/project/herald/PhabricatorProjectHeraldFieldGroup.php',
'PhabricatorProjectHistoryController' => 'applications/project/controller/PhabricatorProjectHistoryController.php',
'PhabricatorProjectIconSet' => 'applications/project/icon/PhabricatorProjectIconSet.php',
'PhabricatorProjectInterface' => 'applications/project/interface/PhabricatorProjectInterface.php',
@ -5247,6 +5250,7 @@ phutil_register_library_map(array(
'HeraldEffect' => 'Phobject',
'HeraldEmptyFieldValue' => 'HeraldFieldValue',
'HeraldEngine' => 'Phobject',
'HeraldExactProjectsField' => 'HeraldField',
'HeraldField' => 'Phobject',
'HeraldFieldGroup' => 'HeraldGroup',
'HeraldFieldTestCase' => 'PhutilTestCase',
@ -7285,6 +7289,8 @@ phutil_register_library_map(array(
'PhabricatorProjectEditPictureController' => 'PhabricatorProjectController',
'PhabricatorProjectFulltextEngine' => 'PhabricatorFulltextEngine',
'PhabricatorProjectHeraldAction' => 'HeraldAction',
'PhabricatorProjectHeraldAdapter' => 'HeraldAdapter',
'PhabricatorProjectHeraldFieldGroup' => 'HeraldFieldGroup',
'PhabricatorProjectHistoryController' => 'PhabricatorProjectController',
'PhabricatorProjectIconSet' => 'PhabricatorIconSet',
'PhabricatorProjectListController' => 'PhabricatorProjectController',

View file

@ -917,4 +917,19 @@ final class PhabricatorProjectTransactionEditor
->save();
}
protected function shouldApplyHeraldRules(
PhabricatorLiskDAO $object,
array $xactions) {
return true;
}
protected function buildHeraldAdapter(
PhabricatorLiskDAO $object,
array $xactions) {
return id(new PhabricatorProjectHeraldAdapter())
->setProject($object);
}
}

View file

@ -0,0 +1,31 @@
<?php
final class HeraldExactProjectsField extends HeraldField {
const FIELDCONST = 'projects.exact';
public function getHeraldFieldName() {
return pht('Projects being edited');
}
public function getFieldGroupKey() {
return PhabricatorProjectHeraldFieldGroup::FIELDGROUPKEY;
}
public function supportsObject($object) {
return ($object instanceof PhabricatorProject);
}
public function getHeraldFieldValue($object) {
return array($object->getPHID());
}
protected function getHeraldFieldStandardType() {
return self::STANDARD_PHID_LIST;
}
protected function getDatasource() {
return new PhabricatorProjectDatasource();
}
}

View file

@ -0,0 +1,66 @@
<?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());
}
}

View file

@ -0,0 +1,15 @@
<?php
final class PhabricatorProjectHeraldFieldGroup extends HeraldFieldGroup {
const FIELDGROUPKEY = 'projects.project';
public function getGroupLabel() {
return pht('Project Fields');
}
protected function getGroupOrder() {
return 500;
}
}

View file

@ -41,6 +41,11 @@
left: 253px;
}
.device-desktop .phui-profile-menu-collapsed .project-board-wrapper
.phui-workboard-view-shadow {
left: 93px;
}
.device-desktop .phui-workboard-view .aphront-multi-column-fixed
.aphront-multi-column-inner {
margin-left: 0;