Commit 2bdc282
committed
Fix parent_document_url not being sent to asset manager for response-type attachments
When a consultation or call for evidence is published, `PublishAttachmentAssetJob` updates each attachment's metadata in asset manager. For attachments belonging to a ConsultationOutcome, ConsultationPublicFeedback, or CallForEvidenceOutcome, `parent_document_url` was never sent because the job guards with `respond_to?(:public_url)`, and neither ConsultationResponse nor CallForEvidenceResponse implemented that method.
I've extended ConsultationResponse and CallForEvidenceResponse, so the PublishAttachmentAssetJob can use their parent document's public URL for associated attachments' `parent_document_url`.
Known limitation: When saving a draft edition of a Consultation Outcome/Public Feedback or Call for Evidence Outcome, the `attachable_url` in AttachmentData is used to get the `parent_document_url` to be sent to Asset Manager. However, this will still return `nil`. This is because that method calls `visible_edition_for` which filters to Edition subclasses only, and neither ConsultationResponse nor CallForEvidenceResponse is an Edition. As a result, `parent_document_url` is only reliably set at publish time, not on every metadata update.
Extending `attachable_url` to handle non-edition attachables with a public URL would be great as a follow-up work.1 parent e028374 commit 2bdc282
3 files changed
Lines changed: 67 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 | | |
| |||
| 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: 63 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 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
62 | 125 | | |
63 | 126 | | |
0 commit comments