Set domain source action

Created on 17 April 2019, over 6 years ago
Updated 20 March 2023, over 2 years ago

Please may we have an action (core action or VBO) to set the Source Domain? It would be helpful to be able to bulk update Source Domain on many nodes at once.

Feature request
Status

Needs review

Version

1.0

Component

- Domain Source

Created by

🇬🇧United Kingdom david.qdoscc

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇧🇪Belgium tim-diels Belgium 🇧🇪

    After testing, I'm not seeing the "Set" action for existing domains. These should be handled in the install function also and not only in the update function?

    Also a small PHPCS issue with a t() that should be a $this-t() and another small PHPCS issue.

    The tests are not that easy to add, so leaving that open and adding the issue tag.
    Setting this to NR for the changes, can be set back to NW afterwards for the tests.

  • 🇪🇸Spain guardiola86

    The patch is working for me. After running updates and clearing the cache, I can set the source origin. The only thing is that the domain must be already checked in Domain Access, which is correct.

  • Status changed to Needs work 7 days ago
  • 🇫🇷France mably

    Could we have a MR on 2.0.x please ?

  • 🇫🇷France mably

    Simple test added. Looks like we are ready for merge.

    /**
     * Tests the domain source actions.
     *
     * @group domain
     */
    class DomainSourceActionsTest extends DomainTestBase {
    
      /**
       * {@inheritdoc}
       */
      protected static $modules = [
        'domain',
        'domain_access',
        'domain_source',
        'field',
        'node',
        'user',
      ];
    
      /**
       * Tests bulk actions through the content overview page.
       */
      public function testDomainSourceActions() {
        $perms = [
          'access administration pages',
          'access content overview',
          'edit any article content',
        ];
        $admin_user = $this->drupalCreateUser($perms);
    
        // Create test domains.
        $this->domainCreateTestDomains(2);
    
        // Create a test node.
        $node = $this->drupalCreateNode([
          'type' => 'article',
          'title' => 'Test node',
        ]);
    
        $this->drupalLogin($admin_user);
    
        $this->drupalGet('admin/content');
    
        // Try setting source without domain assignment.
        $action_id = 'domain_source_set_action.example_com';
        $edit = [
          'node_bulk_form[0]' => TRUE,
          'action' => $action_id,
        ];
        $this->submitForm($edit, 'Apply to selected items');
    
        // Check that we have the right warning on page.
        $this->assertSession()->pageTextContains('Content 1 must be assigned to domain example_com');
    
        // Try bulk assigning the domain to our node.
        $action_id = 'domain_access_add_action_example_com';
        $edit = [
          'node_bulk_form[0]' => TRUE,
          'action' => $action_id,
        ];
        $this->submitForm($edit, 'Apply to selected items');
    
        // Retry setting the domain source after the domain assignment.
        $action_id = 'domain_source_set_action.example_com';
        $edit = [
          'node_bulk_form[0]' => TRUE,
          'action' => $action_id,
        ];
        $this->submitForm($edit, 'Apply to selected items');
    
        // Check that we do not have the previous warning on page.
        $this->assertSession()->pageTextNotContains('Content 1 must be assigned to domain example_com');
    
        // Check that the domain source have been properly set.
        $node_storage = \Drupal::entityTypeManager()->getStorage('node');
        $node = $node_storage->load(1);
        // Check that the value is set.
        $value = domain_source_get($node);
        $this->assertEquals('example_com', $value, 'Node saved with proper source record.');
    
      }
    
    }
    
    • mably committed 4a948dca on 2.0.x
      Issue #3048808 by vflirt, slbrassard, mably: Set domain source action
      
Production build 0.71.5 2024