Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[publication] Fix number of files in Upload tab #9179

Merged
merged 9 commits into from
Apr 16, 2024
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ changes in the following format: PR #1234***
- bvl_feedback updates in real-time (PR #8966)
- DoB and DoD format respected in candidate parameters (PR #9001)
- Fix delete file in upload (PR #9181)
- While proposing a project or editing a project in publications module, prevent indefinite "File to upload" fields from being added if files are browsed then cancelled (PR #9179)

## LORIS 25.0 (Release Date: ????-??-??)
### Core
Expand Down
14 changes: 11 additions & 3 deletions modules/publication/jsx/uploadForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,17 @@ class PublicationUploadForm extends React.Component {
*/
setFileData(formElement, value) {
let numFiles = this.state.numFiles;
if (!this.state.formData[formElement]) {
numFiles += 1;
this.setState({numFiles: numFiles});
if (value) {
if (!this.state.formData[formElement]) {
numFiles += 1;
this.setState({numFiles: numFiles});
}
} else {
// File is being removed
if (this.state.formData[formElement]) {
numFiles -= 1;
this.setState({numFiles: numFiles});
}
}
this.setFormData(formElement, value);
}
Expand Down
3 changes: 3 additions & 0 deletions modules/publication/test/TestPlan.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ and ensure that the project proposal page is now accessible.
5. Fill out all the fields in the form and try to submit. Make sure you have
a corresponding directory to the directory specified in Config if you are
attempting a file upload. Try submitting without filling in required fields.
6. Try adding a file to upload, and then adding another file to upload. Next,
select browse in the second file that was uploaded, but cancel the file. The
file should be removed, and no extra "File to upload" fields should be added.
6. Login under one of the accounts you specified under the
"Users with Edit Permission" and access the project page and make edits to
the proposal.
Expand Down
Loading