Remove changelog loading logic from upgrade component
This commit is contained in:
parent
deb9a7dab0
commit
dc12cbc6a0
1 changed files with 0 additions and 28 deletions
|
|
@ -18,8 +18,6 @@ class Upgrade extends Component
|
||||||
|
|
||||||
public string $currentVersion = '';
|
public string $currentVersion = '';
|
||||||
|
|
||||||
public array $changelogEntries = [];
|
|
||||||
|
|
||||||
protected $listeners = ['updateAvailable' => 'checkUpdate'];
|
protected $listeners = ['updateAvailable' => 'checkUpdate'];
|
||||||
|
|
||||||
public function mount()
|
public function mount()
|
||||||
|
|
@ -36,37 +34,11 @@ public function checkUpdate()
|
||||||
if (isDev()) {
|
if (isDev()) {
|
||||||
$this->isUpgradeAvailable = true;
|
$this->isUpgradeAvailable = true;
|
||||||
}
|
}
|
||||||
$this->loadChangelog();
|
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
return handleError($e, $this);
|
return handleError($e, $this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function loadChangelog()
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
$service = app(ChangelogService::class);
|
|
||||||
$currentVersion = str_replace('v', '', $this->currentVersion);
|
|
||||||
|
|
||||||
$this->changelogEntries = $service->getEntries(1)
|
|
||||||
->filter(function ($entry) use ($currentVersion) {
|
|
||||||
$entryVersion = str_replace('v', '', $entry->tag_name);
|
|
||||||
|
|
||||||
return version_compare($entryVersion, $currentVersion, '>');
|
|
||||||
})
|
|
||||||
->take(3)
|
|
||||||
->map(fn ($entry) => [
|
|
||||||
'tag_name' => $entry->tag_name,
|
|
||||||
'title' => $entry->title,
|
|
||||||
'content_html' => $entry->content_html,
|
|
||||||
])
|
|
||||||
->values()
|
|
||||||
->toArray();
|
|
||||||
} catch (\Throwable $e) {
|
|
||||||
$this->changelogEntries = [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function upgrade()
|
public function upgrade()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue