decidim-initiatives 0.28.0 → 0.28.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/decidim/initiatives/admin/committee_requests_controller.rb +1 -1
  3. data/app/events/decidim/initiatives/admin/initiative_sent_to_technical_validation_event.rb +1 -1
  4. data/app/events/decidim/initiatives/approve_membership_request_event.rb +1 -4
  5. data/app/events/decidim/initiatives/initiative_sent_to_technical_validation_event.rb +1 -1
  6. data/app/helpers/decidim/initiatives/initiatives_helper.rb +1 -1
  7. data/app/views/decidim/initiatives/admin/answers/edit.html.erb +2 -2
  8. data/app/views/decidim/initiatives/admin/committee_requests/index.html.erb +2 -2
  9. data/app/views/decidim/initiatives/admin/initiatives/edit.html.erb +2 -2
  10. data/app/views/decidim/initiatives/admin/initiatives/index.html.erb +2 -2
  11. data/app/views/decidim/initiatives/admin/initiatives_settings/edit.html.erb +2 -2
  12. data/app/views/decidim/initiatives/admin/initiatives_type_scopes/edit.html.erb +2 -2
  13. data/app/views/decidim/initiatives/admin/initiatives_type_scopes/new.html.erb +2 -2
  14. data/app/views/decidim/initiatives/admin/initiatives_types/edit.html.erb +2 -2
  15. data/app/views/decidim/initiatives/admin/initiatives_types/index.html.erb +2 -2
  16. data/app/views/decidim/initiatives/admin/initiatives_types/new.html.erb +2 -2
  17. data/app/views/decidim/initiatives/create_initiative/select_initiative_type.html.erb +2 -2
  18. data/app/views/decidim/initiatives/initiatives/_result.html.erb +2 -2
  19. data/app/views/layouts/decidim/admin/initiatives.html.erb +2 -31
  20. data/config/locales/ar.yml +5 -0
  21. data/config/locales/bg.yml +17 -0
  22. data/config/locales/ca.yml +11 -11
  23. data/config/locales/de.yml +6 -6
  24. data/config/locales/el.yml +1 -0
  25. data/config/locales/es.yml +8 -8
  26. data/config/locales/fi-plain.yml +2 -2
  27. data/config/locales/ga-IE.yml +3 -0
  28. data/config/locales/he-IL.yml +7 -0
  29. data/config/locales/hu.yml +4 -0
  30. data/config/locales/is-IS.yml +2 -0
  31. data/config/locales/it.yml +2 -0
  32. data/config/locales/ja.yml +2 -0
  33. data/config/locales/lb.yml +2 -0
  34. data/config/locales/lt.yml +2 -0
  35. data/config/locales/lv.yml +1 -0
  36. data/config/locales/nl.yml +1 -0
  37. data/config/locales/no.yml +2 -0
  38. data/config/locales/pl.yml +57 -0
  39. data/config/locales/pt-BR.yml +27 -2
  40. data/config/locales/pt.yml +2 -0
  41. data/config/locales/ro-RO.yml +2 -0
  42. data/config/locales/ru.yml +1 -0
  43. data/config/locales/sk.yml +1 -0
  44. data/config/locales/sl.yml +2 -0
  45. data/config/locales/sr-CS.yml +5 -0
  46. data/config/locales/sv.yml +2 -0
  47. data/config/locales/tr-TR.yml +1 -0
  48. data/config/locales/uk.yml +1 -0
  49. data/config/locales/zh-TW.yml +2 -0
  50. data/decidim-initiatives.gemspec +43 -0
  51. data/lib/decidim/initiatives/admin_engine.rb +0 -12
  52. data/lib/decidim/initiatives/menu.rb +8 -6
  53. data/lib/decidim/initiatives/test/factories.rb +48 -42
  54. data/lib/decidim/initiatives/version.rb +1 -1
  55. metadata +22 -21
  56. data/config/environment.rb +0 -3
@@ -5,8 +5,11 @@ require "decidim/dev"
5
5
 
6
6
  FactoryBot.define do
7
7
  factory :initiatives_type, class: "Decidim::InitiativesType" do
