Skip to content

Commit

Permalink
Fix an error when triggering an integration where the tokenId has b…
Browse files Browse the repository at this point in the history
…ecome invalid
  • Loading branch information
engram-design committed May 3, 2024
1 parent 3c54882 commit ad2acfc
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/jobs/TriggerIntegration.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use verbb\formie\models\IntegrationResponse;

use Craft;
use craft\db\Query;
use craft\helpers\Json;

class TriggerIntegration extends BaseJob
Expand Down Expand Up @@ -42,6 +43,13 @@ public function execute($queue)
// Set with a private variable, so it doesn't appear in the queue job data which would be mayhem.
$this->integration->setQueueJob($this);

// Re-fetch the token in case it's been changed (as we store a reference to the entire integration in the job)
$this->integration->tokenId = (new Query())
->select('tokenId')
->from(['{{%formie_integrations}}'])
->where(['uid' => $this->integration->uid])
->scalar();

// Ensure we set the correct language for a potential CLI request
Craft::$app->language = $submission->getSite()->language;
Craft::$app->set('locale', Craft::$app->getI18n()->getLocaleById($submission->getSite()->language));
Expand Down

0 comments on commit ad2acfc

Please sign in to comment.