1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-11 07:11:04 +01:00

Add more mail stamps: tasks, subscribers, projects, spaces

Summary: Ref T13053. Adds task stamps plus the major infrastructure applications.

Test Plan: {F5413058}

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13053

Differential Revision: https://secure.phabricator.com/D18996
This commit is contained in:
epriestley 2018-02-05 11:09:36 -08:00
parent 3131e733a8
commit 7d475eb09a
7 changed files with 171 additions and 3 deletions

View file

@ -1528,6 +1528,7 @@ phutil_register_library_map(array(
'ManiphestGetTaskTransactionsConduitAPIMethod' => 'applications/maniphest/conduit/ManiphestGetTaskTransactionsConduitAPIMethod.php',
'ManiphestHovercardEngineExtension' => 'applications/maniphest/engineextension/ManiphestHovercardEngineExtension.php',
'ManiphestInfoConduitAPIMethod' => 'applications/maniphest/conduit/ManiphestInfoConduitAPIMethod.php',
'ManiphestMailEngineExtension' => 'applications/maniphest/engineextension/ManiphestMailEngineExtension.php',
'ManiphestNameIndex' => 'applications/maniphest/storage/ManiphestNameIndex.php',
'ManiphestPointsConfigType' => 'applications/maniphest/config/ManiphestPointsConfigType.php',
'ManiphestPrioritiesConfigType' => 'applications/maniphest/config/ManiphestPrioritiesConfigType.php',
@ -3853,6 +3854,7 @@ phutil_register_library_map(array(
'PhabricatorProjectsEditField' => 'applications/transactions/editfield/PhabricatorProjectsEditField.php',
'PhabricatorProjectsExportEngineExtension' => 'infrastructure/export/engine/PhabricatorProjectsExportEngineExtension.php',
'PhabricatorProjectsFulltextEngineExtension' => 'applications/project/engineextension/PhabricatorProjectsFulltextEngineExtension.php',
'PhabricatorProjectsMailEngineExtension' => 'applications/project/engineextension/PhabricatorProjectsMailEngineExtension.php',
'PhabricatorProjectsMembersSearchEngineAttachment' => 'applications/project/engineextension/PhabricatorProjectsMembersSearchEngineAttachment.php',
'PhabricatorProjectsMembershipIndexEngineExtension' => 'applications/project/engineextension/PhabricatorProjectsMembershipIndexEngineExtension.php',
'PhabricatorProjectsPolicyRule' => 'applications/project/policyrule/PhabricatorProjectsPolicyRule.php',
@ -4146,6 +4148,7 @@ phutil_register_library_map(array(
'PhabricatorSpacesExportEngineExtension' => 'infrastructure/export/engine/PhabricatorSpacesExportEngineExtension.php',
'PhabricatorSpacesInterface' => 'applications/spaces/interface/PhabricatorSpacesInterface.php',
'PhabricatorSpacesListController' => 'applications/spaces/controller/PhabricatorSpacesListController.php',
'PhabricatorSpacesMailEngineExtension' => 'applications/spaces/engineextension/PhabricatorSpacesMailEngineExtension.php',
'PhabricatorSpacesNamespace' => 'applications/spaces/storage/PhabricatorSpacesNamespace.php',
'PhabricatorSpacesNamespaceArchiveTransaction' => 'applications/spaces/xaction/PhabricatorSpacesNamespaceArchiveTransaction.php',
'PhabricatorSpacesNamespaceDatasource' => 'applications/spaces/typeahead/PhabricatorSpacesNamespaceDatasource.php',
@ -4230,6 +4233,7 @@ phutil_register_library_map(array(
'PhabricatorSubscriptionsFulltextEngineExtension' => 'applications/subscriptions/engineextension/PhabricatorSubscriptionsFulltextEngineExtension.php',
'PhabricatorSubscriptionsHeraldAction' => 'applications/subscriptions/herald/PhabricatorSubscriptionsHeraldAction.php',
'PhabricatorSubscriptionsListController' => 'applications/subscriptions/controller/PhabricatorSubscriptionsListController.php',
'PhabricatorSubscriptionsMailEngineExtension' => 'applications/subscriptions/engineextension/PhabricatorSubscriptionsMailEngineExtension.php',
'PhabricatorSubscriptionsRemoveSelfHeraldAction' => 'applications/subscriptions/herald/PhabricatorSubscriptionsRemoveSelfHeraldAction.php',
'PhabricatorSubscriptionsRemoveSubscribersHeraldAction' => 'applications/subscriptions/herald/PhabricatorSubscriptionsRemoveSubscribersHeraldAction.php',
'PhabricatorSubscriptionsSearchEngineAttachment' => 'applications/subscriptions/engineextension/PhabricatorSubscriptionsSearchEngineAttachment.php',
@ -6795,6 +6799,7 @@ phutil_register_library_map(array(
'ManiphestGetTaskTransactionsConduitAPIMethod' => 'ManiphestConduitAPIMethod',
'ManiphestHovercardEngineExtension' => 'PhabricatorHovercardEngineExtension',
'ManiphestInfoConduitAPIMethod' => 'ManiphestConduitAPIMethod',
'ManiphestMailEngineExtension' => 'PhabricatorMailEngineExtension',
'ManiphestNameIndex' => 'ManiphestDAO',
'ManiphestPointsConfigType' => 'PhabricatorJSONConfigType',
'ManiphestPrioritiesConfigType' => 'PhabricatorJSONConfigType',
@ -9482,6 +9487,7 @@ phutil_register_library_map(array(
'PhabricatorProjectsEditField' => 'PhabricatorTokenizerEditField',
'PhabricatorProjectsExportEngineExtension' => 'PhabricatorExportEngineExtension',
'PhabricatorProjectsFulltextEngineExtension' => 'PhabricatorFulltextEngineExtension',
'PhabricatorProjectsMailEngineExtension' => 'PhabricatorMailEngineExtension',
'PhabricatorProjectsMembersSearchEngineAttachment' => 'PhabricatorSearchEngineAttachment',
'PhabricatorProjectsMembershipIndexEngineExtension' => 'PhabricatorIndexEngineExtension',
'PhabricatorProjectsPolicyRule' => 'PhabricatorPolicyRule',
@ -9851,6 +9857,7 @@ phutil_register_library_map(array(
'PhabricatorSpacesExportEngineExtension' => 'PhabricatorExportEngineExtension',
'PhabricatorSpacesInterface' => 'PhabricatorPHIDInterface',
'PhabricatorSpacesListController' => 'PhabricatorSpacesController',
'PhabricatorSpacesMailEngineExtension' => 'PhabricatorMailEngineExtension',
'PhabricatorSpacesNamespace' => array(
'PhabricatorSpacesDAO',
'PhabricatorPolicyInterface',
@ -9941,6 +9948,7 @@ phutil_register_library_map(array(
'PhabricatorSubscriptionsFulltextEngineExtension' => 'PhabricatorFulltextEngineExtension',
'PhabricatorSubscriptionsHeraldAction' => 'HeraldAction',
'PhabricatorSubscriptionsListController' => 'PhabricatorController',
'PhabricatorSubscriptionsMailEngineExtension' => 'PhabricatorMailEngineExtension',
'PhabricatorSubscriptionsRemoveSelfHeraldAction' => 'PhabricatorSubscriptionsHeraldAction',
'PhabricatorSubscriptionsRemoveSubscribersHeraldAction' => 'PhabricatorSubscriptionsHeraldAction',
'PhabricatorSubscriptionsSearchEngineAttachment' => 'PhabricatorSearchEngineAttachment',

View file

@ -0,0 +1,58 @@
<?php
final class ManiphestMailEngineExtension
extends PhabricatorMailEngineExtension {
const EXTENSIONKEY = 'maniphest';
public function supportsObject($object) {
return ($object instanceof ManiphestTask);
}
public function newMailStampTemplates($object) {
return array(
id(new PhabricatorPHIDMailStamp())
->setKey('author')
->setLabel(pht('Author')),
id(new PhabricatorPHIDMailStamp())
->setKey('task-owner')
->setLabel(pht('Task Owner')),
id(new PhabricatorBoolMailStamp())
->setKey('task-unassigned')
->setLabel(pht('Task Unassigned')),
id(new PhabricatorStringMailStamp())
->setKey('task-priority')
->setLabel(pht('Task Priority')),
id(new PhabricatorStringMailStamp())
->setKey('task-status')
->setLabel(pht('Task Status')),
id(new PhabricatorStringMailStamp())
->setKey('subtype')
->setLabel(pht('Subtype')),
);
}
public function newMailStamps($object, array $xactions) {
$editor = $this->getEditor();
$viewer = $this->getViewer();
$this->getMailStamp('author')
->setValue($object->getAuthorPHID());
$this->getMailStamp('task-owner')
->setValue($object->getOwnerPHID());
$this->getMailStamp('task-unassigned')
->setValue(!$object->getOwnerPHID());
$this->getMailStamp('task-priority')
->setValue($object->getPriority());
$this->getMailStamp('task-status')
->setValue($object->getStatus());
$this->getMailStamp('subtype')
->setValue($object->getSubtype());
}
}

View file

@ -45,6 +45,7 @@ final class PhabricatorOwnersPackagePHIDType extends PhabricatorPHIDType {
->setName($monogram)
->setFullName("{$monogram}: {$name}")
->setCommandLineObjectName("{$monogram} {$name}")
->setMailStampName($monogram)
->setURI($uri);
if ($package->isArchived()) {

View file

@ -0,0 +1,32 @@
<?php
final class PhabricatorProjectsMailEngineExtension
extends PhabricatorMailEngineExtension {
const EXTENSIONKEY = 'projects';
public function supportsObject($object) {
return ($object instanceof PhabricatorProjectInterface);
}
public function newMailStampTemplates($object) {
return array(
id(new PhabricatorPHIDMailStamp())
->setKey('tag')
->setLabel(pht('Tagged with Project')),
);
}
public function newMailStamps($object, array $xactions) {
$editor = $this->getEditor();
$viewer = $this->getViewer();
$project_phids = PhabricatorEdgeQuery::loadDestinationPHIDs(
$object->getPHID(),
PhabricatorProjectObjectHasProjectEdgeType::EDGECONST);
$this->getMailStamp('tag')
->setValue($project_phids);
}
}

View file

@ -0,0 +1,35 @@
<?php
final class PhabricatorSpacesMailEngineExtension
extends PhabricatorMailEngineExtension {
const EXTENSIONKEY = 'spaces';
public function supportsObject($object) {
return ($object instanceof PhabricatorSpacesInterface);
}
public function newMailStampTemplates($object) {
return array(
id(new PhabricatorPHIDMailStamp())
->setKey('space')
->setLabel(pht('Space')),
);
}
public function newMailStamps($object, array $xactions) {
$editor = $this->getEditor();
$viewer = $this->getViewer();
if (!PhabricatorSpacesNamespaceQuery::getSpacesExist()) {
return;
}
$space_phid = PhabricatorSpacesNamespaceQuery::getObjectSpacePHID(
$object);
$this->getMailStamp('space')
->setValue($space_phid);
}
}

View file

@ -36,9 +36,11 @@ final class PhabricatorSpacesNamespacePHIDType
$monogram = $namespace->getMonogram();
$name = $namespace->getNamespaceName();
$handle->setName($name);
$handle->setFullName(pht('%s %s', $monogram, $name));
$handle->setURI('/'.$monogram);
$handle
->setName($name)
->setFullName(pht('%s %s', $monogram, $name))
->setURI('/'.$monogram)
->setMailStampName($monogram);
if ($namespace->getIsArchived()) {
$handle->setStatus(PhabricatorObjectHandle::STATUS_CLOSED);

View file

@ -0,0 +1,32 @@
<?php
final class PhabricatorSubscriptionsMailEngineExtension
extends PhabricatorMailEngineExtension {
const EXTENSIONKEY = 'subscriptions';
public function supportsObject($object) {
return ($object instanceof PhabricatorSubscribableInterface);
}
public function newMailStampTemplates($object) {
return array(
id(new PhabricatorPHIDMailStamp())
->setKey('subscriber')
->setLabel(pht('Subscriber')),
);
}
public function newMailStamps($object, array $xactions) {
$editor = $this->getEditor();
$viewer = $this->getViewer();
$subscriber_phids = PhabricatorEdgeQuery::loadDestinationPHIDs(
$object->getPHID(),
PhabricatorObjectHasSubscriberEdgeType::EDGECONST);
$this->getMailStamp('subscriber')
->setValue($subscriber_phids);
}
}