From 8cdc7d7ee16482d630e49af2765dc958062b8693 Mon Sep 17 00:00:00 2001 From: "Dylan T." Date: Mon, 25 Nov 2024 20:43:59 +0000 Subject: [PATCH 1/3] auto-approve: drop pull_request_review trigger this doesn't work for PRs from forks, since fork PRs don't have access to repo secrets. we'll need some more advanced mechanism to avoid redundant reviews, but that's a job for another time. --- .github/workflows/team-pr-auto-approve.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/team-pr-auto-approve.yml b/.github/workflows/team-pr-auto-approve.yml index f14581213..0c2fdd81c 100644 --- a/.github/workflows/team-pr-auto-approve.yml +++ b/.github/workflows/team-pr-auto-approve.yml @@ -11,8 +11,7 @@ on: - opened - reopened - ready_for_review - pull_request_review: - types: dismissed + - synchronize jobs: dispatch: @@ -36,4 +35,4 @@ jobs: token: ${{ steps.generate-token.outputs.token }} repository: ${{ github.repository_owner }}/RestrictedActions event-type: auto_approve_collaborator_pr - client-payload: '{"repo": "${{ github.repository }}", "pull_request_id": "${{ github.event.pull_request.number }}", "reviewer_id": "${{ github.event.review.user.id || 0 }}" }' + client-payload: '{"repo": "${{ github.repository }}", "pull_request_id": "${{ github.event.pull_request.number }}", "reviewer_id": "0" }' From 52fe2cb97fa0cee5e4d72fa8e4fd298b4697385f Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 25 Nov 2024 21:29:26 +0000 Subject: [PATCH 2/3] PermissionManager: deprecate permission subscription system this is no longer used by the core, and as far as I can tell no plugin uses it either. it was used in the past for chat broadcast channels, but not anymore. --- src/permission/PermissionManager.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/permission/PermissionManager.php b/src/permission/PermissionManager.php index f2b02e8e5..c9e37f5e9 100644 --- a/src/permission/PermissionManager.php +++ b/src/permission/PermissionManager.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace pocketmine\permission; +use pocketmine\Server; use pocketmine\utils\Utils; use function count; use function spl_object_id; @@ -71,6 +72,10 @@ class PermissionManager{ } } + /** + * @deprecated Superseded by server chat broadcast channels + * @see Server::subscribeToBroadcastChannel() + */ public function subscribeToPermission(string $permission, PermissibleInternal $permissible) : void{ if(!isset($this->permSubs[$permission])){ $this->permSubs[$permission] = []; @@ -78,6 +83,10 @@ class PermissionManager{ $this->permSubs[$permission][spl_object_id($permissible)] = $permissible; } + /** + * @deprecated Superseded by server chat broadcast channels + * @see Server::unsubscribeFromBroadcastChannel() + */ public function unsubscribeFromPermission(string $permission, PermissibleInternal $permissible) : void{ if(isset($this->permSubs[$permission][spl_object_id($permissible)])){ if(count($this->permSubs[$permission]) === 1){ @@ -88,6 +97,10 @@ class PermissionManager{ } } + /** + * @deprecated Superseded by server chat broadcast channels + * @see Server::unsubscribeFromAllBroadcastChannels() + */ public function unsubscribeFromAllPermissions(PermissibleInternal $permissible) : void{ foreach(Utils::promoteKeys($this->permSubs) as $permission => $subs){ if(count($subs) === 1 && isset($subs[spl_object_id($permissible)])){ @@ -99,6 +112,8 @@ class PermissionManager{ } /** + * @deprecated Superseded by server chat broadcast channels + * @see Server::getBroadcastChannelSubscribers() * @return PermissibleInternal[] */ public function getPermissionSubscriptions(string $permission) : array{ From 905a10e980cb6552bab0bad59cc593852409033d Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 25 Nov 2024 21:39:35 +0000 Subject: [PATCH 3/3] Deprecate InventoryAction->onAddToTransaction() this never made any sense --- src/inventory/transaction/InventoryTransaction.php | 13 +++---------- .../transaction/action/InventoryAction.php | 1 + .../transaction/action/SlotChangeAction.php | 8 -------- 3 files changed, 4 insertions(+), 18 deletions(-) diff --git a/src/inventory/transaction/InventoryTransaction.php b/src/inventory/transaction/InventoryTransaction.php index b3465a8df..47290e401 100644 --- a/src/inventory/transaction/InventoryTransaction.php +++ b/src/inventory/transaction/InventoryTransaction.php @@ -111,6 +111,9 @@ class InventoryTransaction{ if(!isset($this->actions[$hash = spl_object_id($action)])){ $this->actions[$hash] = $action; $action->onAddToTransaction($this); + if($action instanceof SlotChangeAction && !isset($this->inventories[$inventoryId = spl_object_id($action->getInventory())])){ + $this->inventories[$inventoryId] = $action->getInventory(); + } }else{ throw new \InvalidArgumentException("Tried to add the same action to a transaction twice"); } @@ -129,16 +132,6 @@ class InventoryTransaction{ $this->actions = $actions; } - /** - * @internal This method should not be used by plugins, it's used to add tracked inventories for InventoryActions - * involving inventories. - */ - public function addInventory(Inventory $inventory) : void{ - if(!isset($this->inventories[$hash = spl_object_id($inventory)])){ - $this->inventories[$hash] = $inventory; - } - } - /** * @param Item[] $needItems * @param Item[] $haveItems diff --git a/src/inventory/transaction/action/InventoryAction.php b/src/inventory/transaction/action/InventoryAction.php index fff3d22b8..2f0db083c 100644 --- a/src/inventory/transaction/action/InventoryAction.php +++ b/src/inventory/transaction/action/InventoryAction.php @@ -60,6 +60,7 @@ abstract class InventoryAction{ /** * Called when the action is added to the specified InventoryTransaction. + * @deprecated */ public function onAddToTransaction(InventoryTransaction $transaction) : void{ diff --git a/src/inventory/transaction/action/SlotChangeAction.php b/src/inventory/transaction/action/SlotChangeAction.php index 68c3dba1b..3c9b8e5cf 100644 --- a/src/inventory/transaction/action/SlotChangeAction.php +++ b/src/inventory/transaction/action/SlotChangeAction.php @@ -25,7 +25,6 @@ namespace pocketmine\inventory\transaction\action; use pocketmine\inventory\Inventory; use pocketmine\inventory\SlotValidatedInventory; -use pocketmine\inventory\transaction\InventoryTransaction; use pocketmine\inventory\transaction\TransactionValidationException; use pocketmine\item\Item; use pocketmine\player\Player; @@ -85,13 +84,6 @@ class SlotChangeAction extends InventoryAction{ } } - /** - * Adds this action's target inventory to the transaction's inventory list. - */ - public function onAddToTransaction(InventoryTransaction $transaction) : void{ - $transaction->addInventory($this->inventory); - } - /** * Sets the item into the target inventory. */