diff --git a/.codeclimate.yml b/.codeclimate.yml index 65826a4e1..87fc4371a 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -63,3 +63,4 @@ exclude_paths: - "decidim-ephemeral_participation/app/permissions/decidim/ephemeral_participation/ephemeral_participation_permissions.rb" - "app/services/decidim_legacy_routes.rb" - "app/helpers/concerns/decidim/paginate_helper_override.rb" +- "app/permissions/concerns/decidim/initiatives/admin/permissions_override.rb" diff --git a/Gemfile.lock b/Gemfile.lock index d2d6bb368..bbccfad20 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: https://github.com/AjuntamentdeBarcelona/decidim - revision: 6e50c98a52907d8e830301d8e2a02c27ec5246c6 + revision: 739d2cc1c0faa65a7e8d0788944165debd416bd1 branch: release/0.28-stable-bcn specs: decidim (0.28.4) diff --git a/app/permissions/concerns/decidim/initiatives/admin/permissions_override.rb b/app/permissions/concerns/decidim/initiatives/admin/permissions_override.rb index aa227f763..d6d535853 100644 --- a/app/permissions/concerns/decidim/initiatives/admin/permissions_override.rb +++ b/app/permissions/concerns/decidim/initiatives/admin/permissions_override.rb @@ -10,8 +10,8 @@ def initiative_admin_user_action? return unless permission_action.subject == :initiative case permission_action.action - when :read - toggle_allow(Decidim::Initiatives.print_enabled) + when :print + toggle_allow(Decidim::Initiatives.print_enabled && user.admin?) when :publish, :discard toggle_allow(initiative.validating?) when :unpublish diff --git a/db/migrate/20241031144530_add_email_on_assigned_proposals_to_users.decidim_proposals.rb b/db/migrate/20241031144530_add_email_on_assigned_proposals_to_users.decidim_proposals.rb new file mode 100644 index 000000000..6c04835fe --- /dev/null +++ b/db/migrate/20241031144530_add_email_on_assigned_proposals_to_users.decidim_proposals.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true +# This migration comes from decidim_proposals (originally 20240617091140) + +class AddEmailOnAssignedProposalsToUsers < ActiveRecord::Migration[6.1] + def change + add_column :decidim_users, :email_on_assigned_proposals, :boolean, default: true + end +end diff --git a/db/schema.rb b/db/schema.rb index 86d8e8a7e..498610a5d 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2024_10_15_093725) do +ActiveRecord::Schema.define(version: 2024_10_31_144530) do # These are extensions that must be enabled in order to support this database enable_extension "ltree" @@ -1880,6 +1880,7 @@ t.datetime "digest_sent_at" t.datetime "password_updated_at" t.string "previous_passwords", default: [], array: true + t.boolean "email_on_assigned_proposals", default: true t.index ["confirmation_token"], name: "index_decidim_users_on_confirmation_token", unique: true t.index ["decidim_organization_id"], name: "index_decidim_users_on_decidim_organization_id" t.index ["email", "decidim_organization_id"], name: "index_decidim_users_on_email_and_decidim_organization_id", unique: true, where: "((deleted_at IS NULL) AND (managed = false) AND ((type)::text = 'Decidim::User'::text))" diff --git a/spec/lib/overrides_spec.rb b/spec/lib/overrides_spec.rb index e13c9a5d3..26b3da048 100644 --- a/spec/lib/overrides_spec.rb +++ b/spec/lib/overrides_spec.rb @@ -93,7 +93,7 @@ files: { "/app/cells/decidim/initiatives/initiative_metadata_g_cell.rb" => "e41380534ae3c4c441530a6739e3746a", "/app/models/decidim/initiative.rb" => "77c9775fcff404b16e5a382915116fe1", - "/app/permissions/decidim/initiatives/admin/permissions.rb" => "805ba1e544cc3883baec90a357596320", + "/app/permissions/decidim/initiatives/admin/permissions.rb" => "c0f9bf5d9edaca545a7c931c0dc5c0e9", "/app/views/decidim/initiatives/initiatives/_progress_bar.html.erb" => "849e1ad297a15bb00e34122d3b845ff9", "/app/views/decidim/initiatives/initiative_signatures/fill_personal_data.html.erb" => "40c663fcb732743399b4fe79605e7823" }