8
- title { generate_localized_title }
9
- description { Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_title } }
8
+ transient do
9
+ skip_injection { false }
10
+ end
11
+ title { generate_localized_title(:initiatives_type_title, skip_injection:) }
12
+ description { generate_localized_description(:initiatives_type_description, skip_injection:) }
10
13
  organization
11
14
  # Keep banner_image after organization
12
15
  banner_image do
@@ -82,7 +85,7 @@ FactoryBot.define do
82
85
 
83
86
  trait :with_user_extra_fields_collection do
84
87
  collect_user_extra_fields { true }
85
- extra_fields_legal_information { Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_title } }
88
+ extra_fields_legal_information { generate_localized_description(:initiatives_type_extra_fields_legal_information, skip_injection:) }
86
89
  document_number_authorization_handler { "dummy_authorization_handler" }
87
90
  end
88
91
 
@@ -100,12 +103,15 @@ FactoryBot.define do
100
103
  end
101
104
 
102
105
  factory :initiatives_type_scope, class: "Decidim::InitiativesTypeScope" do
103
- type { create(:initiatives_type) }
104
- scope { create(:scope, organization: type.organization) }
106
+ transient do
107
+ skip_injection { false }
108
+ end
109
+ type { create(:initiatives_type, skip_injection:) }
110
+ scope { create(:scope, organization: type.organization, skip_injection:) }
105
111
  supports_required { 1000 }
106
112
 
107
113
  trait :with_user_extra_fields_collection do
108
- type { create(:initiatives_type, :with_user_extra_fields_collection) }
114
+ type { create(:initiatives_type, :with_user_extra_fields_collection, skip_injection:) }
109
115
  end
110
116
  end
111
117
 
@@ -114,24 +120,10 @@ FactoryBot.define do
114
120
  skip_injection { false }
115
121
  end
116
122
 
117
- title do
118
- if skip_injection
119
- Decidim::Faker::Localized.localized { generate(:title) }
120
- else
121
- Decidim::Faker::Localized.localized { "<script>alert(\"Initiative TITLE\")</script> #{generate(:title)}" }
122
- end
123
- end
124
- description do
125
- Decidim::Faker::Localized.wrapped("<p>", "</p>") do
126
- if skip_injection
127
- Decidim::Faker::Localized.localized { generate(:title) }
128
- else
129
- Decidim::Faker::Localized.localized { "<script>alert(\"Meetings description\");</script> #{generate(:title)}" }
130
- end
131
- end
132
- end
123
+ title { generate_localized_title(:initiative_title, skip_injection:) }
124
+ description { generate_localized_description(:initiative_description, skip_injection:) }
133
125
  organization
134
- author { create(:user, :confirmed, organization:) }
126
+ author { create(:user, :confirmed, organization:, skip_injection:) }
135
127
  published_at { Time.current }
136
128
  state { "published" }
137
129
  signature_type { "online" }
@@ -139,15 +131,15 @@ FactoryBot.define do
139
131
  signature_end_date { Date.current + 120.days }
140
132
 
141
133
  scoped_type do
142
- create(:initiatives_type_scope,
143
- type: create(:initiatives_type, organization:, signature_type:))
134
+ create(:initiatives_type_scope, skip_injection:,
135
+ type: create(:initiatives_type, organization:, signature_type:, skip_injection:))
144
136
  end
145
137
 
146
- after(:create) do |initiative|
138
+ after(:create) do |initiative, evaluator|
147
139
  if initiative.author.is_a?(Decidim::User) && Decidim::Authorization.where(user: initiative.author).where.not(granted_at: nil).none?
148
- create(:authorization, user: initiative.author, granted_at: Time.now.utc)
140
+ create(:authorization, user: initiative.author, granted_at: Time.now.utc, skip_injection: evaluator.skip_injection)
149
141
  end
150
- create_list(:initiatives_committee_member, 3, initiative:)
142
+ create_list(:initiatives_committee_member, 3, initiative:, skip_injection: evaluator.skip_injection)
151
143
  end
152
144
 
153
145
  trait :created do
