From 8a7d89c8579689e5b6dab0dba8f5d5394eafb371 Mon Sep 17 00:00:00 2001 From: Franco Montenegro Date: Tue, 28 Jun 2022 11:35:53 -0300 Subject: [PATCH] Use release/tags endpoint to get the release details. --- ui/component/lastReleaseChanges/index.js | 10 +++++++++- ui/component/lastReleaseChanges/view.jsx | 7 ++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ui/component/lastReleaseChanges/index.js b/ui/component/lastReleaseChanges/index.js index 2784fe4d6..709215966 100644 --- a/ui/component/lastReleaseChanges/index.js +++ b/ui/component/lastReleaseChanges/index.js @@ -1,3 +1,11 @@ +import { connect } from 'react-redux'; +import { selectRemoteVersion } from 'redux/selectors/app'; import LastReleaseChanges from './view'; -export default LastReleaseChanges; +const select = (state) => ({ + releaseVersion: selectRemoteVersion(state), +}); + +const perform = {}; + +export default connect(select, perform)(LastReleaseChanges); diff --git a/ui/component/lastReleaseChanges/view.jsx b/ui/component/lastReleaseChanges/view.jsx index a41d2c778..a4577b6b8 100644 --- a/ui/component/lastReleaseChanges/view.jsx +++ b/ui/component/lastReleaseChanges/view.jsx @@ -5,11 +5,12 @@ import Button from 'component/button'; import I18nMessage from 'component/i18nMessage'; type Props = { + releaseVersion: string, hideReleaseVersion?: boolean, }; const LastReleaseChanges = (props: Props) => { - const { hideReleaseVersion } = props; + const { hideReleaseVersion, releaseVersion } = props; const [releaseTag, setReleaseTag] = useState(''); const [releaseChanges, setReleaseChanges] = useState(''); const [fetchingReleaseChanges, setFetchingReleaseChanges] = useState(false); @@ -35,7 +36,7 @@ const LastReleaseChanges = (props: Props) => { ); useEffect(() => { - const lastReleaseUrl = 'https://api.github.com/repos/lbryio/lbry-desktop/releases/latest'; + const lastReleaseUrl = `https://api.github.com/repos/lbryio/lbry-desktop/releases/tags/${releaseVersion}`; const options = { method: 'GET', headers: { Accept: 'application/vnd.github.v3+json' }, @@ -54,7 +55,7 @@ const LastReleaseChanges = (props: Props) => { setFetchingReleaseChanges(false); setFetchReleaseFailed(true); }); - }, []); + }, [releaseVersion, setFetchingReleaseChanges, setReleaseTag, setReleaseChanges, setFetchReleaseFailed]); if (fetchingReleaseChanges) { return

{__('Loading...')}

;