Skip to content

Commit

Permalink
Fix linting errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
kepol committed Nov 1, 2023
1 parent cccba88 commit ff43572
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
10 changes: 4 additions & 6 deletions quant.module
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,8 @@ function quant_modules_installed($modules) {
if (!$disabled) {
$config->set('disable_content_drafts', 1);
$config->save();
$message = 'Quant draft content handling has been disabled because the Workbench Moderation module has been installed.';
\Drupal::messenger()->addMessage(t($message));
\Drupal::logger('quant')->notice($message);
\Drupal::messenger()->addMessage(t('Quant draft content handling has been disabled because the Workbench Moderation module has been installed.'));
\Drupal::logger('quant')->notice('Quant draft content handling has been disabled because the Workbench Moderation module has been installed.');
}
}
}
Expand All @@ -383,9 +382,8 @@ function quant_modules_uninstalled($modules) {
$disabled = $config->get('disable_content_drafts');
// Only show message if disabled.
if ($disabled) {
$message = 'Quant draft content handling can be enabled now that the Workbench Moderation module has been uninstalled.';
\Drupal::messenger()->addMessage(t($message));
\Drupal::logger('quant')->notice($message);
\Drupal::messenger()->addMessage(t('Quant draft content handling can be enabled now that the Workbench Moderation module has been uninstalled.'));
\Drupal::logger('quant')->notice('Quant draft content handling can be enabled now that the Workbench Moderation module has been uninstalled.');
}
}
}
8 changes: 4 additions & 4 deletions src/Seed.php
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,8 @@ public static function headRoute($route, array $headers = []) {

$headers['Host'] = $hostname;

// Generate a signed token and use it in the request.
// This only applies when drafts are enabled, as we return neutral access otherwise.
// Generate a signed token and use it in the request. This only applies when
// drafts are enabled, as we return neutral access otherwise.
$disable_drafts = $config->get('disable_content_drafts');
if (!$disable_drafts) {
$headers['quant-token'] = \Drupal::service('quant.token_manager')->create($route);
Expand Down Expand Up @@ -494,8 +494,8 @@ public static function markupFromRoute($route, array $headers = []) {

$headers['Host'] = $hostname;

// Generate a signed token and use it in the request.
// This only applies when drafts are enabled, as we return neutral access otherwise.
// Generate a signed token and use it in the request. This only applies when
// drafts are enabled, as we return neutral access otherwise.
$disable_drafts = $config->get('disable_content_drafts');
if (!$disable_drafts) {
$headers['quant-token'] = \Drupal::service('quant.token_manager')->create($route);
Expand Down
6 changes: 3 additions & 3 deletions src/TokenManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ public function validate($route = NULL, $strict = TRUE) {
}

if ($this->quantSettings->get('disable_content_drafts')) {
// When content drafts are disabled the token is irrelevant.
// It may not even be included in the internal HTTP request.
// Bypass validation altogether, as the token is only required for draft access.
// When content drafts are disabled the token is irrelevant. It may not
// even be included in the internal HTTP request. Bypass validation
// altogether, as the token is only required for draft access.
throw new TokenValidationDisabledException();
}

Expand Down

0 comments on commit ff43572

Please sign in to comment.