decidim-proposals 0.27.2 → 0.27.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/proposals/collaborative_draft_m_cell.rb +1 -1
  3. data/app/commands/decidim/proposals/admin/notify_proposal_answer.rb +2 -0
  4. data/app/helpers/decidim/proposals/application_helper.rb +7 -1
  5. data/app/helpers/decidim/proposals/proposals_helper.rb +1 -1
  6. data/app/views/decidim/proposals/admin/participatory_texts/_article-preview.html.erb +2 -2
  7. data/app/views/decidim/proposals/admin/participatory_texts/new_import.html.erb +1 -1
  8. data/app/views/decidim/proposals/collaborative_drafts/_edit_form_fields.html.erb +1 -1
  9. data/app/views/decidim/proposals/collaborative_drafts/show.html.erb +1 -1
  10. data/app/views/decidim/proposals/proposals/_linked_proposals.html.erb +2 -1
  11. data/config/locales/ar.yml +265 -0
  12. data/config/locales/ca.yml +2 -2
  13. data/config/locales/es-MX.yml +1 -1
  14. data/config/locales/es-PY.yml +1 -1
  15. data/config/locales/es.yml +2 -2
  16. data/config/locales/eu.yml +108 -96
  17. data/config/locales/fa-IR.yml +1 -0
  18. data/config/locales/fi.yml +4 -4
  19. data/config/locales/hu.yml +1 -1
  20. data/config/locales/is-IS.yml +0 -1
  21. data/config/locales/ja.yml +13 -13
  22. data/config/locales/kaa.yml +1 -0
  23. data/config/locales/nl.yml +1 -1
  24. data/config/locales/pt-BR.yml +1 -1
  25. data/config/locales/pt.yml +1 -1
  26. data/config/locales/ru.yml +0 -1
  27. data/config/locales/uk.yml +0 -1
  28. data/config/locales/zh-TW.yml +969 -0
  29. data/lib/decidim/proposals/component.rb +7 -6
  30. data/lib/decidim/proposals/import/proposal_answer_creator.rb +10 -4
  31. data/lib/decidim/proposals/proposal_serializer.rb +9 -1
  32. data/lib/decidim/proposals/version.rb +1 -1
  33. metadata +21 -19
@@ -28,19 +28,19 @@ Decidim.register_component(:proposals) do |component|
28
28
  component.settings(:global) do |settings|
29
29
  settings.attribute :scopes_enabled, type: :boolean, default: false
30
30
  settings.attribute :scope_id, type: :scope
31
- settings.attribute :vote_limit, type: :integer, default: 0
32
- settings.attribute :minimum_votes_per_user, type: :integer, default: 0
33
- settings.attribute :proposal_limit, type: :integer, default: 0
31
+ settings.attribute :vote_limit, type: :integer, default: 0, required: true
32
+ settings.attribute :minimum_votes_per_user, type: :integer, default: 0, required: true
33
+ settings.attribute :proposal_limit, type: :integer, default: 0, required: true
34
34
  settings.attribute :proposal_length, type: :integer, default: 500
35
35
  settings.attribute :proposal_edit_time, type: :enum, default: "limited", choices: -> { %w(limited infinite) }
36
- settings.attribute :proposal_edit_before_minutes, type: :integer, default: 5
37
- settings.attribute :threshold_per_proposal, type: :integer, default: 0
36
+ settings.attribute :proposal_edit_before_minutes, type: :integer, default: 5, required: true
37
+ settings.attribute :threshold_per_proposal, type: :integer, default: 0, required: true
38
38
  settings.attribute :can_accumulate_supports_beyond_threshold, type: :boolean, default: false
39
39
  settings.attribute :proposal_answering_enabled, type: :boolean, default: true
40
40
  settings.attribute :default_sort_order, type: :select, default: "default", choices: -> { POSSIBLE_SORT_ORDERS }
41
41
  settings.attribute :official_proposals_enabled, type: :boolean, default: true
42
42
  settings.attribute :comments_enabled, type: :boolean, default: true
43
- settings.attribute :comments_max_length, type: :integer, required: false
43
+ settings.attribute :comments_max_length, type: :integer, required: true
44
44
  settings.attribute :geocoding_enabled, type: :boolean, default: false
45
45
  settings.attribute :attachments_allowed, type: :boolean, default: false
