diff --git a/resources/js/components/updater/Release.vue b/resources/js/components/updater/Release.vue index bba29d758f..51faafa58d 100644 --- a/resources/js/components/updater/Release.vue +++ b/resources/js/components/updater/Release.vue @@ -19,7 +19,7 @@
-
+
NEW') + .replaceAll('[fix]', 'FIX') + .replaceAll('[break]', 'BREAK') + .replaceAll('[na]', 'N/A') } }, diff --git a/resources/js/components/updater/Updater.vue b/resources/js/components/updater/Updater.vue index e88a56209d..e237e0fb6a 100644 --- a/resources/js/components/updater/Updater.vue +++ b/resources/js/components/updater/Updater.vue @@ -132,19 +132,16 @@ }, latestVersion() { - return this.latestRelease.version; + return this.latestRelease && this.latestRelease.version; }, canUpdateToLatestVersion() { - return this.latestVersion.canUpdate && this.showActions && ! this.onLatestVersion; + return this.latestVersion && this.latestVersion.canUpdate && this.showActions && ! this.onLatestVersion; } }, - mounted() { - this.getChangelog(); - }, - created() { + this.getChangelog(); this.$events.$on('composer-finished', this.composerFinished); }, diff --git a/src/Updater/Changelog.php b/src/Updater/Changelog.php index 6868966c9c..0a8556c271 100644 --- a/src/Updater/Changelog.php +++ b/src/Updater/Changelog.php @@ -4,7 +4,6 @@ use Carbon\Carbon; use Facades\Statamic\Marketplace\Marketplace; -use Statamic\Updater\Presenters\GithubReleasePresenter; abstract class Changelog { @@ -29,14 +28,18 @@ abstract public function item(); */ public function get() { - return Marketplace::releases($this->item())->map(function ($release, $index) { + $type = null; + + return Marketplace::releases($this->item())->map(function ($release, $index) use (&$type) { + $type = $type === 'downgrade' ? $type : $this->parseReleaseType($release['version'], $index); + return (object) [ 'version' => $release['version'], - 'type' => $this->parseReleaseType($release['version'], $index), + 'type' => $type, 'latest' => $index === 0, 'licensed' => $this->isLicensed($release['version']), 'date' => Carbon::parse($release['date'])->format(config('statamic.cp.date_format')), - 'body' => (string) new GithubReleasePresenter($release['changelog']), + 'body' => $release['changelog'], ]; }); } diff --git a/src/Updater/Presenters/GithubReleasePresenter.php b/src/Updater/Presenters/GithubReleasePresenter.php index 4229e0b79a..c9b8f24b50 100644 --- a/src/Updater/Presenters/GithubReleasePresenter.php +++ b/src/Updater/Presenters/GithubReleasePresenter.php @@ -5,6 +5,7 @@ use Statamic\Support\Html; use Statamic\Support\Str; +/** @deprecated */ class GithubReleasePresenter { /** diff --git a/tests/Composer/ChangelogTests.php b/tests/Composer/ChangelogTests.php index 9b085a7e7a..a5f2dcdc89 100644 --- a/tests/Composer/ChangelogTests.php +++ b/tests/Composer/ChangelogTests.php @@ -46,7 +46,7 @@ public function it_can_get_changelog_contents() collect($contents)->each(function ($release) { $this->assertEquals('2018: November 6th', $release->date); - $this->assertContainsHtml($release->body); + $this->assertIsString($release->body); }); }