-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upload documents to google drive (UD3, UD6.1, UD6.2) #1327
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall good, but needs a bit of work on a few small things. See comments.
end | ||
|
||
def file_size_error(filename) | ||
@errors = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if there's a risk, in using a separate variable to track whether there are errors, that it will become decoupled from the actual state of @documents_form.errors
which is partly determined by ActiveModel.
unless @errors
could become (something like):
unless @documents_form.errors
in order to have a single source of truth about whether there are errors. Maybe this is just a pattern I'm unaware of though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure, but I think this is because we don't validate whether we have a virus in the form model.
We wouldn't know if there was a virus unless Google tells us so the method is invoked depending on the response from Google.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the error is created on line 84:
@documents_form.errors.add(:base, t('jobs.file_virus_error_message', filename: filename))
Does that count as validating in the form model, for your purposes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is the rebased form of #1302 and will replace it.
(Pushed the rebased branch to a separate branch to check that the rebase worked without losing our original work)
Cancel functionality has been broken out into a new ticket (TEVA-504)
Google drive issue has been documented in a separate ticket (TEVA-505)
Uploading progress indicator to be reviewed, amended and finalised (TEVA-506)
ACCEPTANCE (TEVA-408):