diff --git a/composer.json b/composer.json index f1a67cb..b165191 100644 --- a/composer.json +++ b/composer.json @@ -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" }, "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": { diff --git a/patches/flaglist-flaglistspermissionshandler.patch b/patches/flaglist-flaglistspermissionshandler.patch new file mode 100644 index 0000000..f7e33b7 --- /dev/null +++ b/patches/flaglist-flaglistspermissionshandler.patch @@ -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();