Skip to content

Commit

Permalink
fix: Export attachments url in proposal serializer
Browse files Browse the repository at this point in the history
  • Loading branch information
Quentinchampenois committed Dec 3, 2024
1 parent 11c8e6d commit 7858b45
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def serialize
},
comments: proposal.comments_count,
attachments: proposal.attachments.count,
attachment_urls: attachment_urls,
followers: proposal.followers.count,
published_at: proposal.published_at,
url: url,
Expand All @@ -45,6 +46,12 @@ def serialize
}
}
end

def attachment_urls
proposal.attachments.map do |attc|
Rails.application.routes.url_helpers.rails_blob_url(attc.file.blob, host: proposal.participatory_space.organization.host)
end.join(",")
end
end

Decidim::Proposals::ProposalSerializer.class_eval do
Expand Down

0 comments on commit 7858b45

Please sign in to comment.