From 568e23a6b8b998fa68b556e0acf50084c8a14b49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Sun, 22 May 2022 16:10:05 +0200 Subject: [PATCH] Move releasenotes filter to backend (#590) * Move releasenotes filter to backend * Its always there --- src/components/dialogs/hacs-update-dialog.ts | 8 ++++---- src/data/websocket.ts | 7 ++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/components/dialogs/hacs-update-dialog.ts b/src/components/dialogs/hacs-update-dialog.ts index 772c51906..1b6ba925c 100644 --- a/src/components/dialogs/hacs-update-dialog.ts +++ b/src/components/dialogs/hacs-update-dialog.ts @@ -50,11 +50,11 @@ export class HacsUpdateDialog extends HacsDialogBase { if (!repository) { return; } - if (repository.version_or_commit !== "commit") { - this._releaseNotes = await repositoryReleasenotes(this.hass, repository.id); - this._releaseNotes = this._releaseNotes.filter( - (release) => release.tag > repository.installed_version + this._releaseNotes = await repositoryReleasenotes( + this.hass, + repository.id, + repository.installed_version ); } websocketSubscription(this.hass, (data) => (this._error = data), HacsDispatchEvent.ERROR); diff --git a/src/data/websocket.ts b/src/data/websocket.ts index 83845483e..aa4a534d8 100644 --- a/src/data/websocket.ts +++ b/src/data/websocket.ts @@ -68,13 +68,18 @@ export const repositoryIgnore = async (hass: HomeAssistant, repository: string) }); }; -export const repositoryReleasenotes = async (hass: HomeAssistant, repository: string) => { +export const repositoryReleasenotes = async ( + hass: HomeAssistant, + repository: string, + currentVersion: string +) => { const response = await hass.connection.sendMessagePromise< { name: string; body: string; tag: string }[] >({ type: "hacs/repository", action: "release_notes", repository: repository, + data: { current_version: currentVersion }, }); return response; };