diff --git a/client/scripts/components/Modals/AddTorrentsModal/AddTorrentsByFile.js b/client/scripts/components/Modals/AddTorrentsModal/AddTorrentsByFile.js
index 8926bfdf..d810439b 100644
--- a/client/scripts/components/Modals/AddTorrentsModal/AddTorrentsByFile.js
+++ b/client/scripts/components/Modals/AddTorrentsModal/AddTorrentsByFile.js
@@ -28,7 +28,6 @@ const messages = defineMessages({
const METHODS_TO_BIND = [
'handleAddTorrents',
- 'handleDestinationChange',
'handleFileDrop',
'handleFileRemove',
'handleStartTorrentsToggle',
@@ -40,7 +39,6 @@ class AddTorrentsByFile extends React.Component {
super();
this.state = {
- destination: SettingsStore.getFloodSettings('torrentDestination'),
errors: {},
isAddingTorrents: false,
files: null,
@@ -153,7 +151,9 @@ class AddTorrentsByFile extends React.Component {
if (this.isFormValid()) {
this.setState({isAddingTorrents: true});
- let fileData = new FormData();
+ const destination = this.torrentDestinationRef.getWrappedInstance()
+ .getValue();
+ const fileData = new FormData();
this.state.files.forEach(file => {
fileData.append('torrents', file);
@@ -163,17 +163,13 @@ class AddTorrentsByFile extends React.Component {
fileData.append('tags', tag);
});
- fileData.append('destination', this.state.destination);
+ fileData.append('destination', destination);
fileData.append('start', this.state.startTorrents);
- TorrentActions.addTorrentsByFiles(fileData, this.state.destination);
+ TorrentActions.addTorrentsByFiles(fileData, destination);
}
}
- handleDestinationChange(destination) {
- this.setState({destination});
- }
-
handleStartTorrentsToggle(value) {
this.setState({startTorrents: value});
}
@@ -183,7 +179,7 @@ class AddTorrentsByFile extends React.Component {
}
isFormValid() {
- const {destination, files} = this.state;
+ const {files} = this.state;
const nextErrorsState = {};
const areFilesSelected = files != null
@@ -192,7 +188,7 @@ class AddTorrentsByFile extends React.Component {
return this.validatedFields.files.isValid(file);
});
const isDestinationValid = this.validatedFields.destination
- .isValid(destination);
+ .isValid(this.torrentDestinationRef.getWrappedInstance().getValue());
if (!areFilesSelected) {
nextErrorsState.files = this.validatedFields.files.error;
@@ -231,7 +227,7 @@ class AddTorrentsByFile extends React.Component {
defaultMessage="Destination"
/>
-
+ this.torrentDestinationRef = ref} />
@@ -256,4 +252,4 @@ class AddTorrentsByFile extends React.Component {
}
}
-export default injectIntl(AddTorrentsByFile);
+export default injectIntl(AddTorrentsByFile, {withRef: true});
diff --git a/client/scripts/components/Modals/AddTorrentsModal/AddTorrentsByURL.js b/client/scripts/components/Modals/AddTorrentsModal/AddTorrentsByURL.js
index 9c909cb9..cedced7c 100644
--- a/client/scripts/components/Modals/AddTorrentsModal/AddTorrentsByURL.js
+++ b/client/scripts/components/Modals/AddTorrentsModal/AddTorrentsByURL.js
@@ -23,7 +23,6 @@ const messages = defineMessages({
const METHODS_TO_BIND = [
'handleAddTorrents',
- 'handleDestinationChange',
'handleStartTorrentsToggle',
'handleTagsChange',
'handleUrlAdd',
@@ -37,7 +36,6 @@ class AddTorrentsByURL extends React.Component {
this.state = {
addTorrentsError: null,
- destination: SettingsStore.getFloodSettings('torrentDestination'),
errors: {},
isAddingTorrents: false,
tags: '',
@@ -68,17 +66,13 @@ class AddTorrentsByURL extends React.Component {
TorrentActions.addTorrentsByUrls({
urls: torrentURLs,
- destination: this.state.destination,
+ destination: this.torrentDestinationRef.getWrappedInstance().getValue(),
start: this.state.startTorrents,
tags: this.state.tags.split(',')
});
}
}
- handleDestinationChange(destination) {
- this.setState({destination});
- }
-
handleStartTorrentsToggle(value) {
this.setState({startTorrents: value});
}
@@ -110,7 +104,7 @@ class AddTorrentsByURL extends React.Component {
return this.validatedFields.urls.isValid(value);
});
const isDestinationValid = this.validatedFields.destination
- .isValid(this.state.destination);
+ .isValid(this.torrentDestinationRef.getWrappedInstance().getValue());
const nextErrorsState = {};
if (!areURLsDefined) {
@@ -170,7 +164,7 @@ class AddTorrentsByURL extends React.Component {
defaultMessage="Destination"
/>
-
+ this.torrentDestinationRef = ref} />