patch flaglists again

This commit is contained in:
Bachir Soussi Chiadmi 2021-12-08 11:10:56 +01:00
parent 3b9aa44fa3
commit 9cc1152f6b
2 changed files with 26 additions and 1 deletions

View File

@ -265,7 +265,8 @@
"Term Reference Tree: Re-implement Track List https://www.drupal.org/project/term_reference_tree/issues/3064280": "https://www.drupal.org/files/issues/2021-07-16/3064280_bring_back_tracklist-15.patch" "Term Reference Tree: Re-implement Track List https://www.drupal.org/project/term_reference_tree/issues/3064280": "https://www.drupal.org/files/issues/2021-07-16/3064280_bring_back_tracklist-15.patch"
}, },
"drupal/flag_lists": { "drupal/flag_lists": {
"Call to a member function id() on null in flag_lists_flag_action_access https://www.drupal.org/project/flag_lists/issues/3230729": "./patches/hook_flag_access_id_on_null_4.patch" "Call to a member function id() on null in flag_lists_flag_action_access https://www.drupal.org/project/flag_lists/issues/3230729": "./patches/hook_flag_access_id_on_null_4.patch",
"Call to a member function id() on null in flaglistspermissionshandler": "./patches/flaglist-flaglistspermissionshandler.patch"
} }
}, },
"drupal-scaffold": { "drupal-scaffold": {

View File

@ -0,0 +1,24 @@
diff --git a/src/Permissions/FlagListsPermissionHandler.php b/src/Permissions/FlagListsPermissionHandler.php
index 3d08b98..baab066 100644
--- a/src/Permissions/FlagListsPermissionHandler.php
+++ b/src/Permissions/FlagListsPermissionHandler.php
@@ -49,10 +49,15 @@ class FlagListsPermissionHandler extends PermissionHandler {
// due to the flag lists module.
$flagLists = $this->flagListsService->getAllFlaggingCollections();
foreach ($flagLists as $flagList) {
- $flag = 'flag ' . $flagList->getRelatedFlag()->id();
- $unflag = 'unflag ' . $flagList->getRelatedFlag()->id();
- unset($all_permissions[$flag]);
- unset($all_permissions[$unflag]);
+ if ($flagList->getRelatedFlag()) {
+ $flag = 'flag ' . $flagList->getRelatedFlag()->id();
+ $unflag = 'unflag ' . $flagList->getRelatedFlag()->id();
+ unset($all_permissions[$flag]);
+ unset($all_permissions[$unflag]);
+ } else {
+ $logger = \Drupal::logger('flag_lists');
+ $logger->error('flagging_collection ' . $flagList->getName() . ' (' . $flagList->id() . ')' . ' owned by user id ' . $flagList->getOwner()->id() . ' doesn\'t have related flag');
+ }
}
// Check for access for the used template as well.
$flagTemplates = $this->flagListsService->getAllFlagForList();