Commit 34384b8c authored by Gaurav Kapoor's avatar Gaurav Kapoor
Browse files

Issue #2289295: Add automated tests to the Disqus module.

parent b04a221b
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
# Schema for the configuration files of the disqus module.

disqus.settings:
  type: mapping
  type: config_object
  label: 'Disqus Settings'
  mapping:
    disqus_domain:
@@ -9,7 +9,7 @@ disqus.settings:
      label: 'Shortname'
    behavior:
      type: mapping
      label: "Behavior"
      label: 'Behavior'
      mapping:
        disqus_localization:
          type: boolean
@@ -59,3 +59,14 @@ disqus.settings:
            disqus_logo:
              type: uri
              label: 'Custom Logo'

field.value.disqus_comment:
  type: mapping
  label: 'Disqus field values'
  mapping:
    status:
      type: boolean
      label: 'Disqus comments should be shown'
    identifier:
      type: string
      label: 'Identifier of the Disqus discussion'
+1 −0
Original line number Diff line number Diff line
@@ -4,4 +4,5 @@ description: 'Integrated the Disqus web service to enhance comments in Drupal.'
core_version_requirement: ^8.8 || ^9
configure: disqus.settings
dependencies:
  - drupal:file
  - drupal:field
+14 −2
Original line number Diff line number Diff line
@@ -110,9 +110,21 @@ class DisqusCommentManager implements DisqusCommentManagerInterface {
    $disqus['sso'] = [
      'name' => $this->configFactory->get('system.site')->get('name'),
      // The login window must be closed once the user logs in.
      'url' => Url::fromRoute('user.login', [], ['query' => ['destination' => Url::fromRoute('disqus.close_window')->toString()], 'absolute' => TRUE])->toString(),
      'url' => Url::fromRoute('user.login', [], [
        'query' => [
          'destination' => Url::fromRoute('disqus.close_window')->toString(),
        ],
        'absolute' => TRUE,
      ]
      )->toString(),
      // The logout link must redirect back to the original page.
      'logout' => Url::fromRoute('user.logout', [], ['query' => ['destination' => Url::fromRoute('<current>')->toString()], 'absolute' => TRUE])->toString(),
      'logout' => Url::fromRoute('user.logout', [], [
        'query' => [
          'destination' => Url::fromRoute('<current>')->toString(),
        ],
        'absolute' => TRUE,
      ]
      )->toString(),
      'width' => 800,
      'height' => 600,
    ];
+4 −2
Original line number Diff line number Diff line
@@ -97,7 +97,6 @@ class DisqusSettingsForm extends ConfigFormBase {

    $form['settings'] = [
      '#type' => 'vertical_tabs',
      '#attached' => ['library' => ['disqus/disqus.settings']],
      '#weight' => 50,
    ];

@@ -300,7 +299,10 @@ class DisqusSettingsForm extends ConfigFormBase {
    }

    $old_logo = $config->get('advanced.sso.disqus_logo');
    $new_logo = (!$form_state->isValueEmpty('disqus_logo')) ? $form_state->getValue(['disqus_logo', 0]) : '';
    $new_logo = (!$form_state->isValueEmpty('disqus_logo')) ? $form_state->getValue([
      'disqus_logo',
      0,
    ]) : '';

    // Ignore if the file hasn't changed.
    if ($new_logo != $old_logo) {
+4 −1
Original line number Diff line number Diff line
@@ -166,7 +166,10 @@ class DisqusComment extends DestinationBase implements ContainerFactoryPluginInt
        return $ids;
      }
      catch (\Exception $exception) {
        $this->logger->error('Error creating post on thread @thread, error: @error', ['@thread' => $thread->id, '@error' => $exception->getMessage()]);
        $this->logger->error('Error creating post on thread @thread, error: @error', [
          '@thread' => $thread->id,
          '@error' => $exception->getMessage(),
        ]);
      }
      return FALSE;
    }
Loading