diff --git a/app/views/decidim/proposals/proposals/_proposals.html.erb b/app/views/decidim/proposals/proposals/_proposals.html.erb index 620dd22..c5cfbf4 100644 --- a/app/views/decidim/proposals/proposals/_proposals.html.erb +++ b/app/views/decidim/proposals/proposals/_proposals.html.erb @@ -4,7 +4,7 @@ ).html_safe, callout_class: "warning [&>a]:text-secondary") %> <% end %> -<% if @proposals.empty? && @external_proposals.empty? %> +<% if @proposals.empty? && @external_proposals&.empty? %> <%= cell("decidim/announcement", params[:filter].present? ? t(".empty_filters") : t(".empty")) %> <% else %>
diff --git a/lib/decidim/dataspace.rb b/lib/decidim/dataspace.rb index 844959a..ae8fac4 100644 --- a/lib/decidim/dataspace.rb +++ b/lib/decidim/dataspace.rb @@ -3,11 +3,9 @@ require "decidim/dataspace/admin" require "decidim/dataspace/engine" require "decidim/dataspace/admin_engine" -require "decidim/dataspace/component" module Decidim - # This namespace holds the logic of the `Dataspace` component. This component - # allows users to create dataspace in a participatory space. + # This namespace holds the logic of the `Dataspace` module. module Dataspace end end diff --git a/lib/decidim/dataspace/component.rb b/lib/decidim/dataspace/component.rb deleted file mode 100644 index d128232..0000000 --- a/lib/decidim/dataspace/component.rb +++ /dev/null @@ -1,40 +0,0 @@ -# frozen_string_literal: true - -require "decidim/components/namer" - -Decidim.register_component(:dataspace) do |component| - component.engine = Decidim::Dataspace::Engine - component.admin_engine = Decidim::Dataspace::AdminEngine - component.icon = "decidim/dataspace/icon.svg" - - # component.on(:before_destroy) do |instance| - # # Code executed before removing the component - # end - - # These actions permissions can be configured in the admin panel - # component.actions = %w() - - # component.settings(:global) do |settings| - # # Add your global settings - # # Available types: :integer, :boolean - # # settings.attribute :vote_limit, type: :integer, default: 0 - # end - - # component.settings(:step) do |settings| - # # Add your settings per step - # end - - # component.register_resource(:some_resource) do |resource| - # # Register a optional resource that can be references from other resources. - # resource.model_class_name = "Decidim::Dataspace::SomeResource" - # resource.template = "decidim/dataspace/some_resources/linked_some_resources" - # end - - # component.register_stat :some_stat do |context, start_at, end_at| - # # Register some stat number to the application - # end - - # component.seeds do |participatory_space| - # # Add some seeds for this component - # end -end diff --git a/spec/controllers/decidim/dataspace/api/v1/contributions_controller_spec.rb b/spec/controllers/decidim/dataspace/api/v1/contributions_controller_spec.rb index fbeffc6..5db9129 100644 --- a/spec/controllers/decidim/dataspace/api/v1/contributions_controller_spec.rb +++ b/spec/controllers/decidim/dataspace/api/v1/contributions_controller_spec.rb @@ -136,7 +136,7 @@ # 2 comments without details expect(response.parsed_body["children"].size).to eq(2) expect(response.parsed_body["children"].first.class).to eq(String) - expect(response.parsed_body["children"].first).to eq(comment_one.reference) + expect([comment_one.reference, comment_two.reference]).to include(response.parsed_body["children"].first) end end @@ -160,8 +160,8 @@ # 2 comments with details expect(response.parsed_body["children"].size).to eq(2) expect(response.parsed_body["children"].first.class).to eq(Hash) - expect(response.parsed_body["children"].first["reference"]).to eq(comment_one.reference) - expect(response.parsed_body["children"].first["content"]).to eq(comment_one.body["en"]) + expect([comment_one.reference, comment_two.reference]).to include(response.parsed_body["children"].first["reference"]) + expect([comment_one.body["en"], comment_two.body["en"]]).to include(response.parsed_body["children"].first["content"]) end end end diff --git a/spec/models/contribution_spec.rb b/spec/models/contribution_spec.rb index 027fa6b..1c9db4a 100644 --- a/spec/models/contribution_spec.rb +++ b/spec/models/contribution_spec.rb @@ -31,8 +31,8 @@ module Dataspace expect(method_call.first.class).to eq(Hash) # first is proposal and has 2 children expect(method_call.first[:children].size).to eq(2) - # second will be the first comment of proposal - expect(method_call.second[:reference]).to eq(comment_one.reference) + # second will be a comment of proposal + expect([comment_one.reference, comment_two.reference]).to include(method_call.second[:reference]) # last is proposal_three and has no children expect(method_call.last[:children]).to eq([]) end @@ -72,7 +72,7 @@ module Dataspace expect(method_call[:children].size).to eq(2) # comments are not detailed expect(method_call[:children].first.class).to eq(String) - expect(method_call[:children].first).to eq(comment_one.reference) + expect([comment_one.reference, comment_two.reference]).to include(method_call[:children].first) end end @@ -89,7 +89,7 @@ module Dataspace expect(method_call[:children].size).to eq(2) # comments are detailed expect(method_call[:children].first.class).to eq(Hash) - expect(method_call[:children].first[:reference]).to eq(comment_one.reference) + expect([comment_one.reference, comment_two.reference]).to include(method_call[:children].first[:reference]) end end end diff --git a/spec/presenters/contribution_presenter_spec.rb b/spec/presenters/contribution_presenter_spec.rb index ad70892..7eaa72a 100644 --- a/spec/presenters/contribution_presenter_spec.rb +++ b/spec/presenters/contribution_presenter_spec.rb @@ -47,7 +47,8 @@ module Dataspace expect(method_call.size).to eq(13) expect(method_call[:reference]).to eq(proposal.reference) expect(method_call[:title]).to eq(translated_attribute(proposal.title)) - expect(method_call[:children]).to eq([comment_one.reference, comment_two.reference]) + expect([comment_one.reference, comment_two.reference]).to include(method_call[:children].first) + expect([comment_one.reference, comment_two.reference]).to include(method_call[:children].last) end end end