Page MenuHomePhorge

D25878.1740162964.diff
No OneTemporary

D25878.1740162964.diff

diff --git a/src/applications/project/controller/PhabricatorProjectArchiveController.php b/src/applications/project/controller/PhabricatorProjectArchiveController.php
--- a/src/applications/project/controller/PhabricatorProjectArchiveController.php
+++ b/src/applications/project/controller/PhabricatorProjectArchiveController.php
@@ -52,7 +52,46 @@
$button = pht('Activate Project');
} else {
$title = pht('Really archive project?');
- $body = pht('This project will be moved to the archive.');
+
+ // Make dialog mention Herald rules which use the project in conditions
+ $affected_rules = id(new HeraldRuleQuery())
+ ->setViewer(PhabricatorUser::getOmnipotentUser())
+ ->withDisabled(false)
+ ->withAffectedObjectPHIDs(array($project->getPHID()))
+ ->execute();
+ if ($affected_rules) {
+ $affected_rules = array_keys($affected_rules);
+ sort($affected_rules);
+ $prefixed_rules = array_map(function ($key) {
+ return 'H'.$key;
+ }, $affected_rules);
+ $prefixed_rules = implode(', ', $prefixed_rules);
+
+ // Render a link if acting user has Herald "Can Use Application" rights
+ $can_herald = PhabricatorApplication::isClassInstalledForViewer(
+ 'PhabricatorHeraldApplication',
+ $viewer);
+ if ($can_herald) {
+ $affected_rules = implode(',', $affected_rules);
+ $herald_uri = new PhutilURI(
+ PhabricatorEnv::getEnvConfig('phabricator.base-uri').
+ '/herald/?ids='.$affected_rules.'#R');
+ $herald_query_uri = phutil_tag('a', array(
+ 'href' => $herald_uri,
+ 'target' => '_blank',
+ ),
+ $prefixed_rules);
+ $body = pht('This project will be moved to the archive. Herald '.
+ 'rule(s) %s use this project in their conditions and may require '.
+ 'changes.', $herald_query_uri);
+ } else {
+ $body = pht('This project will be moved to the archive. Herald '.
+ 'rule(s) %s use this project in their conditions and may require '.
+ 'changes. Please inform your Herald magician.', $prefixed_rules);
+ }
+ } else {
+ $body = pht('This project will be moved to the archive.');
+ }
$button = pht('Archive Project');
}

File Metadata

Mime Type
text/plain
Expires
Fri, Feb 21, 18:36 (1 d, 5 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1174714
Default Alt Text
D25878.1740162964.diff (2 KB)

Event Timeline