@@ -216,13 +208,13 @@ FactoryBot.define do
216
208
 
217
209
  trait :with_user_extra_fields_collection do
218
210
  scoped_type do
219
- create(:initiatives_type_scope,
220
- type: create(:initiatives_type, :with_user_extra_fields_collection, organization:))
211
+ create(:initiatives_type_scope, skip_injection:,
212
+ type: create(:initiatives_type, :with_user_extra_fields_collection, organization:, skip_injection:))
221
213
  end
222
214
  end
223
215
 
224
216
  trait :with_area do
225
- area { create(:area, organization:) }
217
+ area { create(:area, organization:, skip_injection:) }
226
218
  end
227
219
 
228
220
  trait :with_documents do
@@ -235,7 +227,8 @@ FactoryBot.define do
235
227
  initiative.attachments << create(
236
228
  :attachment,
237
229
  :with_pdf,
238
- attached_to: initiative
230
+ attached_to: initiative,
231
+ skip_injection: evaluator.skip_injection
239
232
  )
240
233
  end
241
234
  end
@@ -251,7 +244,8 @@ FactoryBot.define do
251
244
  initiative.attachments << create(
252
245
  :attachment,
253
246
  :with_image,
254
- attached_to: initiative
247
+ attached_to: initiative,
248
+ skip_injection: evaluator.skip_injection
255
249
  )
256
250
  end
257
251
  end
@@ -259,8 +253,11 @@ FactoryBot.define do
259
253
  end
260
254
 
261
255
  factory :initiative_user_vote, class: "Decidim::InitiativesVote" do
262
- initiative { create(:initiative) }
263
- author { create(:user, :confirmed, organization: initiative.organization) }
256
+ transient do
257
+ skip_injection { false }
258
+ end
259
+ initiative { create(:initiative, skip_injection:) }
260
+ author { create(:user, :confirmed, organization: initiative.organization, skip_injection:) }
264
261
  hash_id { SecureRandom.uuid }
265
262
  scope { initiative.scope }
266
263
  after(:create) do |vote|
@@ -269,17 +266,23 @@ FactoryBot.define do
269
266
  end
270
267
 
271
268
  factory :organization_user_vote, class: "Decidim::InitiativesVote" do
272
- initiative { create(:initiative) }
273
- author { create(:user, :confirmed, organization: initiative.organization) }
274
- decidim_user_group_id { create(:user_group).id }
275
- after(:create) do |support|
276
- create(:user_group_membership, user: support.author, user_group: Decidim::UserGroup.find(support.decidim_user_group_id))
269
+ transient do
270
+ skip_injection { false }
271
+ end
272
+ initiative { create(:initiative, skip_injection:) }
273
+ author { create(:user, :confirmed, organization: initiative.organization, skip_injection:) }
274
+ decidim_user_group_id { create(:user_group, skip_injection:).id }
275
+ after(:create) do |support, evaluator|
276
+ create(:user_group_membership, user: support.author, user_group: Decidim::UserGroup.find(support.decidim_user_group_id), skip_injection: evaluator.skip_injection)
277
277
  end
278
278
  end
279
279
 
280
280
  factory :initiatives_committee_member, class: "Decidim::InitiativesCommitteeMember" do
281
- initiative { create(:initiative) }
282
- user { create(:user, :confirmed, organization: initiative.organization) }
281
+ transient do
282
+ skip_injection { false }
283
+ end
284
+ initiative { create(:initiative, skip_injection:) }
285
+ user { create(:user, :confirmed, organization: initiative.organization, skip_injection:) }
283
286
  state { "accepted" }
284
287
 
285
288
  trait :accepted do
@@ -296,6 +299,9 @@ FactoryBot.define do
296
299
  end
297
300
 
298
301
  factory :initiatives_settings, class: "Decidim::InitiativesSettings" do
302
+ transient do
303
+ skip_injection { false }
304
+ end
299
305
  initiatives_order { "random" }
300
306
  organization
301
307
 
@@ -4,7 +4,7 @@ module Decidim
4
4
  # This holds the decidim-initiatives version.
5
5
  module Initiatives
