Fix attachments when called from Cells#9136
Merged
Conversation
ahukkanen
approved these changes
Apr 6, 2022
entantoencuanto
added a commit
to PopulateTools/decidim
that referenced
this pull request
Apr 6, 2022
…into pwa-staging * chore/cache_highligted_resources_for_components_cells: Define expiry_time on highlighted_results_for_component cell Refactor expiration time of cells cache Cache cells used view hooks defined for participatory processes Do not send upcoming meeting notification for hidden or withdrawn meetings (decidim#9134) Fix processes count in processes group title cell (decidim#9087) Fix attachments when called from Cells (decidim#9136) Clarify message to user when checking census (decidim#9112)
entantoencuanto
added a commit
that referenced
this pull request
Apr 7, 2022
* develop: Compile SCSS through sass-embedded (#9081) Prevent race condition between prevenTimeout and show modal (#9092) Bump elections dependencies to 0.23.0 (#9140) Reduce d3 bundle size (#9034) Improve wording when casting your vote (#9098) Do not send upcoming meeting notification for hidden or withdrawn meetings (#9134) Fix processes count in processes group title cell (#9087) Fix attachments when called from Cells (#9136) Clarify message to user when checking census (#9112)
andreslucena
added a commit
that referenced
this pull request
May 6, 2022
* Drop .html extension on partials filenames * Add spec for votings' AttachmentsAndFoldersCell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎩 What? Why?
While working on Votings, it was detected an edge case on Cells and Attachments.
Basically the problem is that after Rails 6.1 upgrade (see #8610) we dropped the extension from the partial calls at
decidim/decidim-core/app/views/decidim/application/_attachments.html.erb
Line 4 in a15c91c
Most of the times it isn't a problem, but in votings we have the
AttachmentsAndFoldersCellcalling attachments from a cell, and as cells don't have the HTML extension in their file it doesn't find the partial giving an exception:Click for traceback
ActionView::Template::Error (Template missing: view:
_attachments.erbprefixes: ["/home/apereira/Work/decidim/decidim/development_app/app/cells/decidim/application", "/home/apereira/Work/decidim/decidim/decidim-assemblies/app/cells/decidim/application", "/home/apereira/Work/decidim/decidim/decidim-assemblies/app/views/decidim/application", "/home/apereira/Work/decidim/decidim/decidim-conferences/app/cells/decidim/application", "/home/apereira/Work/decidim/decidim/decidim-conferences/app/views/decidim/application", "/home/apereira/Work/decidim/decidim/decidim-core/app/cells/decidim/application", "/home/apereira/Work/decidim/decidim/decidim-core/app/cells/amendable/decidim/application", "/home/apereira/Work/decidim/decidim/decidim-core/app/views/decidim/application", "/home/apereira/Work/decidim/decidim/decidim-admin/app/cells/decidim/application", "/home/apereira/Work/decidim/decidim/decidim-admin/app/views/decidim/application", "/home/apereira/Work/decidim/decidim/decidim-forms/app/cells/decidim/application", "/home/apereira/Work/decidim/decidim/decidim-verifications/app/cells/decidim/application", "/home/apereira/Work/decidim/decidim/decidim-participatory_processes/app/cells/decidim/application", "/home/apereira/Work/decidim/decidim/decidim-participatory_processes/app/views/decidim/application", "/home/apereira/Work/decidim/decidim/decidim-comments/app/cells/decidim/application", "/home/apereira/Work/decidim/decidim/decidim-comments/app/views/decidim/application", "/home/apereira/Work/decidim/decidim/decidim-proposals/app/cells/decidim/application", "/home/apereira/Work/decidim/decidim/decidim-proposals/app/views/decidim/application", "/home/apereira/Work/decidim/decidim/decidim-meetings/app/cells/decidim/application", "/home/apereira/Work/decidim/decidim/decidim-meetings/app/views/decidim/application", "/home/apereira/Work/decidim/decidim/decidim-debates/app/cells/decidim/application", "/home/apereira/Work/decidim/decidim/decidim-debates/app/views/decidim/application", "/home/apereira/Work/decidim/decidim/decidim-budgets/app/cells/decidim/application", "/home/apereira/Work/decidim/decidim/decidim-budgets/app/views/decidim/application", "/home/apereira/Work/decidim/decidim/decidim-accountability/app/cells/decidim/application", "/home/apereira/Work/decidim/decidim/decidim-accountability/app/views/decidim/application", "/home/apereira/Work/decidim/decidim/decidim-sortitions/app/cells/decidim/application", "/home/apereira/Work/decidim/decidim/decidim-sortitions/app/views/decidim/application", "/home/apereira/Work/decidim/decidim/decidim-blogs/app/cells/decidim/application", "/home/apereira/Work/decidim/decidim/decidim-blogs/app/views/decidim/application", "/home/apereira/Work/decidim/decidim/decidim-consultations/app/cells/decidim/application", "/home/apereira/Work/decidim/decidim/decidim-consultations/app/views/decidim/application", "/home/apereira/Work/decidim/decidim/decidim-elections/app/cells/decidim/application", "/home/apereira/Work/decidim/decidim/decidim-elections/app/views/decidim/application", "/home/apereira/Work/decidim/decidim/decidim-elections/app/cells/decidim/application", "/home/apereira/Work/decidim/decidim/decidim-elections/app/views/decidim/application", "/home/apereira/Work/decidim/decidim/decidim-initiatives/app/cells/decidim/application", "/home/apereira/Work/decidim/decidim/decidim-initiatives/app/views/decidim/application"]):10: %>
11:
12: <% landing_content_blocks.each do |content_block| %>
13: <%= cell content_block.manifest.cell, content_block %>
14: <% end %>
15:
16: <% if landing_content_blocks.empty? %>
cells (4.1.7) lib/cell/view_model.rb:167:in
find_template' cells (4.1.7) lib/cell/view_model.rb:109:inrender_to_string'cells (4.1.7) lib/cell/layout.rb:23:in
render_to_string' cells (4.1.7) lib/cell/view_model.rb:104:inrender'/home/apereira/Work/decidim/decidim/decidim-core/app/helpers/decidim/attachments_helper.rb:13:in
attachments_for' /home/apereira/Work/decidim/decidim/decidim-elections/app/cells/decidim/votings/content_blocks/landing_page/attachments_and_folders_cell.rb:16:inshow'cells (4.1.7) lib/cell/view_model.rb:114:in
render_state' cells (4.1.7) lib/cell/caching.rb:46:inrender_state'cells (4.1.7) lib/cell/view_model.rb:92:in
call' cells-rails (0.1.4) lib/cell/rails.rb:55:incall'/home/apereira/Work/decidim/decidim/decidim-core/lib/decidim/view_model.rb:33:in
block in call' /home/apereira/Work/decidim/decidim/decidim-core/lib/decidim/view_model.rb:51:inblock in instrument'activesupport (6.1.4.7) lib/active_support/notifications.rb:203:in
block in instrument' activesupport (6.1.4.7) lib/active_support/notifications/instrumenter.rb:24:ininstrument'activesupport (6.1.4.7) lib/active_support/notifications.rb:203:in
instrument' /home/apereira/Work/decidim/decidim/decidim-core/lib/decidim/view_model.rb:50:ininstrument'/home/apereira/Work/decidim/decidim/decidim-core/lib/decidim/view_model.rb:32:in
call' cells (4.1.7) lib/cell/view_model.rb:125:into_s'actionview (6.1.4.7) lib/action_view/buffers.rb:29:in
<<' /home/apereira/Work/decidim/decidim/decidim-elections/app/views/decidim/votings/votings/show.html.erb:13 /home/apereira/Work/decidim/decidim/decidim-elections/app/views/decidim/votings/votings/show.html.erb:12:ineach'/home/apereira/Work/decidim/decidim/decidim-elections/app/views/decidim/votings/votings/show.html.erb:12
The fix is just some renaming in these files. I've also added a regressions spec for this particular cell.
📌 Related Issues
Testing
or