Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15343496
D19104.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D19104.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -812,6 +812,8 @@
'DiffusionPreCommitContentHeraldField' => 'applications/diffusion/herald/DiffusionPreCommitContentHeraldField.php',
'DiffusionPreCommitContentMergeHeraldField' => 'applications/diffusion/herald/DiffusionPreCommitContentMergeHeraldField.php',
'DiffusionPreCommitContentMessageHeraldField' => 'applications/diffusion/herald/DiffusionPreCommitContentMessageHeraldField.php',
+ 'DiffusionPreCommitContentPackageHeraldField' => 'applications/diffusion/herald/DiffusionPreCommitContentPackageHeraldField.php',
+ 'DiffusionPreCommitContentPackageOwnerHeraldField' => 'applications/diffusion/herald/DiffusionPreCommitContentPackageOwnerHeraldField.php',
'DiffusionPreCommitContentPusherHeraldField' => 'applications/diffusion/herald/DiffusionPreCommitContentPusherHeraldField.php',
'DiffusionPreCommitContentPusherIsCommitterHeraldField' => 'applications/diffusion/herald/DiffusionPreCommitContentPusherIsCommitterHeraldField.php',
'DiffusionPreCommitContentPusherProjectsHeraldField' => 'applications/diffusion/herald/DiffusionPreCommitContentPusherProjectsHeraldField.php',
@@ -6007,6 +6009,8 @@
'DiffusionPreCommitContentHeraldField' => 'HeraldField',
'DiffusionPreCommitContentMergeHeraldField' => 'DiffusionPreCommitContentHeraldField',
'DiffusionPreCommitContentMessageHeraldField' => 'DiffusionPreCommitContentHeraldField',
+ 'DiffusionPreCommitContentPackageHeraldField' => 'DiffusionPreCommitContentHeraldField',
+ 'DiffusionPreCommitContentPackageOwnerHeraldField' => 'DiffusionPreCommitContentHeraldField',
'DiffusionPreCommitContentPusherHeraldField' => 'DiffusionPreCommitContentHeraldField',
'DiffusionPreCommitContentPusherIsCommitterHeraldField' => 'DiffusionPreCommitContentHeraldField',
'DiffusionPreCommitContentPusherProjectsHeraldField' => 'DiffusionPreCommitContentHeraldField',
diff --git a/src/applications/diffusion/herald/DiffusionPreCommitContentPackageHeraldField.php b/src/applications/diffusion/herald/DiffusionPreCommitContentPackageHeraldField.php
new file mode 100644
--- /dev/null
+++ b/src/applications/diffusion/herald/DiffusionPreCommitContentPackageHeraldField.php
@@ -0,0 +1,29 @@
+<?php
+
+final class DiffusionPreCommitContentPackageHeraldField
+ extends DiffusionPreCommitContentHeraldField {
+
+ const FIELDCONST = 'diffusion.pre.content.package';
+
+ public function getHeraldFieldName() {
+ return pht('Affected packages');
+ }
+
+ public function getFieldGroupKey() {
+ return HeraldRelatedFieldGroup::FIELDGROUPKEY;
+ }
+
+ public function getHeraldFieldValue($object) {
+ $packages = $this->getAdapter()->loadAffectedPackages();
+ return mpull($packages, 'getPHID');
+ }
+
+ protected function getHeraldFieldStandardType() {
+ return self::STANDARD_PHID_LIST;
+ }
+
+ protected function getDatasource() {
+ return new PhabricatorOwnersPackageDatasource();
+ }
+
+}
diff --git a/src/applications/diffusion/herald/DiffusionPreCommitContentPackageOwnerHeraldField.php b/src/applications/diffusion/herald/DiffusionPreCommitContentPackageOwnerHeraldField.php
new file mode 100644
--- /dev/null
+++ b/src/applications/diffusion/herald/DiffusionPreCommitContentPackageOwnerHeraldField.php
@@ -0,0 +1,34 @@
+<?php
+
+final class DiffusionPreCommitContentPackageOwnerHeraldField
+ extends DiffusionPreCommitContentHeraldField {
+
+ const FIELDCONST = 'diffusion.pre.content.package.owners';
+
+ public function getHeraldFieldName() {
+ return pht('Affected package owners');
+ }
+
+ public function getFieldGroupKey() {
+ return HeraldRelatedFieldGroup::FIELDGROUPKEY;
+ }
+
+ public function getHeraldFieldValue($object) {
+ $packages = $this->getAdapter()->loadAffectedPackages();
+ if (!$packages) {
+ return array();
+ }
+
+ $owners = PhabricatorOwnersOwner::loadAllForPackages($packages);
+ return mpull($owners, 'getUserPHID');
+ }
+
+ protected function getHeraldFieldStandardType() {
+ return self::STANDARD_PHID_LIST;
+ }
+
+ protected function getDatasource() {
+ return new PhabricatorProjectOrUserDatasource();
+ }
+
+}
diff --git a/src/applications/diffusion/herald/HeraldPreCommitContentAdapter.php b/src/applications/diffusion/herald/HeraldPreCommitContentAdapter.php
--- a/src/applications/diffusion/herald/HeraldPreCommitContentAdapter.php
+++ b/src/applications/diffusion/herald/HeraldPreCommitContentAdapter.php
@@ -7,6 +7,8 @@
private $fields;
private $revision = false;
+ private $affectedPackages;
+
public function getAdapterContentName() {
return pht('Commit Hook: Commit Content');
}
@@ -223,4 +225,16 @@
$this->getObject()->getRefNew());
}
+ public function loadAffectedPackages() {
+ if ($this->affectedPackages === null) {
+ $packages = PhabricatorOwnersPackage::loadAffectedPackages(
+ $this->getHookEngine()->getRepository(),
+ $this->getDiffContent('name'));
+ $this->affectedPackages = $packages;
+ }
+
+ return $this->affectedPackages;
+ }
+
+
}
diff --git a/src/applications/settings/panel/PhabricatorEmailFormatSettingsPanel.php b/src/applications/settings/panel/PhabricatorEmailFormatSettingsPanel.php
--- a/src/applications/settings/panel/PhabricatorEmailFormatSettingsPanel.php
+++ b/src/applications/settings/panel/PhabricatorEmailFormatSettingsPanel.php
@@ -18,7 +18,9 @@
}
public function isManagementPanel() {
- if (!$this->isUserPanel()) {
+ return false;
+/*
+ if (!$this->isUserPanel()) {
return false;
}
@@ -27,6 +29,7 @@
}
return false;
+*/
}
public function isTemplatePanel() {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Mar 10, 11:12 PM (1 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7479477
Default Alt Text
D19104.diff (5 KB)
Attached To
Mode
D19104: Add Owners Package support for "Commit Hook: Content" Herald rules
Attached
Detach File
Event Timeline
Log In to Comment