dpc-sdp / tide_api

Content API for Tide distribution.
https://www.drupal.org/project/tide_api
GNU General Public License v2.0
0 stars 2 forks source link

Share link not visible on node revisions- Drupal 9.4 #100

Open govindmaloo opened 1 year ago

govindmaloo commented 1 year ago

The share link action link is not rendering because of the latest changes introduced to get the revision from the route.

Change record: 9.3.x https://www.drupal.org/node/2942013

Existing code snippet Class ShareLinkTokenController public function checkNodeAccess(AccountInterface $account) : AccessResultInterface {

Line 132

    // Attempt to retrieve the node revision.
      $vid = $this->routeMatch->getParameter('node_revision');
      if ($vid) {
        $revision = $this->entityTypeManager()->getStorage('node')->loadRevision($vid);
        if ($revision && $revision->id() === $node->id()) {
          return AccessResult::allowedIf($revision->access('view', $account))
            ->addCacheableDependency($revision)
            ->addCacheableDependency($account);
        }
      }

Replace with

  // Attempt to retrieve the node revision.
      $revision = $this->routeMatch->getParameter('node_revision');
      if ($revision && $revision->id() === $node->id()) {
        return AccessResult::allowedIf($revision->access('view', $account))
          ->addCacheableDependency($revision)
          ->addCacheableDependency($account);
      }
MdNadimHossain commented 1 year ago

Thanks for this @govindmaloo I Have updated the PR - https://github.com/dpc-sdp/tide_api/pull/99 will roll this one out in the next release after testing