Commit 315c9087 authored by catch's avatar catch
Browse files

Issue #3486797 by alecsmrekar, shalini_jha, smustgrave, amateescu: Updating...

Issue #3486797 by alecsmrekar, shalini_jha, smustgrave, amateescu: Updating path alias language in workspace does not work

(cherry picked from commit 3465f9c1)
parent dd702482
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@ protected function getBaseQuery() {
    $wa_join = $query->leftJoin('workspace_association', NULL, "[%alias].[target_entity_type_id] = 'path_alias' AND [%alias].[target_entity_id] = [original_base_table].[id] AND [%alias].[workspace] = :active_workspace_id", [
      ':active_workspace_id' => $active_workspace->id(),
    ]);
    $query->innerJoin('path_alias_revision', 'base_table', "[%alias].[revision_id] = COALESCE([$wa_join].[target_entity_revision_id], [original_base_table].[revision_id]) AND [%alias].[langcode] = [original_base_table].[langcode]");
    $query->innerJoin('path_alias_revision', 'base_table', "[%alias].[revision_id] = COALESCE([$wa_join].[target_entity_revision_id], [original_base_table].[revision_id])");
    $query->condition('base_table.status', 1);

    return $query;
+18 −0
Original line number Diff line number Diff line
@@ -198,6 +198,9 @@ public function testPathAliasesWithTranslation(): void {

    $this->assertAccessiblePaths([$default_path, $translation_path]);

    // Verify the default alias is available in the live workspace.
    $this->assertAccessiblePaths([$default_path]);

    $this->switchToWorkspace($stage);

    $this->assertAccessiblePaths([$default_path, $translation_path]);
@@ -311,6 +314,21 @@ public function testPathAliasesWithTranslation(): void {
    $stage->publish();
    $this->assertAccessiblePaths([$default_path, $new_stage_translation_path]);
    $this->assertNotAccessiblePaths([$stage_translation_path]);

    // Switch back to Stage.
    $this->switchToWorkspace($stage);

    // Edit the path alias to set its language to "Not specified".
    $alias_edit_path = "admin/config/search/path/edit/{$default_node->id()}";
    $this->drupalGet($alias_edit_path);
    // Set the alias language to "Not specified".
    $edit = [
      'langcode[0][value]' => 'und',
    ];
    $this->submitForm($edit, 'Save');

    // Verify the path alias is still available in the Stage workspace.
    $this->assertAccessiblePaths([$default_path]);
  }

  /**