Skip to content

Commit

Permalink
UHF-8706: the is enabled check was wrong way
Browse files Browse the repository at this point in the history
  • Loading branch information
rpnykanen committed Sep 11, 2024
1 parent b635b4f commit 4f329c9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 4 additions & 4 deletions public/modules/custom/helfi_google_api/src/GoogleApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function __construct(
}

/**
* Correct environment and key is set.
* Correct environment and key is set and enabled is true.
*
* @return bool
* The api is set up
Expand All @@ -59,7 +59,7 @@ public function isDryRun(): bool {
$key = $config->get('indexing_api_key') ?: '';
$isEnabled = $config->get('enabled') ?: FALSE;

return $key && $isEnabled;
return !$key && !$isEnabled;
}

/**
Expand All @@ -74,8 +74,8 @@ public function isDryRun(): bool {
* Object which holds the handled urls and request errors.
*/
public function indexBatch(array $urls, bool $update): Response {
if (!$this->isDryRun()) {
return new Response($urls, debug: TRUE);
if ($this->isDryRun()) {
return new Response($urls, dryRun: TRUE);
}

$batch = $this->indexingService->createBatch();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,11 @@ public function checkEntityIndexStatus(JobListing $entity): string {
* Has temporary redirect.
*/
public function hasTemporaryRedirect(JobListing $entity, string $langcode): bool {
// In case of dry run, we can always say FALSE.
if ($this->googleApi->isDryRun()) {
return FALSE;
}

$job_alias = $this->getEntityAlias($entity, $langcode);

$query = $this->entityTypeManager->getStorage('redirect')
Expand Down

0 comments on commit 4f329c9

Please sign in to comment.