46
46
  settings.attribute :resources_permissions_enabled, type: :boolean, default: true
@@ -131,6 +131,7 @@ Decidim.register_component(:proposals) do |component|
131
131
 
132
132
  collection = Decidim::Proposals::Proposal
133
133
  .published
134
+ .not_hidden
134
135
  .where(component: component_instance)
135
136
  .includes(:scope, :category, :component)
136
137
 
@@ -32,13 +32,16 @@ module Decidim
32
32
  resource,
33
33
  current_user
34
34
  ) do
35
- resource.save!
35
+ resource.try(:save!)
36
36
  end
37
- notify(resource)
37
+
38
+ notify
38
39
  end
39
40
 
40
41
  private
41
42
 
43
+ attr_reader :initial_state
44
+
42
45
  def resource
43
46
  @resource ||= fetch_resource
44
47
  end
@@ -55,6 +58,8 @@ module Decidim
55
58
 
56
59
  proposal.answer = answer
57
60
  proposal.answered_at = Time.current
61
+ @initial_state = proposal.state
62
+
58
63
  if POSSIBLE_ANSWER_STATES.include?(state)
59
64
  proposal.state = state
60
65
  proposal.state_published_at = Time.current if component.current_settings.publish_answers_immediately?
@@ -88,8 +93,9 @@ module Decidim
88
93
  context[:current_user]
89
94
  end
90
95
 
91
- def notify(proposal)
92
- ::Decidim::Proposals::Admin::NotifyProposalAnswer.call(proposal, proposal.state)
96
+ def notify
97
+ state = initial_state || resource.try(:state)
98
+ ::Decidim::Proposals::Admin::NotifyProposalAnswer.call(resource, state)
93
99
  end
94
100
  end
95
101
  end
@@ -8,6 +8,7 @@ module Decidim
8
8
  include Decidim::ApplicationHelper
9
9
  include Decidim::ResourceHelper
10
10
  include Decidim::TranslationsHelper
11
+ include HtmlToPlainText
11
12
 
12
13
  # Public: Initializes the serializer with a proposal.
13
14
  def initialize(proposal)
@@ -32,7 +33,7 @@ module Decidim
32
33
  },
33
34
  component: { id: component.id },
34
35
  title: proposal.title,
35
- body: proposal.body,
36
+ body: convert_to_plain_text(proposal.body),
36
37
  address: proposal.address,
37
38
  latitude: proposal.latitude,
38
39
  longitude: proposal.longitude,
@@ -93,6 +94,13 @@ module Decidim
93
94
 
94
95
  Decidim::ResourceLocatorPresenter.new(proposal.amendable).url
95
96
  end
97
+
98
+ # Recursively strips HTML tags from given Hash strings using convert_to_text from Premailer
99
+ def convert_to_plain_text(value)
100
+ return value.transform_values { |v| convert_to_plain_text(v) } if value.is_a?(Hash)
101
+
102
+ convert_to_text(value)
103
+ end
96
104
  end
97
105
  end
98
106
  end
@@ -4,7 +4,7 @@ module Decidim
4
4
  # This holds decidim-proposals version.
5
5
  module Proposals
6
6
  def self.version
7
- "0.27.2"
7
+ "0.27.3"
8
8
  end
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-proposals
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.27.2
4
+ version: 0.27.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josep Jaume Rey Peroy
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2023-02-13 00:00:00.000000000 Z
13
+ date: 2023-05-11 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: decidim-comments
@@ -18,28 +18,28 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 0.27.2
21
+ version: 0.27.3
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - '='
27
27
  - !ruby/object:Gem::Version
28
- version: 0.27.2
28
+ version: 0.27.3
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: decidim-core
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
33
  - - '='
34
34
  - !ruby/object:Gem::Version
35
- version: 0.27.2
35
+ version: 0.27.3
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - '='
41
41
  - !ruby/object:Gem::Version
42
- version: 0.27.2
42
+ version: 0.27.3
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: doc2text
45
45
  requirement: !ruby/object:Gem::Requirement
@@ -80,84 +80,84 @@ dependencies:
80
80
  requirements:
81
81
  - - '='
82
82
  - !ruby/object:Gem::Version
83
- version: 0.27.2
83
+ version: 0.27.3
84
84
  type: :development
85
85
  prerelease: false
