Skip to content

Commit

Permalink
Move releasenotes filter to backend (#590)
Browse files Browse the repository at this point in the history
* Move releasenotes filter to backend

* Its always there
  • Loading branch information
ludeeus authored May 22, 2022
1 parent e309d87 commit 568e23a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/components/dialogs/hacs-update-dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 6 additions & 1 deletion src/data/websocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down

0 comments on commit 568e23a

Please sign in to comment.