PLT-1316/PLT-3280 Change client-side max file size limit (#3354)

* Change client-side max file size limit

It now relies on the value set in config.json.
Re-enable and tweak the max file size setting in system console.

* Update file upload error message
Этот коммит содержится в:
Thomas Balthazar
2016-07-05 21:37:21 +02:00
коммит произвёл Harrison Healey
родитель 71bd413b25
Коммит f4dd8e5796
6 изменённых файлов: 32 добавлений и 28 удалений

Просмотреть файл

@@ -95,6 +95,7 @@ class UserSettingsGeneralTab extends React.Component {
this.updateSection = this.updateSection.bind(this);
this.state = this.setupInitialState(props);
this.setState({maxFileSize: global.window.mm_config.MaxFileSize});
}
submitUsername(e) {
e.preventDefault();
@@ -221,7 +222,7 @@ class UserSettingsGeneralTab extends React.Component {
if (picture.type !== 'image/jpeg' && picture.type !== 'image/png') {
this.setState({clientError: formatMessage(holders.validImage)});
return;
} else if (picture.size > Constants.MAX_FILE_SIZE) {
} else if (picture.size > this.state.maxFileSize) {
this.setState({clientError: formatMessage(holders.imageTooLarge)});
return;
}