Updated database warning wording

refs https://github.com/TryGhost/Toolbox/issues/175

- both cases now show the same message so I've reverted back to
  returning a boolean indicating whether it should be shown
- also pulls out the check for Pro so the if-statements are easier to
  read
This commit is contained in:
Daniel Lockyer 2022-01-18 11:05:53 +00:00
parent 614dda8af6
commit 0f2faed20c
2 changed files with 12 additions and 7 deletions

View File

@ -13,19 +13,24 @@ export default class WhatsNewController extends Controller {
return date.getFullYear();
}
get databaseWarning() {
get showDatabaseWarning() {
const isProduction = !!this.config.get('environment').match?.(/production/i);
const isPro = !!this.config.get('hostSettings')?.siteId;
const database = this.config.get('database');
// Don't show any warnings for Pro
if (isPro) {
return false;
}
// Show a warning if we're in production and not using MySQL 8
if (isProduction && !isPro && database !== 'mysql8') {
return 'MySQL 8 will be the required database in the next major release of Ghost.';
if (isProduction && database !== 'mysql8') {
return true;
}
// Show a warning if we're in development and using MySQL 5
if (!isProduction && !isPro && database === 'mysql5') {
return 'MySQL 5 will no longer be supported in the next major release of Ghost.';
if (!isProduction && database === 'mysql5') {
return true;
}
return false;

View File

@ -59,10 +59,10 @@
{{/if}}
</ul>
{{#if this.databaseWarning}}
{{#if this.showDatabaseWarning}}
<section class="gh-upgrade-notification">
<p>
<strong>Warning:</strong> {{this.databaseWarning}} Make sure your database is up to date to ensure forwards compatibility.
<strong>Warning:</strong> MySQL 8 will be the required database in the next major release of Ghost. Make sure your database is up to date to ensure forwards compatibility.
</p>
</section>
{{/if}}