mirror of
https://github.com/zoriya/flood.git
synced 2026-06-07 20:30:42 +00:00
moveTorrents: Allow hash check to be skipped by user
Signed-off-by: Jesse Chan <jc@linux.com>
This commit is contained in:
@@ -135,7 +135,7 @@ const TorrentActions = {
|
|||||||
),
|
),
|
||||||
|
|
||||||
moveTorrents: (hashes, options) => {
|
moveTorrents: (hashes, options) => {
|
||||||
const {destination, isBasePath, filenames, sourcePaths, moveFiles} = options;
|
const {destination, isBasePath, filenames, sourcePaths, moveFiles, isCheckHash} = options;
|
||||||
|
|
||||||
return axios
|
return axios
|
||||||
.post(`${baseURI}api/client/torrents/move`, {
|
.post(`${baseURI}api/client/torrents/move`, {
|
||||||
@@ -145,6 +145,7 @@ const TorrentActions = {
|
|||||||
filenames,
|
filenames,
|
||||||
sourcePaths,
|
sourcePaths,
|
||||||
moveFiles,
|
moveFiles,
|
||||||
|
isCheckHash,
|
||||||
})
|
})
|
||||||
.then((json = {}) => json.data)
|
.then((json = {}) => json.data)
|
||||||
.then(
|
.then(
|
||||||
|
|||||||
@@ -31,6 +31,15 @@ class MoveTorrents extends React.Component {
|
|||||||
id: 'moveFiles',
|
id: 'moveFiles',
|
||||||
type: 'checkbox',
|
type: 'checkbox',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
checked: true,
|
||||||
|
content: this.props.intl.formatMessage({
|
||||||
|
id: 'torrents.move.check_hash.label',
|
||||||
|
defaultMessage: 'Check hash',
|
||||||
|
}),
|
||||||
|
id: 'isCheckHash',
|
||||||
|
type: 'checkbox',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
content: this.props.intl.formatMessage({
|
content: this.props.intl.formatMessage({
|
||||||
id: 'button.cancel',
|
id: 'button.cancel',
|
||||||
@@ -74,6 +83,7 @@ class MoveTorrents extends React.Component {
|
|||||||
filenames,
|
filenames,
|
||||||
moveFiles: formData.moveFiles,
|
moveFiles: formData.moveFiles,
|
||||||
sourcePaths,
|
sourcePaths,
|
||||||
|
isCheckHash: formData.isCheckHash,
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.setState({isSettingDownloadPath: false});
|
this.setState({isSettingDownloadPath: false});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -311,6 +311,7 @@ export default {
|
|||||||
'torrents.move.button.set.location': 'Set Location',
|
'torrents.move.button.set.location': 'Set Location',
|
||||||
'torrents.move.button.state.setting': 'Setting...',
|
'torrents.move.button.state.setting': 'Setting...',
|
||||||
'torrents.move.data.label': 'Move data',
|
'torrents.move.data.label': 'Move data',
|
||||||
|
'torrents.move.check_hash.label': 'Check hash',
|
||||||
'torrents.move.heading': 'Set Torrent Location',
|
'torrents.move.heading': 'Set Torrent Location',
|
||||||
|
|
||||||
'torrents.properties.date.added': 'Added',
|
'torrents.properties.date.added': 'Added',
|
||||||
|
|||||||
+13
-7
@@ -227,7 +227,7 @@ const client = {
|
|||||||
|
|
||||||
moveTorrents(user, services, data, callback) {
|
moveTorrents(user, services, data, callback) {
|
||||||
const destinationPath = data.destination;
|
const destinationPath = data.destination;
|
||||||
const {isBasePath, hashes, filenames, moveFiles, sourcePaths} = data;
|
const {isBasePath, hashes, filenames, moveFiles, sourcePaths, isCheckHash} = data;
|
||||||
const mainRequest = new ClientRequest(user, services);
|
const mainRequest = new ClientRequest(user, services);
|
||||||
|
|
||||||
const hashesToRestart = hashes.filter(
|
const hashesToRestart = hashes.filter(
|
||||||
@@ -247,12 +247,18 @@ const client = {
|
|||||||
afterCheckHash = callback;
|
afterCheckHash = callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
const checkHash = () => {
|
let checkHash;
|
||||||
const checkHashRequest = new ClientRequest(user, services);
|
|
||||||
checkHashRequest.checkHash({hashes});
|
if (isCheckHash) {
|
||||||
checkHashRequest.onComplete(afterCheckHash);
|
checkHash = () => {
|
||||||
checkHashRequest.send();
|
const checkHashRequest = new ClientRequest(user, services);
|
||||||
};
|
checkHashRequest.checkHash({hashes});
|
||||||
|
checkHashRequest.onComplete(afterCheckHash);
|
||||||
|
checkHashRequest.send();
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
checkHash = afterCheckHash;
|
||||||
|
}
|
||||||
|
|
||||||
const moveTorrents = () => {
|
const moveTorrents = () => {
|
||||||
const moveTorrentsRequest = new ClientRequest(user, services);
|
const moveTorrentsRequest = new ClientRequest(user, services);
|
||||||
|
|||||||
Reference in New Issue
Block a user