Skip to content
Snippets Groups Projects
Commit 87bc567b authored by catch's avatar catch
Browse files

Issue #3396741 by recrit, smustgrave: Content Moderation...

Issue #3396741 by recrit, smustgrave: Content Moderation moderation_state_filter cannot join the entity revision table when the filter uses relationship to the entity revision table

(cherry picked from commit f742d155)
parent 0069d077
No related branches found
No related tags found
26 merge requests!11185Issue #3477324 by andypost, alexpott: Fix usage of str_getcsv() and fgetcsv() for PHP 8.4,!10602Issue #3438769 by vinmayiswamy, antonnavi, michelle, amateescu: Sub workspace does not clear,!10301Issue #3469309 by mstrelan, smustgrave, moshe weitzman: Use one-time login...,!10187Issue #3487488 by dakwamine: ExtensionMimeTypeGuesser::guessMimeType must support file names with "0" (zero) like foo.0.zip,!9944Issue #3483353: Consider making the createCopy config action optionally fail...,!9929Issue #3445469 by pooja_sharma, smustgrave: Add additional test coverage for...,!9787Resolve issue 3479427 - bootstrap barrio issue under Windows,!9742Issue #3463908 by catch, quietone: Split OptionsFieldUiTest into two,!9526Issue #3458177 by mondrake, catch, quietone, godotislate, longwave, larowlan,...,!8738Issue #3424162 by camilledavis, dineshkumarbollu, smustgrave: Claro...,!8704Make greek characters available in ckeditor5,!8597Draft: Issue #3442259 by catch, quietone, dww: Reduce time of Migrate Upgrade tests...,!8533Issue #3446962 by kim.pepper: Remove incorrectly added...,!8517Issue #3443748 by NexusNovaz, smustgrave: Testcase creates false positive,!8325Update file Sort.php,!8095Expose document root on install,!7930Resolve #3427374 "Taxonomytid viewsargumentdefault plugin",!7627Issue #3439440 by nicxvan, Binoli Lalani, longwave: Remove country support from DateFormatter,!7445Issue #3440169: When using drupalGet(), provide an associative array for $headers,!7401#3271894 Fix documented StreamWrapperInterface return types for realpath() and dirname(),!7384Add constraints to system.advisories,!7078Issue #3320569 by Spokje, mondrake, smustgrave, longwave, quietone, Lendude,...,!6622Issue #2559833 by piggito, mohit_aghera, larowlan, guptahemant, vakulrai,...,!6502Draft: Resolve #2938524 "Plach testing issue",!38582585169-10.1.x,!3226Issue #2987537: Custom menu link entity type should not declare "bundle" entity key
Pipeline #104012 passed with warnings
Pipeline: drupal

