Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix validation context for filename uniqueness
In 7075279, the decision was made to scope attachment validations to user submissions on attachment models only: > This updates the Attachment model to scope the AttachmentValidator so > that it's only part of the model validations when a user creates or > updates an attachment. This was to prevent an issue whereby invalid attachments would be 'shed' when creating new editions. We only want the validations to run when editing the attachments themselves. The 'shedding' bug hasn't returned, but we do have a new one: when creating a new edition on a document that has multiple attachments of the same filename, we hit this validation error: 'Validation failed: This <document type> already has a file called "<filename>"'. The fix was to only call the validation methods when making an edit to an attachment, not to its associated document. It looks as though the filename uniqueness validation check was accidentally missed from the commit above. Trello: https://trello.com/c/FJuN46qU/3217-unable-to-create-new-edition-in-whitehall-validation-error
- Loading branch information