86
86
  version_requirements: !ruby/object:Gem::Requirement
87
87
  requirements:
88
88
  - - '='
89
89
  - !ruby/object:Gem::Version
90
- version: 0.27.2
90
+ version: 0.27.3
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: decidim-assemblies
93
93
  requirement: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - '='
96
96
  - !ruby/object:Gem::Version
97
- version: 0.27.2
97
+ version: 0.27.3
98
98
  type: :development
99
99
  prerelease: false
100
100
  version_requirements: !ruby/object:Gem::Requirement
101
101
  requirements:
102
102
  - - '='
103
103
  - !ruby/object:Gem::Version
104
- version: 0.27.2
104
+ version: 0.27.3
105
105
  - !ruby/object:Gem::Dependency
106
106
  name: decidim-budgets
107
107
  requirement: !ruby/object:Gem::Requirement
108
108
  requirements:
109
109
  - - '='
110
110
  - !ruby/object:Gem::Version
111
- version: 0.27.2
111
+ version: 0.27.3
112
112
  type: :development
113
113
  prerelease: false
114
114
  version_requirements: !ruby/object:Gem::Requirement
115
115
  requirements:
116
116
  - - '='
117
117
  - !ruby/object:Gem::Version
118
- version: 0.27.2
118
+ version: 0.27.3
119
119
  - !ruby/object:Gem::Dependency
120
120
  name: decidim-dev
121
121
  requirement: !ruby/object:Gem::Requirement
122
122
  requirements:
123
123
  - - '='
124
124
  - !ruby/object:Gem::Version
125
- version: 0.27.2
125
+ version: 0.27.3
126
126
  type: :development
127
127
  prerelease: false
128
128
  version_requirements: !ruby/object:Gem::Requirement
129
129
  requirements:
130
130
  - - '='
131
131
  - !ruby/object:Gem::Version
132
- version: 0.27.2
132
+ version: 0.27.3
133
133
  - !ruby/object:Gem::Dependency
134
134
  name: decidim-meetings
135
135
  requirement: !ruby/object:Gem::Requirement
136
136
  requirements:
137
137
  - - '='
138
138
  - !ruby/object:Gem::Version
139
- version: 0.27.2
139
+ version: 0.27.3
140
140
  type: :development
141
141
  prerelease: false
142
142
  version_requirements: !ruby/object:Gem::Requirement
143
143
  requirements:
144
144
  - - '='
145
145
  - !ruby/object:Gem::Version
146
- version: 0.27.2
146
+ version: 0.27.3
147
147
  - !ruby/object:Gem::Dependency
148
148
  name: decidim-participatory_processes
149
149
  requirement: !ruby/object:Gem::Requirement
150
150
  requirements:
151
151
  - - '='
152
152
  - !ruby/object:Gem::Version
153
- version: 0.27.2
153
+ version: 0.27.3
154
154
  type: :development
155
155
  prerelease: false
156
156
  version_requirements: !ruby/object:Gem::Requirement
157
157
  requirements:
158
158
  - - '='
159
159
  - !ruby/object:Gem::Version
160
- version: 0.27.2
160
+ version: 0.27.3
161
161
  description: A proposals component for decidim's participatory spaces.
162
162
  email:
163
163
  - josepjaume@gmail.com
@@ -466,6 +466,7 @@ files:
466
466
  - config/locales/et-EE.yml
467
467
  - config/locales/et.yml
468
468
  - config/locales/eu.yml
469
+ - config/locales/fa-IR.yml
469
470
  - config/locales/fi-pl.yml
470
471
  - config/locales/fi-plain.yml
471
472
  - config/locales/fi.yml
@@ -484,6 +485,7 @@ files:
484
485
  - config/locales/it.yml
485
486
  - config/locales/ja.yml
486
487
  - config/locales/ka-GE.yml
488
+ - config/locales/kaa.yml
487
489
  - config/locales/ko-KR.yml
488
490
  - config/locales/ko.yml
489
491
  - config/locales/lb-LU.yml
@@ -621,7 +623,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
621
623
  - !ruby/object:Gem::Version
622
624
  version: '0'
623
625
  requirements: []
624
- rubygems_version: 3.3.7
626
+ rubygems_version: 3.2.22
625
627
  signing_key:
626
628
  specification_version: 4
627
629
  summary: Decidim proposals module