diff --git a/Gemfile.lock b/Gemfile.lock index 1df90c1b7671..8f684cf1e20f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -833,7 +833,7 @@ GEM activesupport wisper (2.0.1) wisper-rspec (1.1.0) - wkhtmltopdf-binary (0.12.6.5) + wkhtmltopdf-binary (0.12.6.6) xpath (3.2.0) nokogiri (~> 1.8) zeitwerk (2.5.1) diff --git a/decidim-assemblies/app/permissions/decidim/assemblies/permissions.rb b/decidim-assemblies/app/permissions/decidim/assemblies/permissions.rb index 12ab4a536f9f..24e6d9a4efee 100644 --- a/decidim-assemblies/app/permissions/decidim/assemblies/permissions.rb +++ b/decidim-assemblies/app/permissions/decidim/assemblies/permissions.rb @@ -17,7 +17,6 @@ def permissions public_list_assemblies_action? public_read_assembly_action? public_list_members_action? - public_report_content_action? return permission_action end @@ -125,13 +124,6 @@ def public_list_members_action? allow! end - def public_report_content_action? - return unless permission_action.action == :create && - permission_action.subject == :moderation - - allow! - end - # All users with a relation to a assembly and organization admins can enter # the space area. The sapce area is considered to be the assemblies zone, # not the assembly groups one. diff --git a/decidim-assemblies/spec/permissions/decidim/assemblies/permissions_spec.rb b/decidim-assemblies/spec/permissions/decidim/assemblies/permissions_spec.rb index d763feb3aefd..f14464a86f1b 100644 --- a/decidim-assemblies/spec/permissions/decidim/assemblies/permissions_spec.rb +++ b/decidim-assemblies/spec/permissions/decidim/assemblies/permissions_spec.rb @@ -126,14 +126,6 @@ it { is_expected.to eq true } end - context "when reporting a resource" do - let(:action) do - { scope: :public, action: :create, subject: :moderation } - end - - it { is_expected.to eq true } - end - context "when any other action" do let(:action) do { scope: :public, action: :foo, subject: :bar } diff --git a/decidim-blogs/app/views/decidim/blogs/posts/_posts.html.erb b/decidim-blogs/app/views/decidim/blogs/posts/_posts.html.erb index 68d7f7178608..fc0bb4625051 100644 --- a/decidim-blogs/app/views/decidim/blogs/posts/_posts.html.erb +++ b/decidim-blogs/app/views/decidim/blogs/posts/_posts.html.erb @@ -1,6 +1,9 @@
<% paginate_posts.each do |post| %>
+ <% if post.photo.present? %> + <%= image_tag post.photo.url, class: "card__image" %> + <% end %>
<%= link_to post, class: "card__link" do %> diff --git a/decidim-blogs/spec/system/explore_posts_spec.rb b/decidim-blogs/spec/system/explore_posts_spec.rb index fd14ac2862ef..6b09e2f9ebc3 100644 --- a/decidim-blogs/spec/system/explore_posts_spec.rb +++ b/decidim-blogs/spec/system/explore_posts_spec.rb @@ -9,6 +9,8 @@ let!(:old_post) { create(:post, component: component, created_at: Time.current - 2.days) } let!(:new_post) { create(:post, component: component, created_at: Time.current) } + let!(:image) { create(:attachment, attached_to: old_post) } + describe "index" do it "shows all posts for the given process" do visit_component @@ -17,6 +19,11 @@ expect(page).to have_selector(".card--post", text: translated(old_post.title)) end + it "shows images" do + visit_component + expect(page).to have_selector(".card--post img.card__image") + end + it "shows comment counts" do visit_component expect(page).to have_selector('a[title="comments"]', text: "comment".pluralize(new_post.comments.count)) diff --git a/decidim-comments/app/models/decidim/comments/comment.rb b/decidim-comments/app/models/decidim/comments/comment.rb index d257fe448a87..0dfb87cb33a3 100644 --- a/decidim-comments/app/models/decidim/comments/comment.rb +++ b/decidim-comments/app/models/decidim/comments/comment.rb @@ -85,7 +85,7 @@ def visible? alias original_participatory_space participatory_space def participatory_space return original_participatory_space if original_participatory_space.present? - return root_commentable if root_commentable.is_a?(Decidim::Participable) + return root_commentable unless root_commentable.respond_to?(:participatory_space) root_commentable.participatory_space end diff --git a/decidim-conferences/app/permissions/decidim/conferences/permissions.rb b/decidim-conferences/app/permissions/decidim/conferences/permissions.rb index d8abc3fd7adb..d00b6cbbf82f 100644 --- a/decidim-conferences/app/permissions/decidim/conferences/permissions.rb +++ b/decidim-conferences/app/permissions/decidim/conferences/permissions.rb @@ -20,7 +20,6 @@ def permissions public_list_program_action? public_list_media_links_action? public_list_registration_types_action? - public_report_content_action? can_join_conference? can_leave_conference? @@ -159,13 +158,6 @@ def public_list_registration_types_action? allow! end - def public_report_content_action? - return unless permission_action.action == :create && - permission_action.subject == :moderation - - allow! - end - # All users with a relation to a conference and organization admins can enter # the space area. The sapce area is considered to be the conferences zone, # not the conference groups one. diff --git a/decidim-conferences/spec/permissions/decidim/conferences/permissions_spec.rb b/decidim-conferences/spec/permissions/decidim/conferences/permissions_spec.rb index d1fc558f05e1..e999b4ef98bb 100644 --- a/decidim-conferences/spec/permissions/decidim/conferences/permissions_spec.rb +++ b/decidim-conferences/spec/permissions/decidim/conferences/permissions_spec.rb @@ -140,14 +140,6 @@ it { is_expected.to eq true } end - context "when reporting a resource" do - let(:action) do - { scope: :public, action: :create, subject: :moderation } - end - - it { is_expected.to eq true } - end - context "when any other action" do let(:action) do { scope: :public, action: :foo, subject: :bar } diff --git a/decidim-consultations/app/models/decidim/consultations/question.rb b/decidim-consultations/app/models/decidim/consultations/question.rb index d48667d4e4a2..533a1e094709 100644 --- a/decidim-consultations/app/models/decidim/consultations/question.rb +++ b/decidim-consultations/app/models/decidim/consultations/question.rb @@ -66,6 +66,7 @@ class Question < ApplicationRecord delegate :start_voting_date, to: :consultation delegate :end_voting_date, to: :consultation delegate :results_published?, to: :consultation + delegate :moderators, to: :consultation alias participatory_space consultation diff --git a/decidim-core/app/permissions/decidim/permissions.rb b/decidim-core/app/permissions/decidim/permissions.rb index dee69831c345..73ab21062e8f 100644 --- a/decidim-core/app/permissions/decidim/permissions.rb +++ b/decidim-core/app/permissions/decidim/permissions.rb @@ -10,6 +10,8 @@ def permissions component_public_action? search_scope_action? + public_report_content_action? + return permission_action unless user user_manager_permissions @@ -28,6 +30,13 @@ def permissions private + def public_report_content_action? + return unless permission_action.action == :create && + permission_action.subject == :moderation + + allow! + end + def read_public_pages_action? return unless permission_action.subject == :public_page && permission_action.action == :read diff --git a/decidim-core/lib/decidim/has_attachments.rb b/decidim-core/lib/decidim/has_attachments.rb index 93c3cc1ffcab..860800333668 100644 --- a/decidim-core/lib/decidim/has_attachments.rb +++ b/decidim-core/lib/decidim/has_attachments.rb @@ -15,28 +15,35 @@ module HasAttachments inverse_of: :attached_to, as: :attached_to - # All the attachments that are photos for this process. + # The first attachment that is a photo for this model. + # + # Returns an Attachment + def photo + @photo ||= photos.first + end + + # All the attachments that are photos for this model. # # Returns an Array def photos @photos ||= attachments.select(&:photo?) end - # All the attachments that are documents for this process. + # All the attachments that are documents for this model. # # Returns an Array def documents @documents ||= attachments.includes(:attachment_collection).select(&:document?) end - # All the attachments that are documents for this process that has a collection. + # All the attachments that are documents for this model that has a collection. # # Returns an Array def documents_with_collection documents.select(&:attachment_collection_id?) end - # All the attachments that are documents for this process that not has a collection. + # All the attachments that are documents for this model that not has a collection. # # Returns an Array def documents_without_collection diff --git a/decidim-core/spec/permissions/decidim/permissions_spec.rb b/decidim-core/spec/permissions/decidim/permissions_spec.rb index f6d3e95ebf37..540a28ff4976 100644 --- a/decidim-core/spec/permissions/decidim/permissions_spec.rb +++ b/decidim-core/spec/permissions/decidim/permissions_spec.rb @@ -32,6 +32,14 @@ it { is_expected.to eq true } end + context "when reporting a resource" do + let(:action) do + { scope: :public, action: :create, subject: :moderation } + end + + it { is_expected.to eq true } + end + context "when reading a component" do let(:action) do { scope: :public, action: :read, subject: :component } diff --git a/decidim-generators/spec/generators_spec.rb b/decidim-generators/spec/generators_spec.rb index 46eff7bf0f84..d81d9fd738f9 100644 --- a/decidim-generators/spec/generators_spec.rb +++ b/decidim-generators/spec/generators_spec.rb @@ -102,14 +102,8 @@ module Decidim it_behaves_like "a new production application" end - context "with --edge flag" do - let(:command) { "decidim --edge #{test_app}" } - - it_behaves_like "a new production application" - end - context "with --branch flag" do - let(:default_branch) { "develop" } + let(:default_branch) { "release/0.25-stable" } let(:command) { "decidim --branch #{default_branch} #{test_app}" } it_behaves_like "a new production application" diff --git a/decidim-initiatives/app/permissions/decidim/initiatives/permissions.rb b/decidim-initiatives/app/permissions/decidim/initiatives/permissions.rb index 3a656bb852e5..1041aa8be0fb 100644 --- a/decidim-initiatives/app/permissions/decidim/initiatives/permissions.rb +++ b/decidim-initiatives/app/permissions/decidim/initiatives/permissions.rb @@ -9,7 +9,6 @@ def permissions return permission_action if permission_action.scope != :public # Non-logged users permissions - public_report_content_action? list_public_initiatives? read_public_initiative? search_initiative_types_and_scopes? @@ -154,13 +153,6 @@ def initiative_attachment? toggle_allow(initiative_type.attachments_enabled?) end - def public_report_content_action? - return unless permission_action.action == :create && - permission_action.subject == :moderation - - allow! - end - def sign_initiative? return unless permission_action.action == :sign_initiative && permission_action.subject == :initiative diff --git a/decidim-meetings/app/cells/decidim/meetings/meeting_m_cell.rb b/decidim-meetings/app/cells/decidim/meetings/meeting_m_cell.rb index b39ad96aca60..3c33530c3259 100644 --- a/decidim-meetings/app/cells/decidim/meetings/meeting_m_cell.rb +++ b/decidim-meetings/app/cells/decidim/meetings/meeting_m_cell.rb @@ -35,6 +35,14 @@ def description private + def resource_image_path + model.photo&.url + end + + def has_image? + true + end + def spans_multiple_dates? start_date != end_date end diff --git a/decidim-meetings/spec/cells/decidim/meetings/meeting_m_cell_spec.rb b/decidim-meetings/spec/cells/decidim/meetings/meeting_m_cell_spec.rb index 880c9a4ad4cf..a544c2335727 100644 --- a/decidim-meetings/spec/cells/decidim/meetings/meeting_m_cell_spec.rb +++ b/decidim-meetings/spec/cells/decidim/meetings/meeting_m_cell_spec.rb @@ -24,6 +24,14 @@ module Decidim::Meetings expect(cell_html).to have_no_content("Created at") expect(cell_html).to have_no_content(I18n.l(meeting.created_at.to_date, format: :decidim_short)) end + + context "when an image is attached to the meeting" do + let!(:attachment) { create(:attachment, attached_to: meeting) } + + it "renders the picture" do + expect(cell_html).to have_css(".card__image") + end + end end context "when title contains special html entities" do diff --git a/decidim-participatory_processes/app/permissions/decidim/participatory_processes/permissions.rb b/decidim-participatory_processes/app/permissions/decidim/participatory_processes/permissions.rb index 0b7e303644b2..dbdcd74a2c52 100644 --- a/decidim-participatory_processes/app/permissions/decidim/participatory_processes/permissions.rb +++ b/decidim-participatory_processes/app/permissions/decidim/participatory_processes/permissions.rb @@ -19,7 +19,6 @@ def permissions public_list_process_groups_action? public_read_process_group_action? public_read_process_action? - public_report_content_action? return permission_action end @@ -119,13 +118,6 @@ def can_view_private_space? user.admin || process.users.include?(user) end - def public_report_content_action? - return unless permission_action.action == :create && - permission_action.subject == :moderation - - allow! - end - # Only organization admins can enter the process groups space area. def user_can_enter_process_groups_space_area? return unless permission_action.action == :enter && diff --git a/decidim-participatory_processes/spec/permissions/decidim/participatory_processes/permissions_spec.rb b/decidim-participatory_processes/spec/permissions/decidim/participatory_processes/permissions_spec.rb index a78c24136fcc..fafb4d08f0c8 100644 --- a/decidim-participatory_processes/spec/permissions/decidim/participatory_processes/permissions_spec.rb +++ b/decidim-participatory_processes/spec/permissions/decidim/participatory_processes/permissions_spec.rb @@ -134,14 +134,6 @@ it { is_expected.to eq true } end - context "when reporting a resource" do - let(:action) do - { scope: :public, action: :create, subject: :moderation } - end - - it { is_expected.to eq true } - end - context "when any other action" do let(:action) do { scope: :public, action: :foo, subject: :bar } diff --git a/decidim-proposals/app/cells/decidim/proposals/proposals_picker_cell.rb b/decidim-proposals/app/cells/decidim/proposals/proposals_picker_cell.rb index cdd773d437eb..cba57cee5d72 100644 --- a/decidim-proposals/app/cells/decidim/proposals/proposals_picker_cell.rb +++ b/decidim-proposals/app/cells/decidim/proposals/proposals_picker_cell.rb @@ -6,7 +6,7 @@ module Decidim module Proposals # This cell renders a proposals picker. class ProposalsPickerCell < Decidim::ViewModel - MAX_PROPOSALS = 1000 + MAX_PROPOSALS = 2000 def show if filtered? diff --git a/decidim_app-design/Gemfile.lock b/decidim_app-design/Gemfile.lock index adf4ce8e4fb2..e62c2fb58ff4 100644 --- a/decidim_app-design/Gemfile.lock +++ b/decidim_app-design/Gemfile.lock @@ -833,7 +833,7 @@ GEM activesupport wisper (2.0.1) wisper-rspec (1.1.0) - wkhtmltopdf-binary (0.12.6.5) + wkhtmltopdf-binary (0.12.6.6) xpath (3.2.0) nokogiri (~> 1.8) zeitwerk (2.5.1)