Commit f3bdabad authored by Ide Braakman's avatar Ide Braakman
Browse files

Issue #3296553 by Project Update Bot, kleiton_rodrigues, idebr: Automated...

Issue #3296553 by Project Update Bot, kleiton_rodrigues, idebr: Automated Drupal 10 compatibility fixes
parent d3391f2b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
name: AJAX Comments
type: module
description: Module makes comments load without a page refresh via AJAX
core_version_requirement: ^8 || ^9
core_version_requirement: ^9.1 || ^10
dependencies:
  - drupal:comment
configure: ajax_comments.settings
+3 −3
Original line number Diff line number Diff line
@@ -208,7 +208,7 @@ function ajax_comments_entity_view_alter(array &$build, ContentEntityInterface $
/**
 * Implements hook_form_FORM_ID_alter().
 */
function ajax_comments_form_comment_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
function ajax_comments_form_comment_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  /** @var \Drupal\ajax_comments\FieldSettingsHelper $field_settings_helper */
  $field_settings_helper = \Drupal::service('ajax_comments.field_settings_helper');
  /** @var \Drupal\Core\Routing\CurrentRouteMatch $current_route */
@@ -258,7 +258,7 @@ function ajax_comments_form_comment_form_alter(&$form, \Drupal\Core\Form\FormSta

  // Set unique id (need for Views with enabled AJAX).
  if (empty($form['actions']['submit']['#id'])) {
    $form['actions']['submit']['#id'] = \Drupal\Component\Utility\Html::getUniqueId('edit-' . $id);
    $form['actions']['submit']['#id'] = Html::getUniqueId('edit-' . $id);
  }

  $form['actions']['preview']['#ajax'] = [
@@ -269,7 +269,7 @@ function ajax_comments_form_comment_form_alter(&$form, \Drupal\Core\Form\FormSta
  ];
  // Set unique id (need for Views with enabled AJAX).
  if (empty($form['actions']['preview']['#id'])) {
    $form['actions']['preview']['#id'] = \Drupal\Component\Utility\Html::getUniqueId('preview-' . $id);
    $form['actions']['preview']['#id'] = Html::getUniqueId('preview-' . $id);
  }
}

+9 −12
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ class AjaxCommentsSettingsFormTest extends CommentTestBase {
  /**
   * {@inheritdoc}
   */
  protected function setUp() {
  protected function setUp(): void {
    parent::setUp();
    $admin_roles = $this->adminUser->getRoles();
    $admin_role = Role::load(reset($admin_roles));
@@ -47,22 +47,19 @@ class AjaxCommentsSettingsFormTest extends CommentTestBase {
    $this->drupalLogin($this->adminUser);
    $this->drupalGet('admin/config/content/ajax_comments');
    // Check that the page loads.
    $this->assertResponse(200);
    $this->assertText(
      t("Enable Ajax Comments on the comment fields' display settings"),
      'The list of bundles appears on the form.'
    );
    $this->assertSession()->statusCodeEquals(200);
    $this->assertSession()->pageTextContains(t("Enable Ajax Comments on the comment fields' display settings"));
    $this->clickLink(t('Content: Article'));
    $this->assertUrl('/admin/structure/types/manage/article/display', [], 'There is a link to the entity view display form for articles.');
    $this->assertResponse(200);
    $this->assertSession()->addressEquals('/admin/structure/types/manage/article/display', [], 'There is a link to the entity view display form for articles.');
    $this->assertSession()->statusCodeEquals(200);

    // Open comment settings.
    $this->drupalPostForm(NULL, [], 'comment_settings_edit');
    $this->submitForm([], 'comment_settings_edit');
    // Disable ajax comments.
    $this->drupalPostForm(NULL, ['fields[comment][settings_edit_form][third_party_settings][ajax_comments][enable_ajax_comments]' => '0'], 'comment_plugin_settings_update');
    $this->submitForm(['fields[comment][settings_edit_form][third_party_settings][ajax_comments][enable_ajax_comments]' => '0'], 'comment_plugin_settings_update');
    // Save display mode.
    $this->drupalPostForm(NULL, [], t('Save'));
    $this->assertResponse(200);
    $this->submitForm([], t('Save'));
    $this->assertSession()->statusCodeEquals(200);
  }

}
+1 −1
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ class AjaxCommentsFunctionalTest extends WebDriverTestBase {
  /**
   * {@inheritdoc}
   */
  protected function setUp() {
  protected function setUp(): void {
    parent::setUp();
    $this->entityTypeManager = $this->container->get('entity_type.manager');