#104050

    Pipeline: drupal

    #104037

      Pipeline: drupal

      #104028

        +1
        ...@@ -144,16 +144,17 @@ protected function opSimple() { ...@@ -144,16 +144,17 @@ protected function opSimple() {
        $entity_base_table = $entity_type->getBaseTable(); $entity_base_table = $entity_type->getBaseTable();
        $entity_revision_base_table = $entity_type->isTranslatable() ? $entity_type->getRevisionDataTable() : $entity_type->getRevisionTable(); $entity_revision_base_table = $entity_type->isTranslatable() ? $entity_type->getRevisionDataTable() : $entity_type->getRevisionTable();
        if ($this->table === $entity_revision_base_table) { if ($this->table === $entity_revision_base_table) {
        $entity_revision_base_table_alias = $this->relationship ?: $this->table;
        $configuration = [ $configuration = [
        'table' => $entity_base_table, 'table' => $entity_base_table,
        'field' => $entity_type->getKey('id'), 'field' => $entity_type->getKey('id'),
        'left_table' => $entity_revision_base_table, 'left_table' => $entity_revision_base_table_alias,
        'left_field' => $entity_type->getKey('id'), 'left_field' => $entity_type->getKey('id'),
        'type' => 'INNER', 'type' => 'INNER',
        ]; ];
        $join = Views::pluginManager('join')->createInstance('standard', $configuration); $join = Views::pluginManager('join')->createInstance('standard', $configuration);
        $entity_base_table_alias = $this->query->addRelationship($entity_base_table, $join, $entity_revision_base_table); $entity_base_table_alias = $this->query->addRelationship($entity_base_table, $join, $entity_revision_base_table_alias);
        } }
        $bundle_condition = $this->view->query->getConnection()->condition('AND'); $bundle_condition = $this->view->query->getConnection()->condition('AND');
        ......
        langcode: en
        status: true
        dependencies:
        module:
        - content_moderation
        - user
        id: test_content_moderation_filter_via_revision_relationship
        label: test_content_moderation_filter_via_revision_relationship
        module: views
        description: ''
        tag: ''
        base_table: users_field_data
        base_field: uid
        display:
        default:
        id: default
        display_title: Default
        display_plugin: default
        position: 0
        display_options:
        title: test_content_moderation_filter_via_revision_relationship
        fields:
        name:
        id: name
        table: users_field_data
        field: name
        relationship: none
        group_type: group
        admin_label: ''
        entity_type: user
        entity_field: name
        plugin_id: field
        label: ''
        exclude: false
        alter:
        alter_text: false
        text: ''
        make_link: false
        path: ''
        absolute: false
        external: false
        replace_spaces: false
        path_case: none
        trim_whitespace: false
        alt: ''
        rel: ''
        link_class: ''
        prefix: ''
        suffix: ''
        target: ''
        nl2br: false
        max_length: 0
        word_boundary: false
        ellipsis: false
        more_link: false
        more_link_text: ''
        more_link_path: ''
        strip_tags: false
        trim: false
        preserve_tags: ''
        html: false
        element_type: ''
        element_class: ''
        element_label_type: ''
        element_label_class: ''
        element_label_colon: false
        element_wrapper_type: ''
        element_wrapper_class: ''
        element_default_classes: true
        empty: ''
        hide_empty: false
        empty_zero: false
        hide_alter_empty: true
        click_sort_column: value
        type: user_name
        settings:
        link_to_entity: false
        group_column: value
        group_columns: { }
        group_rows: true
        delta_limit: 0
        delta_offset: 0
        delta_reversed: false
        delta_first_last: false
        multi_type: separator
        separator: ', '
        field_api_classes: false
        title:
        id: title
        table: node_field_revision
        field: title
        relationship: uid_revision_test
        group_type: group
        admin_label: ''
        entity_type: node
        entity_field: title
        plugin_id: field
        label: ''
        exclude: false
        alter:
        alter_text: false
        text: ''
        make_link: false
        path: ''
        absolute: false
        external: false
        replace_spaces: false
        path_case: none
        trim_whitespace: false
        alt: ''
        rel: ''
        link_class: ''
        prefix: ''
        suffix: ''
        target: ''
        nl2br: false
        max_length: 0
        word_boundary: true
        ellipsis: true
        more_link: false
        more_link_text: ''
        more_link_path: ''
        strip_tags: false
        trim: false
        preserve_tags: ''
        html: false
        element_type: ''
        element_class: ''
        element_label_type: ''
        element_label_class: ''
        element_label_colon: false
        element_wrapper_type: ''
        element_wrapper_class: ''
        element_default_classes: true
        empty: ''
        hide_empty: false
        empty_zero: false
        hide_alter_empty: true
        click_sort_column: value
        type: string
        settings:
        link_to_entity: false
        group_column: value
        group_columns: { }
        group_rows: true
        delta_limit: 0
        delta_offset: 0
        delta_reversed: false
        delta_first_last: false
        multi_type: separator
        separator: ', '
        field_api_classes: false
        moderation_state:
        id: moderation_state
        table: node_field_revision
        field: moderation_state
        relationship: uid_revision_test
        group_type: group
        admin_label: ''
        entity_type: node
        plugin_id: moderation_state_field
        label: ''
        exclude: false
        alter:
        alter_text: false
        text: ''
        make_link: false
        path: ''
        absolute: false
        external: false
        replace_spaces: false
        path_case: none
        trim_whitespace: false
        alt: ''
        rel: ''
        link_class: ''
        prefix: ''
        suffix: ''
        target: ''
        nl2br: false
        max_length: 0
        word_boundary: true
        ellipsis: true
        more_link: false
        more_link_text: ''
        more_link_path: ''
        strip_tags: false
        trim: false
        preserve_tags: ''
        html: false
        element_type: ''
        element_class: ''
        element_label_type: ''
        element_label_class: ''
        element_label_colon: false
        element_wrapper_type: ''
        element_wrapper_class: ''
        element_default_classes: true
        empty: ''
        hide_empty: false
        empty_zero: false
        hide_alter_empty: true
        click_sort_column: value
        type: content_moderation_state
        settings: { }
        group_column: value
        group_columns: { }
        group_rows: true
        delta_limit: 0
        delta_offset: 0
        delta_reversed: false
        delta_first_last: false
        multi_type: separator
        separator: ', '
        field_api_classes: false
        pager:
        type: none
        options:
        offset: 0
        exposed_form:
        type: basic
        options:
        submit_button: Apply
        reset_button: false
        reset_button_label: Reset
        exposed_sorts_label: 'Sort by'
        expose_sort_order: true
        sort_asc_label: Asc
        sort_desc_label: Desc
        access:
        type: perm
        options:
        perm: 'access user profiles'
        cache:
        type: tag
        options: { }
        empty: { }
        sorts:
        vid:
        id: vid
        table: node_field_revision
        field: vid
        relationship: uid_revision_test
        group_type: group
        admin_label: ''
        entity_type: node
        entity_field: vid
        plugin_id: standard
        order: ASC
        expose:
        label: ''
        field_identifier: ''
        exposed: false
        arguments: { }
        filters:
        moderation_state:
        id: moderation_state
        table: node_field_revision
        field: moderation_state
        relationship: uid_revision_test
        group_type: group
        admin_label: ''
        entity_type: node
        plugin_id: moderation_state_filter
        operator: in
        value: { }
        group: 1
        exposed: true
        expose:
        operator_id: moderation_state_op
        label: 'Moderation state'
        description: ''
        use_operator: false
        operator: moderation_state_op
        operator_limit_selection: false
        operator_list: { }
        identifier: moderation_state
        required: false
        remember: false
        multiple: false
        remember_roles:
        authenticated: authenticated
        anonymous: '0'
        administrator: '0'
        reduce: false
        is_grouped: false
        group_info:
        label: ''
        description: ''
        identifier: ''
        optional: true
        widget: select
        multiple: false
        remember: false
        default_group: All
        default_group_multiple: { }
        group_items: { }
        style:
        type: default
        row:
        type: fields
        query:
        type: views_query
        options:
        query_comment: ''
        disable_sql_rewrite: false
        distinct: false
        replica: false
        query_tags: { }
        relationships:
        uid_revision_test:
        id: uid_revision_test
        table: users_field_data
        field: uid_revision_test
        relationship: none
        group_type: group
        admin_label: 'node revisions'
        entity_type: user
        plugin_id: standard
        required: true
        header: { }
        footer: { }
        display_extenders: { }
        cache_metadata:
        max-age: -1
        contexts:
        - 'languages:language_content'
        - 'languages:language_interface'
        - url
        - url.query_args
        - user.permissions
        tags:
        - 'config:workflow_list'
        page_1:
        id: page_1
        display_title: Page
        display_plugin: page
        position: 1
        display_options:
        display_extenders: { }
        path: test-content-moderation-filter-revision-relationship
        cache_metadata:
        max-age: -1
        contexts:
        - 'languages:language_content'
        - 'languages:language_interface'
        - url
        - url.query_args
        - user.permissions
        tags:
        - 'config:workflow_list'
        ...@@ -20,3 +20,26 @@ function content_moderation_test_views_views_query_alter(ViewExecutable $view, Q ...@@ -20,3 +20,26 @@ function content_moderation_test_views_views_query_alter(ViewExecutable $view, Q
        $query->addOrderBy('node_field_revision', 'vid', 'ASC'); $query->addOrderBy('node_field_revision', 'vid', 'ASC');
        } }
        } }
        /**
        * Implements hook_views_data_alter().
        *
        * @see \Drupal\Tests\content_moderation\Kernel\ViewsModerationStateFilterTest
        */
        function content_moderation_test_views_views_data_alter(array &$data) {
        if (isset($data['users_field_data'])) {
        $data['users_field_data']['uid_revision_test'] = [
        'help' => t('Relate the content revision to the user who created it.'),
        'real field' => 'uid',
        'relationship' => [
        'title' => t('Content revision authored'),
        'help' => t('Relate the content revision to the user who created it. This relationship will create one record for each content revision item created by the user.'),
        'id' => 'standard',
        'base' => 'node_field_revision',
        'base field' => 'uid',
        'field' => 'uid',
        'label' => t('node revisions'),
        ],
        ];
        }
        }
        ...@@ -240,6 +240,34 @@ public function testModerationStateFilterOnJoinedEntity() { ...@@ -240,6 +240,34 @@ public function testModerationStateFilterOnJoinedEntity() {
        ]); ]);
        $view->execute(); $view->execute();
        $this->assertIdenticalResultset($view, [], ['name' => 'name']); $this->assertIdenticalResultset($view, [], ['name' => 'name']);
        // Revision Data Table Relationship: Filtering by the published state will
        // filter out the sample content.
        $view = Views::getView('test_content_moderation_filter_via_revision_relationship');
        $view->setExposedInput([
        'moderation_state' => 'editorial-published',
        ]);
        $view->execute();
        $this->assertIdenticalResultset($view, [
        [
        'name' => 'Test user',
        'title' => 'Test node',
        'moderation_state' => 'published',
        ],
        ], [
        'name' => 'name',
        'title' => 'title',
        'moderation_state' => 'moderation_state',
        ]);
        // Revision Data Table Relationship: Filtering by the draft state will
        // filter out the sample content.
        $view = Views::getView('test_content_moderation_filter_via_revision_relationship');
        $view->setExposedInput([
        'moderation_state' => 'editorial-draft',
        ]);
        $view->execute();
        $this->assertIdenticalResultset($view, [], ['name' => 'name']);
        } }
        /** /**
        ......
        0% Loading or .
        You are about to add 0 people to the discussion. Proceed with caution.
        Finish editing this message first!
        Please register or to comment