6
6
  def self.version
7
- "0.28.0"
7
+ "0.28.1"
8
8
  end
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-initiatives
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.28.0
4
+ version: 0.28.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Salvador Perez Garcia
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-20 00:00:00.000000000 Z
11
+ date: 2024-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: decidim-admin
@@ -16,56 +16,56 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.28.0
19
+ version: 0.28.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.28.0
26
+ version: 0.28.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: decidim-comments
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 0.28.0
33
+ version: 0.28.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 0.28.0
40
+ version: 0.28.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: decidim-core
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: 0.28.0
47
+ version: 0.28.1
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: 0.28.0
54
+ version: 0.28.1
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: decidim-verifications
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 0.28.0
61
+ version: 0.28.1
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: 0.28.0
68
+ version: 0.28.1
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: hexapdf
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -114,28 +114,28 @@ dependencies:
114
114
  requirements:
115
115
  - - '='
116
116
  - !ruby/object:Gem::Version
117
- version: 0.28.0
117
+ version: 0.28.1
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - '='
123
123
  - !ruby/object:Gem::Version
124
- version: 0.28.0
124
+ version: 0.28.1
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: decidim-meetings
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - '='
130
130
  - !ruby/object:Gem::Version
131
- version: 0.28.0
131
+ version: 0.28.1
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - '='
137
137
  - !ruby/object:Gem::Version
138
- version: 0.28.0
138
+ version: 0.28.1
139
139
  description: Participants initiatives plugin for decidim.
140
140
  email:
141
141
  - jsperezg@gmail.com
@@ -367,7 +367,6 @@ files:
367
367
  - app/views/layouts/decidim/initiative_head.html.erb
368
368
  - app/views/layouts/decidim/initiative_signature_creation.html.erb
369
369
  - config/assets.rb
370
- - config/environment.rb
371
370
  - config/initializers/wicked_pdf.rb
372
371
  - config/locales/am-ET.yml
373
372
  - config/locales/ar-SA.yml
@@ -401,6 +400,7 @@ files:
401
400
  - config/locales/ga-IE.yml
402
401
  - config/locales/gl.yml
403
402
  - config/locales/gn-PY.yml
403
+ - config/locales/he-IL.yml
404
404
  - config/locales/hr-HR.yml
405
405
  - config/locales/hr.yml
406
406
  - config/locales/hu.yml
@@ -507,6 +507,7 @@ files:
507
507
  - db/migrate/20210310120720_add_followable_counter_cache_to_initiatives.rb
508
508
  - db/migrate/20220518053612_add_comments_enabled_to_initiative_types.rb
509
509
  - db/migrate/20220527130640_create_decidim_initiatives_settings.rb
510
+ - decidim-initiatives.gemspec
510
511
  - lib/decidim/api/initiative_api_type.rb
511
512
  - lib/decidim/api/initiative_committee_member_type.rb
512
513
  - lib/decidim/api/initiative_type.rb
@@ -536,23 +537,23 @@ metadata:
536
537
  funding_uri: https://opencollective.com/decidim
537
538
  homepage_uri: https://decidim.org
538
539
  source_code_uri: https://github.com/decidim/decidim
539
- post_install_message:
540
+ post_install_message:
540
541
  rdoc_options: []
541
542
  require_paths:
542
543
  - lib
543
544
  required_ruby_version: !ruby/object:Gem::Requirement
544
545
  requirements:
545
- - - ">="
546
+ - - "~>"
546
547
  - !ruby/object:Gem::Version
547
- version: '3.1'
548
+ version: 3.1.0
548
549
  required_rubygems_version: !ruby/object:Gem::Requirement
549
550
  requirements:
550
551
  - - ">="
551
552
  - !ruby/object:Gem::Version
552
553
  version: '0'
553
554
  requirements: []
554
- rubygems_version: 3.4.22
555
- signing_key:
555
+ rubygems_version: 3.5.9
556
+ signing_key:
556
557
  specification_version: 4
557
558
  summary: Decidim initiatives module
558
559
  test_files: []
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Empty line for playing nice with tpope/vim-rails