@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.

Modernize Dashboard edges

Summary: Modernize Dashboard edges to subclass `PhabricatorEdgeType`. Largely based on D11045.

Test Plan: Attached a panel to a dashboard, observed the expected comment in the transaction view (both ways).

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley

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

+250 -29
+4
src/__phutil_library_map__.php
··· 1583 1583 'PhabricatorDashboardController' => 'applications/dashboard/controller/PhabricatorDashboardController.php', 1584 1584 'PhabricatorDashboardCopyController' => 'applications/dashboard/controller/PhabricatorDashboardCopyController.php', 1585 1585 'PhabricatorDashboardDAO' => 'applications/dashboard/storage/PhabricatorDashboardDAO.php', 1586 + 'PhabricatorDashboardDashboardHasPanelEdgeType' => 'applications/dashboard/edge/PhabricatorDashboardDashboardHasPanelEdgeType.php', 1586 1587 'PhabricatorDashboardDashboardPHIDType' => 'applications/dashboard/phid/PhabricatorDashboardDashboardPHIDType.php', 1587 1588 'PhabricatorDashboardEditController' => 'applications/dashboard/controller/PhabricatorDashboardEditController.php', 1588 1589 'PhabricatorDashboardHistoryController' => 'applications/dashboard/controller/PhabricatorDashboardHistoryController.php', ··· 1597 1598 'PhabricatorDashboardPanelCoreCustomField' => 'applications/dashboard/customfield/PhabricatorDashboardPanelCoreCustomField.php', 1598 1599 'PhabricatorDashboardPanelCustomField' => 'applications/dashboard/customfield/PhabricatorDashboardPanelCustomField.php', 1599 1600 'PhabricatorDashboardPanelEditController' => 'applications/dashboard/controller/PhabricatorDashboardPanelEditController.php', 1601 + 'PhabricatorDashboardPanelHasDashboardEdgeType' => 'applications/dashboard/edge/PhabricatorDashboardPanelHasDashboardEdgeType.php', 1600 1602 'PhabricatorDashboardPanelListController' => 'applications/dashboard/controller/PhabricatorDashboardPanelListController.php', 1601 1603 'PhabricatorDashboardPanelPHIDType' => 'applications/dashboard/phid/PhabricatorDashboardPanelPHIDType.php', 1602 1604 'PhabricatorDashboardPanelQuery' => 'applications/dashboard/query/PhabricatorDashboardPanelQuery.php', ··· 4754 4756 'PhabricatorDashboardController' => 'PhabricatorController', 4755 4757 'PhabricatorDashboardCopyController' => 'PhabricatorDashboardController', 4756 4758 'PhabricatorDashboardDAO' => 'PhabricatorLiskDAO', 4759 + 'PhabricatorDashboardDashboardHasPanelEdgeType' => 'PhabricatorEdgeType', 4757 4760 'PhabricatorDashboardDashboardPHIDType' => 'PhabricatorPHIDType', 4758 4761 'PhabricatorDashboardEditController' => 'PhabricatorDashboardController', 4759 4762 'PhabricatorDashboardHistoryController' => 'PhabricatorDashboardController', ··· 4776 4779 ), 4777 4780 'PhabricatorDashboardPanelCustomField' => 'PhabricatorCustomField', 4778 4781 'PhabricatorDashboardPanelEditController' => 'PhabricatorDashboardController', 4782 + 'PhabricatorDashboardPanelHasDashboardEdgeType' => 'PhabricatorEdgeType', 4779 4783 'PhabricatorDashboardPanelListController' => 'PhabricatorDashboardController', 4780 4784 'PhabricatorDashboardPanelPHIDType' => 'PhabricatorPHIDType', 4781 4785 'PhabricatorDashboardPanelQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
+1 -1
src/applications/dashboard/controller/PhabricatorDashboardCopyController.php
··· 38 38 ->setTransactionType(PhabricatorTransactions::TYPE_EDGE) 39 39 ->setMetadataValue( 40 40 'edge:type', 41 - PhabricatorEdgeConfig::TYPE_DASHBOARD_HAS_PANEL) 41 + PhabricatorDashboardDashboardHasPanelEdgeType::EDGECONST) 42 42 ->setNewValue( 43 43 array( 44 44 '=' => array_fuse($dashboard->getPanelPHIDs()),
+1 -1
src/applications/dashboard/controller/PhabricatorDashboardEditController.php
··· 297 297 ->setTransactionType(PhabricatorTransactions::TYPE_EDGE) 298 298 ->setMetadataValue( 299 299 'edge:type', 300 - PhabricatorEdgeConfig::TYPE_DASHBOARD_HAS_PANEL) 300 + PhabricatorDashboardDashboardHasPanelEdgeType::EDGECONST) 301 301 ->setNewValue( 302 302 array( 303 303 '+' => array_fuse($panel_phids),
+1 -1
src/applications/dashboard/controller/PhabricatorDashboardPanelEditController.php
··· 405 405 ->setTransactionType(PhabricatorTransactions::TYPE_EDGE) 406 406 ->setMetadataValue( 407 407 'edge:type', 408 - PhabricatorEdgeConfig::TYPE_DASHBOARD_HAS_PANEL) 408 + PhabricatorDashboardDashboardHasPanelEdgeType::EDGECONST) 409 409 ->setNewValue( 410 410 array( 411 411 '+' => array(
+1 -1
src/applications/dashboard/controller/PhabricatorDashboardPanelViewController.php
··· 155 155 156 156 $dashboard_phids = PhabricatorEdgeQuery::loadDestinationPHIDs( 157 157 $panel->getPHID(), 158 - PhabricatorEdgeConfig::TYPE_PANEL_HAS_DASHBOARD); 158 + PhabricatorDashboardPanelHasDashboardEdgeType::EDGECONST); 159 159 $this->loadHandles($dashboard_phids); 160 160 161 161 $does_not_appear = pht(
+1 -1
src/applications/dashboard/controller/PhabricatorDashboardRemovePanelController.php
··· 45 45 ->setTransactionType(PhabricatorTransactions::TYPE_EDGE) 46 46 ->setMetadataValue( 47 47 'edge:type', 48 - PhabricatorEdgeConfig::TYPE_DASHBOARD_HAS_PANEL) 48 + PhabricatorDashboardDashboardHasPanelEdgeType::EDGECONST) 49 49 ->setNewValue( 50 50 array( 51 51 '-' => array(
+103
src/applications/dashboard/edge/PhabricatorDashboardDashboardHasPanelEdgeType.php
··· 1 + <?php 2 + 3 + final class PhabricatorDashboardDashboardHasPanelEdgeType 4 + extends PhabricatorEdgeType { 5 + 6 + const EDGECONST = 45; 7 + 8 + public function getInverseEdgeConstant() { 9 + return PhabricatorDashboardPanelHasDashboardEdgeType::EDGECONST; 10 + } 11 + 12 + public function shouldWriteInverseTransactions() { 13 + return true; 14 + } 15 + 16 + public function getTransactionAddString( 17 + $actor, 18 + $add_count, 19 + $add_edges) { 20 + 21 + return pht( 22 + '%s added %s panel(s): %s.', 23 + $actor, 24 + $add_count, 25 + $add_edges); 26 + } 27 + 28 + public function getTransactionRemoveString( 29 + $actor, 30 + $rem_count, 31 + $rem_edges) { 32 + 33 + return pht( 34 + '%s removed %s panel(s): %s.', 35 + $actor, 36 + $rem_count, 37 + $rem_edges); 38 + } 39 + 40 + public function getTransactionEditString( 41 + $actor, 42 + $total_count, 43 + $add_count, 44 + $add_edges, 45 + $rem_count, 46 + $rem_edges) { 47 + 48 + return pht( 49 + '%s edited panel(s), added %s: %s; removed %s: %s.', 50 + $actor, 51 + $add_count, 52 + $add_edges, 53 + $rem_count, 54 + $rem_edges); 55 + } 56 + 57 + public function getFeedAddString( 58 + $actor, 59 + $object, 60 + $add_count, 61 + $add_edges) { 62 + 63 + return pht( 64 + '%s added %s panel(s) for %s: %s.', 65 + $actor, 66 + $add_count, 67 + $object, 68 + $add_edges); 69 + } 70 + 71 + public function getFeedRemoveString( 72 + $actor, 73 + $object, 74 + $rem_count, 75 + $rem_edges) { 76 + 77 + return pht( 78 + '%s removed %s panel(s) for %s: %s.', 79 + $actor, 80 + $rem_count, 81 + $object, 82 + $rem_edges); 83 + } 84 + 85 + public function getFeedEditString( 86 + $actor, 87 + $object, 88 + $total_count, 89 + $add_count, 90 + $add_edges, 91 + $rem_count, 92 + $rem_edges) { 93 + 94 + return pht( 95 + '%s edited panel(s) for %s, added %s: %s; removed %s: %s.', 96 + $actor, 97 + $object, 98 + $add_count, 99 + $add_edges, 100 + $rem_count, 101 + $rem_edges); 102 + } 103 + }
+103
src/applications/dashboard/edge/PhabricatorDashboardPanelHasDashboardEdgeType.php
··· 1 + <?php 2 + 3 + final class PhabricatorDashboardPanelHasDashboardEdgeType 4 + extends PhabricatorEdgeType { 5 + 6 + const EDGECONST = 46; 7 + 8 + public function getInverseEdgeConstant() { 9 + return PhabricatorDashboardDashboardHasPanelEdgeType::EDGECONST; 10 + } 11 + 12 + public function shouldWriteInverseTransactions() { 13 + return true; 14 + } 15 + 16 + public function getTransactionAddString( 17 + $actor, 18 + $add_count, 19 + $add_edges) { 20 + 21 + return pht( 22 + '%s added %s dashboard(s): %s.', 23 + $actor, 24 + $add_count, 25 + $add_edges); 26 + } 27 + 28 + public function getTransactionRemoveString( 29 + $actor, 30 + $rem_count, 31 + $rem_edges) { 32 + 33 + return pht( 34 + '%s removed %s dashboard(s): %s.', 35 + $actor, 36 + $rem_count, 37 + $rem_edges); 38 + } 39 + 40 + public function getTransactionEditString( 41 + $actor, 42 + $total_count, 43 + $add_count, 44 + $add_edges, 45 + $rem_count, 46 + $rem_edges) { 47 + 48 + return pht( 49 + '%s edited dashboard(s), added %s: %s; removed %s: %s.', 50 + $actor, 51 + $add_count, 52 + $add_edges, 53 + $rem_count, 54 + $rem_edges); 55 + } 56 + 57 + public function getFeedAddString( 58 + $actor, 59 + $object, 60 + $add_count, 61 + $add_edges) { 62 + 63 + return pht( 64 + '%s added %s dashboard(s) for %s: %s.', 65 + $actor, 66 + $add_count, 67 + $object, 68 + $add_edges); 69 + } 70 + 71 + public function getFeedRemoveString( 72 + $actor, 73 + $object, 74 + $rem_count, 75 + $rem_edges) { 76 + 77 + return pht( 78 + '%s removed %s dashboard(s) for %s: %s.', 79 + $actor, 80 + $rem_count, 81 + $object, 82 + $rem_edges); 83 + } 84 + 85 + public function getFeedEditString( 86 + $actor, 87 + $object, 88 + $total_count, 89 + $add_count, 90 + $add_edges, 91 + $rem_count, 92 + $rem_edges) { 93 + 94 + return pht( 95 + '%s edited dashboard(s) for %s, added %s: %s; removed %s: %s.', 96 + $actor, 97 + $object, 98 + $add_count, 99 + $add_edges, 100 + $rem_count, 101 + $rem_edges); 102 + } 103 + }
+1 -1
src/applications/dashboard/editor/PhabricatorDashboardTransactionEditor.php
··· 23 23 ->setTransactionType(PhabricatorTransactions::TYPE_EDGE) 24 24 ->setMetadataValue( 25 25 'edge:type', 26 - PhabricatorEdgeConfig::TYPE_DASHBOARD_HAS_PANEL) 26 + PhabricatorDashboardDashboardHasPanelEdgeType::EDGECONST) 27 27 ->setNewValue( 28 28 array( 29 29 '+' => array(
+1 -1
src/applications/dashboard/query/PhabricatorDashboardQuery.php
··· 44 44 ->withSourcePHIDs(mpull($dashboards, 'getPHID')) 45 45 ->withEdgeTypes( 46 46 array( 47 - PhabricatorEdgeConfig::TYPE_DASHBOARD_HAS_PANEL, 47 + PhabricatorDashboardDashboardHasPanelEdgeType::EDGECONST, 48 48 )); 49 49 $edge_query->execute(); 50 50
-22
src/infrastructure/edges/constants/PhabricatorEdgeConfig.php
··· 20 20 const TYPE_OBJECT_USES_CREDENTIAL = 39; 21 21 const TYPE_CREDENTIAL_USED_BY_OBJECT = 40; 22 22 23 - const TYPE_DASHBOARD_HAS_PANEL = 45; 24 - const TYPE_PANEL_HAS_DASHBOARD = 46; 25 - 26 23 const TYPE_OBJECT_HAS_WATCHER = 47; 27 24 const TYPE_WATCHER_HAS_OBJECT = 48; 28 25 ··· 121 118 self::TYPE_OBJECT_USES_CREDENTIAL => self::TYPE_CREDENTIAL_USED_BY_OBJECT, 122 119 self::TYPE_CREDENTIAL_USED_BY_OBJECT => self::TYPE_OBJECT_USES_CREDENTIAL, 123 120 124 - self::TYPE_PANEL_HAS_DASHBOARD => self::TYPE_DASHBOARD_HAS_PANEL, 125 - self::TYPE_DASHBOARD_HAS_PANEL => self::TYPE_PANEL_HAS_DASHBOARD, 126 - 127 121 self::TYPE_OBJECT_HAS_WATCHER => self::TYPE_WATCHER_HAS_OBJECT, 128 122 self::TYPE_WATCHER_HAS_OBJECT => self::TYPE_OBJECT_HAS_WATCHER, 129 123 ); ··· 178 172 return '%s edited file(s), added %d: %s; removed %d: %s.'; 179 173 case self::TYPE_OBJECT_HAS_CONTRIBUTOR: 180 174 return '%s edited contributor(s), added %d: %s; removed %d: %s.'; 181 - case self::TYPE_DASHBOARD_HAS_PANEL: 182 - return '%s edited panel(s), added %d: %s; removed %d: %s.'; 183 - case self::TYPE_PANEL_HAS_DASHBOARD: 184 - return '%s edited dashboard(s), added %d: %s; removed %d: %s.'; 185 175 case self::TYPE_SUBSCRIBED_TO_OBJECT: 186 176 case self::TYPE_UNSUBSCRIBED_FROM_OBJECT: 187 177 case self::TYPE_FILE_HAS_OBJECT: ··· 202 192 return '%s added %d file(s): %s.'; 203 193 case self::TYPE_OBJECT_HAS_CONTRIBUTOR: 204 194 return '%s added %d contributor(s): %s.'; 205 - case self::TYPE_DASHBOARD_HAS_PANEL: 206 - return '%s added %d panel(s): %s.'; 207 - case self::TYPE_PANEL_HAS_DASHBOARD: 208 - return '%s added %d dashboard(s): %s.'; 209 195 case self::TYPE_OBJECT_HAS_WATCHER: 210 196 return '%s added %d watcher(s): %s.'; 211 197 case self::TYPE_SUBSCRIBED_TO_OBJECT: ··· 228 214 return '%s removed %d file(s): %s.'; 229 215 case self::TYPE_OBJECT_HAS_CONTRIBUTOR: 230 216 return '%s removed %d contributor(s): %s.'; 231 - case self::TYPE_DASHBOARD_HAS_PANEL: 232 - return '%s removed %d panel(s): %s.'; 233 - case self::TYPE_PANEL_HAS_DASHBOARD: 234 - return '%s removed %d dashboard(s): %s.'; 235 217 case self::TYPE_OBJECT_HAS_WATCHER: 236 218 return '%s removed %d watcher(s): %s.'; 237 219 case self::TYPE_SUBSCRIBED_TO_OBJECT: ··· 254 236 return '%s updated files of %s.'; 255 237 case self::TYPE_OBJECT_HAS_CONTRIBUTOR: 256 238 return '%s updated contributors of %s.'; 257 - case self::TYPE_PANEL_HAS_DASHBOARD: 258 - return '%s updated panels for %s.'; 259 - case self::TYPE_PANEL_HAS_DASHBOARD: 260 - return '%s updated dashboards for %s.'; 261 239 case self::TYPE_OBJECT_HAS_WATCHER: 262 240 return '%s updated watchers for %s.'; 263 241 case self::TYPE_SUBSCRIBED_TO_OBJECT:
+33
src/infrastructure/internationalization/translation/PhabricatorBaseEnglishTranslation.php
··· 798 798 '%s edited %s project(s) for %s, added %s: %s; removed %s: %s.' => 799 799 '%s edited projects for %3$s, added: %5$s; removed %7$s.', 800 800 801 + '%s added %s panel(s): %s.' => array( 802 + array( 803 + '%s added a panel: %3$s.', 804 + '%s added panels: %3$s.', 805 + ), 806 + ), 807 + 808 + '%s removed %s panel(s): %s.' => array( 809 + array( 810 + '%s removed a panel: %3$s.', 811 + '%s removed panels: %3$s.', 812 + ), 813 + ), 814 + 815 + '%s edited %s panel(s), added %s: %s; removed %s: %s.' => 816 + '%s edited panels, added %4$s; removed %6$s.', 817 + 818 + '%s added %s dashboard(s): %s.' => array( 819 + array( 820 + '%s added a dashboard: %3$s.', 821 + '%s added dashboards: %3$s.', 822 + ), 823 + ), 824 + 825 + '%s removed %s dashboard(s): %s.' => array( 826 + array( 827 + '%s removed a dashboard: %3$s.', 828 + '%s removed dashboards: %3$s.', 829 + ), 830 + ), 831 + 832 + '%s edited %s dashboard(s), added %s: %s; removed %s: %s.' => 833 + '%s edited dashboards, added %4$s; removed %6$s.', 801 834 ); 802 835 } 803 836