Skip to content

Commit

Permalink
Merge branch 'master' of github.com:gencat/participa into fix/amendments
Browse files Browse the repository at this point in the history
  • Loading branch information
laurajaime committed Nov 14, 2024
2 parents f2e523a + cab1351 commit d75c47f
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 26 deletions.
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ gem "decidim-top_comments", path: "decidim-top_comments"

gem "decidim-cdtb"
gem "decidim-challenges", git: "https://github.com/gencat/decidim-module-challenges.git", tag: "v0.3.3"
gem "decidim-department_admin", git: "https://github.com/gencat/decidim-module-department_admin.git", tag: "v0.7.1"
gem "decidim-department_admin", "~> 0.7.2"
gem "decidim-idcat_mobil"
gem "decidim-term_customizer", git: "https://github.com/mainio/decidim-module-term_customizer.git", branch: "release/0.27-stable"

gem "decidim-verifications-members_picker", git: "https://github.com/gencat/decidim-verifications-members_picker.git", tag: "0.0.6"
gem "decidim-verifications-members_picker", "~> 0.0.6.1"
#### Custom gems and modifications block end ####

gem "soda-ruby", require: false
Expand Down
30 changes: 9 additions & 21 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -178,25 +178,6 @@ GIT
decidim-challenges (0.3.3)
decidim-core (~> 0.27)

GIT
remote: https://github.com/gencat/decidim-module-department_admin.git
revision: 602ccc34738762824e464294e74958b26636840d
tag: v0.7.1
specs:
decidim-department_admin (0.7.1)
decidim-admin (~> 0.27.0)
decidim-core (~> 0.27.0)

GIT
remote: https://github.com/gencat/decidim-verifications-members_picker.git
revision: ee3a97421eeab3b21c8a6f8947830a91837ba2b9
tag: 0.0.6
specs:
decidim-verifications-members_picker (0.0.6)
decidim-core (>= 0.27.5)
decidim-verifications (>= 0.27.5)
psych (< 4)

GIT
remote: https://github.com/mainio/decidim-module-term_customizer.git
revision: abbf0c69e1bcaafebc5aa4f8da22fdb64ce62149
Expand Down Expand Up @@ -412,10 +393,17 @@ GEM
decidim (>= 0.27.0)
rails (>= 6)
ruby-progressbar
decidim-department_admin (0.7.2)
decidim-admin (~> 0.27.0)
decidim-core (~> 0.27.0)
decidim-idcat_mobil (0.4.0)
decidim (>= 0.27.0)
decidim-core (>= 0.27.0)
omniauth-idcat_mobil (~> 0.5.0)
decidim-verifications-members_picker (0.0.6.1)
decidim-core (>= 0.27.5)
decidim-verifications (>= 0.27.5)
psych (< 4)
declarative-builder (0.1.0)
declarative-option (< 0.2.0)
declarative-option (0.1.0)
Expand Down Expand Up @@ -937,7 +925,7 @@ DEPENDENCIES
decidim!
decidim-cdtb
decidim-challenges!
decidim-department_admin!
decidim-department_admin (~> 0.7.2)
decidim-dev!
decidim-home!
decidim-idcat_mobil
Expand All @@ -947,7 +935,7 @@ DEPENDENCIES
decidim-templates!
decidim-term_customizer!
decidim-top_comments!
decidim-verifications-members_picker!
decidim-verifications-members_picker (~> 0.0.6.1)
deface
delayed_job_active_record
faker
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# frozen_string_literal: true

module Lib::Decidim::Proposals::ProposalSerializerDecorator
def self.decorate
Decidim::Proposals::ProposalSerializer.class_eval do
alias_method :original_serialize, :serialize

# Add authors to proposal exportation
def serialize
original_serialize.merge({
authors_names: proposal.authors.pluck(:name)
})
end
end
end
end

::Lib::Decidim::Proposals::ProposalSerializerDecorator.decorate
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- insert_before ".main-footer"
original '45e003ac5969458f067be9d4c851c674cbe7f3d3'
original '25277dbf8f6306c2d1703a6fe82abf2be777fc7a'
-->
<section class="footer__subhero extended subhero home-section">
<div class="row">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!-- insert_after 'erb[loud]:root:last-child'
virtual_path 'decidim/debates/debates/show'
original 'cf2dee11f6fad057c3e2910a487b752770fc8329'
original '6f795ebcc7ec98156f02484fd7d1e6db5fc07d75'
-->
<div id="most-voted-comments" class="expanded">
<div class="wrapper wrapper--inner">
Expand Down
13 changes: 12 additions & 1 deletion docs/HOW_TO_UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ These are custom modules and this is what you have to keep in mind when updating

#### 6. Also, there are custom files in the application "participa.gencat.cat".

##### Modified files:
##### Modified files:

With decorator pattern:

Expand All @@ -197,6 +197,17 @@ These are custom modules and this is what you have to keep in mind when updating

* `decorators/decidim/participatory_space_context_decorator.rb`
* Override to allow private space users to acces public view
* probably removable from Decidim v0.24

* `decorators/lib/decidim/proposals/proposal_serializer_decorator.rb`
* Override to export proposal emails and names from authors
* probably removable from Decidim v0.28 (remember remove test too)

* `lib/decidim/has_private_users.rb`
* Override to allow private space users to acces public view
* Could not use a decorator so the whole class has been copied
* Only the `#can_participate?(user)` has been modified
* probably removable from Decidim v0.24

Following ones, for some addings or template overrides:

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# frozen_string_literal: true

require "rails_helper"

# rubocop:disable RSpec/MultipleMemoizedHelpers
module Decidim
module Proposals
describe ProposalSerializer do
subject do
described_class.new(proposal)
end

let!(:proposal) { create(:proposal, :accepted, body: body) }
let!(:category) { create(:category, participatory_space: component.participatory_space) }
let!(:scope) { create(:scope, organization: component.participatory_space.organization) }
let(:participatory_process) { component.participatory_space }
let(:component) { proposal.component }

let!(:meetings_component) { create(:component, manifest_name: "meetings", participatory_space: participatory_process) }
let(:meetings) { create_list(:meeting, 2, :published, component: meetings_component) }

let!(:proposals_component) { create(:component, manifest_name: "proposals", participatory_space: participatory_process) }
let(:other_proposals) { create_list(:proposal, 2, component: proposals_component) }
let(:body) { Decidim::Faker::Localized.localized { ::Faker::Lorem.sentences(number: 3).join("\n") } }

let(:expected_answer) do
answer = proposal.answer
Decidim.available_locales.each_with_object({}) do |locale, result|
result[locale.to_s] = if answer.is_a?(Hash)
answer[locale.to_s] || ""
else
""
end
end
end

before do
proposal.update!(category: category)
proposal.update!(scope: scope)
proposal.link_resources(meetings, "proposals_from_meeting")
proposal.link_resources(other_proposals, "copied_from_component")
end

describe "#serialize" do
let(:serialized) { subject.serialize }

it "serializes the authors names" do
expect(serialized).to include(authors_names: proposal.authors.pluck(:name))
end
end
end
end
end
# rubocop:enable RSpec/MultipleMemoizedHelpers

0 comments on commit d75c47f

Please sign in to comment.