Commit 306219f
committed
Fix parent_document_url not being sent to asset manager for consultation outcome attachments
When a consultation is published, PublishAttachmentAssetJob updates each
attachment's metadata in asset manager. For attachments belonging to a
Consultation Outcome, `parent_document_url` was never sent because the job guards with `respond_to?(:public_url)` and Consultation Response did not implement that method.
I've extended ConsultationResponse, so the parent consultation's public URL is used as `parent_document_url`.
Known limitation: `attachable_url` in AttachmentData is used by
`AssetManagerAttachmentMetadataJob` when an attachment is saved or updated on a draft consultation. The `parent_document_url` sent to asset manager will still be `nil` in such case. This is because `visible_edition_for` filters to Edition subclasses only, and
ConsultationResponse is not an Edition.
In essence, `parent_document_url` is only reliably set at document publish time.
Extending `attachable_url` to handle non-edition attachables with a public URL would be great as a follow-up work.1 parent e028374 commit 306219f
2 files changed
Lines changed: 23 additions & 0 deletions
File tree
- app/models
- test/unit/app/sidekiq
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
36 | 38 | | |
37 | 39 | | |
38 | 40 | | |
| |||
Lines changed: 21 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
62 | 83 | | |
63 | 84 | | |
0 commit comments