Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15333711
D20795.id49584.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D20795.id49584.diff
View Options
diff --git a/resources/sql/autopatches/20190909.herald.01.rebuild.php b/resources/sql/autopatches/20190909.herald.01.rebuild.php
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20190909.herald.01.rebuild.php
@@ -0,0 +1,3 @@
+<?php
+
+PhabricatorRebuildIndexesWorker::rebuildObjectsWithQuery('HeraldRuleQuery');
diff --git a/src/applications/herald/engineextension/HeraldRuleIndexEngineExtension.php b/src/applications/herald/engineextension/HeraldRuleIndexEngineExtension.php
--- a/src/applications/herald/engineextension/HeraldRuleIndexEngineExtension.php
+++ b/src/applications/herald/engineextension/HeraldRuleIndexEngineExtension.php
@@ -37,6 +37,20 @@
$phids = array();
+ $fields = HeraldField::getAllFields();
+ foreach ($rule->getConditions() as $condition_record) {
+ $field = idx($fields, $condition_record->getFieldName());
+
+ if (!$field) {
+ continue;
+ }
+
+ $affected_phids = $field->getPHIDsAffectedByCondition($condition_record);
+ foreach ($affected_phids as $phid) {
+ $phids[] = $phid;
+ }
+ }
+
$actions = HeraldAction::getAllActions();
foreach ($rule->getActions() as $action_record) {
$action = idx($actions, $action_record->getAction());
diff --git a/src/applications/herald/field/HeraldField.php b/src/applications/herald/field/HeraldField.php
--- a/src/applications/herald/field/HeraldField.php
+++ b/src/applications/herald/field/HeraldField.php
@@ -176,6 +176,28 @@
return $value_type->renderEditorValue($value);
}
+ public function getPHIDsAffectedByCondition(HeraldCondition $condition) {
+ $phids = array();
+
+ $standard_type = $this->getHeraldFieldStandardType();
+ switch ($standard_type) {
+ case self::STANDARD_PHID:
+ case self::STANDARD_PHID_NULLABLE:
+ $phid = $condition->getValue();
+ if ($phid) {
+ $phids[] = $phid;
+ }
+ break;
+ case self::STANDARD_PHID_LIST:
+ foreach ($condition->getValue() as $phid) {
+ $phids[] = $phid;
+ }
+ break;
+ }
+
+ return $phids;
+ }
+
final public function setAdapter(HeraldAdapter $adapter) {
$this->adapter = $adapter;
return $this;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 9, 4:10 AM (2 w, 3 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7225878
Default Alt Text
D20795.id49584.diff (2 KB)
Attached To
Mode
D20795: Index Herald fields, not just actions, when identifying objects related to a particular Herald rule
Attached
Detach File
Event Timeline
Log In to Comment