@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator

Make Herald rules subscribable

Summary: Fixes T9757.

Test Plan: Created a Herald rule and then subscribed to it with a different account.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin

Maniphest Tasks: T9757

Differential Revision: https://secure.phabricator.com/D14468

+37 -1
+16
resources/sql/autopatches/20151112.herald.edge.sql
··· 1 + CREATE TABLE {$NAMESPACE}_herald.edge ( 2 + src VARBINARY(64) NOT NULL, 3 + type INT UNSIGNED NOT NULL, 4 + dst VARBINARY(64) NOT NULL, 5 + dateCreated INT UNSIGNED NOT NULL, 6 + seq INT UNSIGNED NOT NULL, 7 + dataID INT UNSIGNED, 8 + PRIMARY KEY (src, type, dst), 9 + KEY `src` (src, type, dateCreated, seq), 10 + UNIQUE KEY `key_dst` (dst, type, src) 11 + ) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT}; 12 + 13 + CREATE TABLE {$NAMESPACE}_herald.edgedata ( 14 + id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, 15 + data LONGTEXT NOT NULL COLLATE {$COLLATE_TEXT} 16 + ) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};
+1
src/__phutil_library_map__.php
··· 5073 5073 'PhabricatorFlaggableInterface', 5074 5074 'PhabricatorPolicyInterface', 5075 5075 'PhabricatorDestructibleInterface', 5076 + 'PhabricatorSubscribableInterface', 5076 5077 ), 5077 5078 'HeraldRuleController' => 'HeraldController', 5078 5079 'HeraldRuleEditor' => 'PhabricatorApplicationTransactionEditor',
+19 -1
src/applications/herald/storage/HeraldRule.php
··· 5 5 PhabricatorApplicationTransactionInterface, 6 6 PhabricatorFlaggableInterface, 7 7 PhabricatorPolicyInterface, 8 - PhabricatorDestructibleInterface { 8 + PhabricatorDestructibleInterface, 9 + PhabricatorSubscribableInterface { 9 10 10 11 const TABLE_RULE_APPLIED = 'herald_ruleapplied'; 11 12 ··· 320 321 } 321 322 322 323 324 + /* -( PhabricatorSubscribableInterface )----------------------------------- */ 325 + 326 + 327 + public function isAutomaticallySubscribed($phid) { 328 + return $this->isPersonalRule() && $phid == $this->getAuthorPHID(); 329 + } 330 + 331 + public function shouldShowSubscribersProperty() { 332 + return true; 333 + } 334 + 335 + public function shouldAllowSubscription($phid) { 336 + return true; 337 + } 338 + 339 + 323 340 /* -( PhabricatorDestructibleInterface )----------------------------------- */ 341 + 324 342 325 343 public function destroyObjectPermanently( 326 344 PhabricatorDestructionEngine $engine) {
+1
src/applications/herald/storage/HeraldSchemaSpec.php
··· 33 33 'unique' => true, 34 34 ), 35 35 )); 36 + $this->buildEdgeSchemata(new HeraldRule()); 36 37 } 37 38 38 39 }