Some cleanup and D10 compatibility

Created on 10 September 2024, 3 months ago

Problem/Motivation

composer.json says the module is compatible with D10 but workspaces.information is D11.

Steps to reproduce

Proposed resolution

The only method this module uses in WorkspaceInformation is isEntitySupported() which falls back to the same code as what WorkspaceManager::isEntitySupported() does in D10. So I created a service alias which is either workspaces.information or workspaces.manager as required.

While I was doing this, I removed all Drupal:: calls from ParallelWorkspaceEntityRepository and also made it use the decorator pattern instead of extending EntityRepository.

Remaining tasks

Probably ParallelWorkspaceOperationFactory should decorate as well but WorkspaceOperationFactory is marked internal without an interface so maybe not. I can't say I care too much.

User interface changes

API changes

Data model changes

πŸ“Œ Task
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada Charlie ChX Negyesi 🍁Canada

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @Charlie ChX Negyesi
  • Merge request !1Some cleanup and D10 compatibility β†’ (Merged) created by Unnamed author
  • Status changed to Fixed about 1 month ago
  • πŸ‡ΊπŸ‡ΈUnited States djdevin Philadelphia

    Thanks!

  • Pipeline finished with Skipped
    about 1 month ago
    #344075
  • πŸ‡ΊπŸ‡ΈUnited States djdevin Philadelphia

    That approach seems to conflict with jsonapi_cross_bundles but I don't know why

    The website encountered an unexpected error. Try again later.
    Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException: Circular reference detected for service "workspaces_parallel.entity_repository", path: "redirect.request_subscriber -> redirect.checker -> access_manager -> paramconverter_manager -> paramconverter.jsonapi.entity_uuid -> workspaces_parallel.entity_repository -> jsonapi.exception_subscriber -> jsonapi.serializer -> serializer.normalizer.resource_identifier.jsonapi_extras -> Drupal\jsonapi\ResourceType\ResourceTypeRepositoryInterface -> jsonapi_cross_bundles.cross_bundle_resource_type_repository.inner". in Drupal\Component\DependencyInjection\Container->get() (line 149 of core/lib/Drupal/Component/DependencyInjection/Container.php).
    • d49052d1 committed on 1.0.x
      Revert "Issue #3473358: Some cleanup and D10 compatibility"
      
      This...
  • πŸ‡ΊπŸ‡ΈUnited States djdevin Philadelphia

    Spoke too soon, this prevents the entity repository from getting swapped out so the loaded revisions are wrong.

  • πŸ‡¨πŸ‡¦Canada Charlie ChX Negyesi 🍁Canada

    Sorry, I am not quite sure what you mean. The patch changes from extension to decorator yes but how does this break things...?

  • πŸ‡ΊπŸ‡ΈUnited States djdevin Philadelphia

    Basically just follow the steps in https://www.drupal.org/project/drupal/issues/3438083#comment-15866369 ✨ Ability to edit content in live workspace when it has been edited in other workspaces Active

    It looks like it should work, but it fails with this patch. I keep getting the latest revision instead of the latest non-workspace revision.

  • πŸ‡ΊπŸ‡ΈUnited States djdevin Philadelphia

    If you run this in devel/php it illustrates the problem (clean D10 site)

    $node = \Drupal::entityTypeManager()->getStorage('node')->create([
    'title' => 'Change in the live site',
    'type' => 'page',
    ]);
    $node->save();
    
    $stage_ws = \Drupal::entityTypeManager()->getStorage('workspace')->load('stage');
    
    $ws_manager = \Drupal::service('workspaces.manager');
    $ws_manager->setActiveWorkspace($stage_ws);
    
    $node->title = 'Change in stage site';
    $node->save();
    
    $ws_manager->switchToLive();
    
    $nE = \Drupal::entityTypeManager()->getStorage('node')->load($node->id());
    
    $nR = \Drupal::service('entity.repository')->getActive('node', $node->id());
    
    // These outputs should be the same because we are in the live workspace so we should only see the non-workspace change.
    echo $nE->label();
    echo "\n";
    echo $nR->label();
    
  • πŸ‡ΊπŸ‡ΈUnited States djdevin Philadelphia

    djdevin β†’ changed the visibility of the branch 3473358-some-cleanup-and to hidden.

  • πŸ‡ΊπŸ‡ΈUnited States djdevin Philadelphia

    Recreated MR with failing test.

Production build 0.71.5 2024