- π§πͺBelgium rp7
Patch in #32 works fine, but uses a deprecated method that is removed in D10. Adjusted the patch.
The current logic for allowing unpublished nodes to display in the Linkit autocomplete will not respect the "Include unpublished nodes" setting if there are any implementations of hook_node_grants() in the codebase:
if ($this->configuration['include_unpublished'] == FALSE) {
$query->condition('status', NodeInterface::PUBLISHED);
}
elseif (!$this->moduleHandler->hasImplementations('node_grants')) {
if (($this->currentUser->hasPermission('bypass node access') || $this->currentUser->hasPermission('view any unpublished content'))) {
// User can see all content, no check necessary.
}
elseif ($this->currentUser->hasPermission('view own unpublished content')) {
// Users with "view own unpublished content" can see only their own.
if ($this->configuration['include_unpublished'] == TRUE) {
$or_condition = $query
->orConditionGroup()
->condition('status', NodeInterface::PUBLISHED)
->condition('uid', $this->currentUser->id());
$query->condition($or_condition);
}
}
}
else {
// All other users should only get published results.
$query->condition('status', NodeInterface::PUBLISHED);
}
This is not immediately obvious to people trying to use the "Include unpublished nodes" option, and might better be handled by a dedicated permission.
Needs work
7.0
Code
The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Patch in #32 works fine, but uses a deprecated method that is removed in D10. Adjusted the patch.