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

Add "All" and "With Non-Owner Author" options for all Owners Package autoreview rules

Summary: Ref T13099. See PHI424. Fixes T11664. Several installs are interested in having these behaviors available in Owners by default and they aren't difficult to provide, it just makes the UI kind of messy. But I think there's enough general interest to justify it, now.

Test Plan: Created a package which owns "/" with a "With Non-Owner Author" review rule which I own. Created a revision, no package reviewer. Changed rule to "All", updated revision, got package reviewer.

Maniphest Tasks: T13099, T11664

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

+72 -31
+38 -17
src/applications/differential/editor/DifferentialTransactionEditor.php
··· 982 982 return array(); 983 983 } 984 984 985 - // Remove packages that the revision author is an owner of. If you own 986 - // code, you don't need another owner to review it. 987 - $authority = id(new PhabricatorOwnersPackageQuery()) 988 - ->setViewer(PhabricatorUser::getOmnipotentUser()) 989 - ->withPHIDs(mpull($packages, 'getPHID')) 990 - ->withAuthorityPHIDs(array($object->getAuthorPHID())) 991 - ->execute(); 992 - $authority = mpull($authority, null, 'getPHID'); 985 + // Identify the packages with "Non-Owner Author" review rules and remove 986 + // them if the author has authority over the package. 993 987 994 - foreach ($packages as $key => $package) { 995 - $package_phid = $package->getPHID(); 996 - if (isset($authority[$package_phid])) { 997 - unset($packages[$key]); 988 + $autoreview_map = PhabricatorOwnersPackage::getAutoreviewOptionsMap(); 989 + $need_authority = array(); 990 + foreach ($packages as $package) { 991 + $autoreview_setting = $package->getAutoReview(); 992 + 993 + $spec = idx($autoreview_map, $autoreview_setting); 994 + if (!$spec) { 998 995 continue; 999 996 } 997 + 998 + if (idx($spec, 'authority')) { 999 + $need_authority[$package->getPHID()] = $package->getPHID(); 1000 + } 1000 1001 } 1001 1002 1002 - if (!$packages) { 1003 - return array(); 1003 + if ($need_authority) { 1004 + $authority = id(new PhabricatorOwnersPackageQuery()) 1005 + ->setViewer(PhabricatorUser::getOmnipotentUser()) 1006 + ->withPHIDs($need_authority) 1007 + ->withAuthorityPHIDs(array($object->getAuthorPHID())) 1008 + ->execute(); 1009 + $authority = mpull($authority, null, 'getPHID'); 1010 + 1011 + foreach ($packages as $key => $package) { 1012 + $package_phid = $package->getPHID(); 1013 + if (isset($authority[$package_phid])) { 1014 + unset($packages[$key]); 1015 + continue; 1016 + } 1017 + } 1018 + 1019 + if (!$packages) { 1020 + return array(); 1021 + } 1004 1022 } 1005 1023 1006 1024 $auto_subscribe = array(); ··· 1009 1027 1010 1028 foreach ($packages as $package) { 1011 1029 switch ($package->getAutoReview()) { 1012 - case PhabricatorOwnersPackage::AUTOREVIEW_SUBSCRIBE: 1013 - $auto_subscribe[] = $package; 1014 - break; 1015 1030 case PhabricatorOwnersPackage::AUTOREVIEW_REVIEW: 1031 + case PhabricatorOwnersPackage::AUTOREVIEW_REVIEW_ALWAYS: 1016 1032 $auto_review[] = $package; 1017 1033 break; 1018 1034 case PhabricatorOwnersPackage::AUTOREVIEW_BLOCK: 1035 + case PhabricatorOwnersPackage::AUTOREVIEW_BLOCK_ALWAYS: 1019 1036 $auto_block[] = $package; 1037 + break; 1038 + case PhabricatorOwnersPackage::AUTOREVIEW_SUBSCRIBE: 1039 + case PhabricatorOwnersPackage::AUTOREVIEW_SUBSCRIBE_ALWAYS: 1040 + $auto_subscribe[] = $package; 1020 1041 break; 1021 1042 case PhabricatorOwnersPackage::AUTOREVIEW_NONE: 1022 1043 default:
+20 -5
src/applications/owners/storage/PhabricatorOwnersPackage.php
··· 33 33 34 34 const AUTOREVIEW_NONE = 'none'; 35 35 const AUTOREVIEW_SUBSCRIBE = 'subscribe'; 36 + const AUTOREVIEW_SUBSCRIBE_ALWAYS = 'subscribe-always'; 36 37 const AUTOREVIEW_REVIEW = 'review'; 38 + const AUTOREVIEW_REVIEW_ALWAYS = 'review-always'; 37 39 const AUTOREVIEW_BLOCK = 'block'; 40 + const AUTOREVIEW_BLOCK_ALWAYS = 'block-always'; 38 41 39 42 const DOMINION_STRONG = 'strong'; 40 43 const DOMINION_WEAK = 'weak'; ··· 74 77 self::AUTOREVIEW_NONE => array( 75 78 'name' => pht('No Autoreview'), 76 79 ), 77 - self::AUTOREVIEW_SUBSCRIBE => array( 78 - 'name' => pht('Subscribe to Changes'), 79 - ), 80 80 self::AUTOREVIEW_REVIEW => array( 81 - 'name' => pht('Review Changes'), 81 + 'name' => pht('Review Changes With Non-Owner Author'), 82 + 'authority' => true, 82 83 ), 83 84 self::AUTOREVIEW_BLOCK => array( 84 - 'name' => pht('Review Changes (Blocking)'), 85 + 'name' => pht('Review Changes With Non-Owner Author (Blocking)'), 86 + 'authority' => true, 87 + ), 88 + self::AUTOREVIEW_SUBSCRIBE => array( 89 + 'name' => pht('Subscribe to Changes With Non-Owner Author'), 90 + 'authority' => true, 91 + ), 92 + self::AUTOREVIEW_REVIEW_ALWAYS => array( 93 + 'name' => pht('Review All Changes'), 94 + ), 95 + self::AUTOREVIEW_BLOCK_ALWAYS => array( 96 + 'name' => pht('Review All Changes (Blocking)'), 97 + ), 98 + self::AUTOREVIEW_SUBSCRIBE_ALWAYS => array( 99 + 'name' => pht('Subscribe to All Changes'), 85 100 ), 86 101 ); 87 102 }
+14 -9
src/docs/user/userguide/owners.diviner
··· 84 84 created in Differential which affects code in a package, the package can 85 85 automatically be added as a subscriber or reviewer. 86 86 87 - The available settings are: 87 + The available settings allow you to take these actions: 88 88 89 - - **No Autoreview**: This package will not be added to new reviews. 90 - - **Subscribe to Changes**: This package will be added to reviews as a 91 - subscriber. Owners will be notified of changes, but not required to act. 92 89 - **Review Changes**: This package will be added to reviews as a reviewer. 93 90 Reviews will appear on the dashboards of package owners. 94 - - **Review Changes (Blocking)** This package will be added to reviews 95 - as a blocking reviewer. A package owner will be required to accept changes 91 + - **Review Changes (Blocking)** This package will be added to reviews as a 92 + blocking reviewer. A package owner will be required to accept changes 96 93 before they may land. 94 + - **Subscribe to Changes**: This package will be added to reviews as a 95 + subscriber. Owners will be notified of changes, but not required to act. 97 96 98 - NOTE: These rules **do not trigger** if the change author is a package owner. 99 - They only apply to changes made by users who aren't already owners. 97 + If you select the **With Non-Owner Author** option for these actions, the 98 + action will not trigger if the author of the revision is a package owner. This 99 + mode may be helpful if you are using Owners mostly to make sure that someone 100 + who is qualified is involved in each change to a piece of code. 101 + 102 + If you select the **All** option for these actions, the action will always 103 + trigger even if the author is a package owner. This mode may be helpful if you 104 + are using Owners mostly to suggest reviewers. 100 105 101 - These rules also do not trigger if the package has been archived. 106 + These rules do not trigger if the package has been archived. 102 107 103 108 The intent of this feature is to make it easy to configure simple, reasonable 104 109 behaviors. If you want more tailored or specific triggers, you can write more