@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
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Remove flags and tokens upon object destruction

Summary: When destroying an object, also remove all associated flags and tokens.

Test Plan: Awarded a Maniphest task with a token and flagged it as well. Destroyed it with `./bin/remove destroy` and saw flag and token removed from the database.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

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

+25 -3
+25 -3
src/applications/system/engine/PhabricatorDestructionEngine.php
··· 68 68 } 69 69 70 70 // TODO: Remove stuff from search indexes? 71 - // TODO: PhabricatorFlaggableInterface 72 - // TODO: PhabricatorTokenReceiverInterface 71 + 72 + if ($object instanceof PhabricatorFlaggableInterface) { 73 + $flags = id(new PhabricatorFlag())->loadAllWhere( 74 + 'objectPHID = %s', $object_phid); 75 + 76 + foreach ($flags as $flag) { 77 + $flag->delete(); 78 + } 79 + } 80 + 81 + $flags = id(new PhabricatorFlag())->loadAllWhere( 82 + 'ownerPHID = %s', $object_phid); 83 + foreach ($flags as $flag) { 84 + $flag->delete(); 85 + } 86 + 87 + if ($object instanceof PhabricatorTokenReceiverInterface) { 88 + $tokens = id(new PhabricatorTokenGiven())->loadAllWhere( 89 + 'objectPHID = %s', $object_phid); 90 + 91 + foreach ($tokens as $token) { 92 + $token->delete(); 93 + } 94 + } 73 95 } 74 96 75 97 private function destroyEdges($src_phid) { ··· 116 138 } 117 139 118 140 private function destroyNotifications($object_phid) { 119 - $table = id(new PhabricatorFeedStoryNotification()); 141 + $table = new PhabricatorFeedStoryNotification(); 120 142 $conn_w = $table->establishConnection('w'); 121 143 122 144 queryfx(