Test code climate #1058

Closed
IGassmann wants to merge 48 commits from testCodeClimate into master
2 changed files with 23 additions and 64 deletions
Showing only changes of commit 1dbe51f9b0 - Show all commits

View file

@ -1,6 +1,6 @@
{
"name": "lbry-app",
"version": "0.24.0",
"version": "0.25.0",
"description": "A browser for the LBRY network, a digital marketplace controlled by its users.",
"homepage": "https://lbry.io/",
"bugs": {

View file

@ -10,12 +10,11 @@ import { doAuthNavigate } from 'redux/actions/navigation';
import { doFetchDaemonSettings } from 'redux/actions/settings';
import { doAuthenticate } from 'redux/actions/user';
import { doBalanceSubscribe } from 'redux/actions/wallet';
import { doPause } from "redux/actions/media";
import { doPause } from 'redux/actions/media';
import {
selectCurrentModal,
selectIsUpgradeSkipped,
selectRemoteVersion,
selectUpdateUrl,
selectUpgradeDownloadItem,
selectUpgradeDownloadPath,
@ -84,23 +83,19 @@ export function doDownloadUpgradeRequested() {
const autoUpdateDeclined = selectAutoUpdateDeclined(state);
if (['win32', 'darwin'].includes(process.platform)) { // electron-updater behavior
if (autoUpdateDeclined) {
// The user declined an update before, so show the "confirm" dialog
dispatch({
type: ACTIONS.OPEN_MODAL,
data: { modal: MODALS.AUTO_UPDATE_CONFIRM },
});
} else {
// The user was never shown the original update dialog (e.g. because they were
// watching a video). So show the inital "update downloaded" dialog.
dispatch({
type: ACTIONS.OPEN_MODAL,
data: { modal: MODALS.AUTO_UPDATE_DOWNLOADED },
});
}
} else { // Old behavior for Linux
dispatch(doDownloadUpgrade());
if (autoUpdateDeclined) {
// The user declined an update before, so show the "confirm" dialog
dispatch({
type: ACTIONS.OPEN_MODAL,
data: { modal: MODALS.AUTO_UPDATE_CONFIRM },
});
} else {
// The user was never shown the original update dialog (e.g. because they were
// watching a video). So show the inital "update downloaded" dialog.
dispatch({
type: ACTIONS.OPEN_MODAL,
data: { modal: MODALS.AUTO_UPDATE_DOWNLOADED },
});
}
};
}
@ -145,8 +140,7 @@ export function doDownloadUpgrade() {
}
export function doAutoUpdate() {
return function(dispatch, getState) {
const state = getState();
return function(dispatch) {
dispatch({
type: ACTIONS.AUTO_UPDATE_DOWNLOADED,
});
@ -159,12 +153,11 @@ export function doAutoUpdate() {
}
export function doAutoUpdateDeclined() {
return function(dispatch, getState) {
const state = getState();
return function(dispatch) {
dispatch({
type: ACTIONS.AUTO_UPDATE_DECLINED,
});
}
};
}
export function doCancelUpgrade() {
@ -197,47 +190,13 @@ export function doCheckUpgradeAvailable() {
type: ACTIONS.CHECK_UPGRADE_START,
});
if (["win32", "darwin"].includes(process.platform)) {
// On Windows and Mac, updates happen silently through
// electron-updater.
const autoUpdateDeclined = selectAutoUpdateDeclined(state);
// On Windows and Mac, updates happen silently through
// electron-updater.
const autoUpdateDeclined = selectAutoUpdateDeclined(state);
if (!autoUpdateDeclined) {
autoUpdater.checkForUpdates();
}
return;
if (!autoUpdateDeclined) {
autoUpdater.checkForUpdates();
}
const success = ({ remoteVersion, upgradeAvailable }) => {
dispatch({
type: ACTIONS.CHECK_UPGRADE_SUCCESS,
data: {
upgradeAvailable,
remoteVersion,
},
});
if (
upgradeAvailable &&
!selectCurrentModal(state) &&
(!selectIsUpgradeSkipped(state) || remoteVersion !== selectRemoteVersion(state))
) {
dispatch({
type: ACTIONS.OPEN_MODAL,
data: {
modal: MODALS.UPGRADE,
},
});
}
};
const fail = () => {
dispatch({
type: ACTIONS.CHECK_UPGRADE_FAIL,
});
};
Lbry.getAppVersionInfo().then(success, fail);
};
}