Skip to content

Commit

Permalink
[Versioning] Show module warning for latest version if no other warni…
Browse files Browse the repository at this point in the history
…ngs set
  • Loading branch information
BitcoinMitchell committed Feb 17, 2024
1 parent 425dfb4 commit c143a6c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion modules/btcpay/btcpay.php
Original file line number Diff line number Diff line change
Expand Up @@ -515,11 +515,21 @@ private function displayModuleWarnings(): void
// Try and create the client
$client = Client::createFromConfiguration($this->configuration);

// Show warning if API key is missing or if the we are not yet fully synced
// Show warning if API key is missing or if we're not yet fully synced
if (null === $client || empty($this->configuration->get(Constants::CONFIGURATION_BTCPAY_API_KEY))) {
$this->warning = $this->trans('Your BTCPay Server store has not yet been linked, payment option is unavailable.', [], 'Modules.Btcpay.Admin');
} elseif (!$client->server()->getInfo()->isFullySynced()) {
$this->warning = $this->trans('One (or more) coins are not yet synced, payment option will be unavailable until the sync has finished.', [], 'Modules.Btcpay.Admin');
}

// API key/sync warnings are more important than a new version, if a warning is set, return now
if (!empty($this->warning)) {
return;
}

// Otherwise, add a warning on version upgrade
if (null !== ($latest = $this->versioning->latest()) && $latest->newer($this->version)) {
$this->warning = $this->trans(\sprintf('There is a new version available for this plugin: %s.', $latest->getTagName()), [], 'Modules.Btcpay.Admin');
}
}
}

0 comments on commit c143a6c

Please sign in to comment.