decidim-generators 0.29.1 → 0.30.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -5
- data/Gemfile.lock +318 -287
- data/decidim-generators.gemspec +2 -2
- data/lib/decidim/generators/app_generator.rb +15 -6
- data/lib/decidim/generators/app_templates/.ruby-version +1 -1
- data/lib/decidim/generators/app_templates/ai_initializer.rb +111 -0
- data/lib/decidim/generators/app_templates/dummy_authorization_handler.rb +4 -63
- data/lib/decidim/generators/app_templates/ephemeral_dummy_authorization_handler.rb +9 -0
- data/lib/decidim/generators/app_templates/initializer.rb +1 -0
- data/lib/decidim/generators/app_templates/secrets.yml.erb +9 -8
- data/lib/decidim/generators/app_templates/sidekiq.yml.erb +1 -0
- data/lib/decidim/generators/app_templates/verifications_initializer.rb +13 -1
- data/lib/decidim/generators/component_templates/.ruby-version +1 -1
- data/lib/decidim/generators/component_templates/Gemfile.erb +2 -2
- data/lib/decidim/generators/component_templates/decidim-component.gemspec.erb +1 -1
- data/lib/decidim/generators/component_templates/github/ci.yml.erb +1 -1
- data/lib/decidim/generators/component_templates/package.json.erb +1 -1
- data/lib/decidim/generators/test/generator_examples.rb +8 -6
- data/lib/decidim/generators/version.rb +1 -1
- metadata +9 -7
data/decidim-generators.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.version = Decidim::Generators.version
|
10
10
|
s.authors = ["Josep Jaume Rey Peroy", "Marc Riera Casals", "Oriol Gual Oliva"]
|
11
11
|
s.email = ["josepjaume@gmail.com", "mrc2407@gmail.com", "oriolgual@gmail.com"]
|
12
|
-
s.license = "AGPL-3.0"
|
12
|
+
s.license = "AGPL-3.0-or-later"
|
13
13
|
s.homepage = "https://decidim.org"
|
14
14
|
s.metadata = {
|
15
15
|
"bug_tracker_uri" => "https://github.com/decidim/decidim/issues",
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
|
|
18
18
|
"homepage_uri" => "https://decidim.org",
|
19
19
|
"source_code_uri" => "https://github.com/decidim/decidim"
|
20
20
|
}
|
21
|
-
s.required_ruby_version = "~> 3.
|
21
|
+
s.required_ruby_version = "~> 3.3.0"
|
22
22
|
|
23
23
|
s.name = "decidim-generators"
|
24
24
|
|
@@ -166,9 +166,9 @@ module Decidim
|
|
166
166
|
|
167
167
|
if branch.present?
|
168
168
|
get target_gemfile, "Gemfile", force: true
|
169
|
-
append_file "Gemfile", %(\ngem "net-imap", "~> 0.
|
169
|
+
append_file "Gemfile", %(\ngem "net-imap", "~> 0.5.0", group: :development)
|
170
170
|
append_file "Gemfile", %(\ngem "net-pop", "~> 0.1.1", group: :development)
|
171
|
-
append_file "Gemfile", %(\ngem "net-smtp", "~> 0.
|
171
|
+
append_file "Gemfile", %(\ngem "net-smtp", "~> 0.5.0", group: :development)
|
172
172
|
get "#{target_gemfile}.lock", "Gemfile.lock", force: true
|
173
173
|
else
|
174
174
|
copy_file target_gemfile, "Gemfile", force: true
|
@@ -181,7 +181,7 @@ module Decidim
|
|
181
181
|
|
182
182
|
gsub_file "Gemfile", /gem "decidim-dev".*/, "gem \"decidim-dev\", #{gem_modifier}"
|
183
183
|
|
184
|
-
%w(conferences design initiatives templates).each do |component|
|
184
|
+
%w(ai conferences design initiatives templates).each do |component|
|
185
185
|
if options[:demo]
|
186
186
|
gsub_file "Gemfile", /gem "decidim-#{component}".*/, "gem \"decidim-#{component}\", #{gem_modifier}"
|
187
187
|
else
|
@@ -216,20 +216,22 @@ module Decidim
|
|
216
216
|
|
217
217
|
template "sidekiq.yml.erb", "config/sidekiq.yml", force: true
|
218
218
|
|
219
|
+
gsub_file "config/environments/development.rb",
|
220
|
+
/Rails.application.configure do/,
|
221
|
+
"Rails.application.configure do\n config.active_job.queue_adapter = :sidekiq\n"
|
219
222
|
gsub_file "config/environments/production.rb",
|
220
223
|
/# config.active_job.queue_adapter = :resque/,
|
221
224
|
"config.active_job.queue_adapter = ENV['QUEUE_ADAPTER'] if ENV['QUEUE_ADAPTER'].present?"
|
222
225
|
|
223
226
|
prepend_file "config/routes.rb", "require \"sidekiq/web\"\n\n"
|
227
|
+
|
224
228
|
route <<~RUBY
|
225
229
|
authenticate :user, ->(u) { u.admin? } do
|
226
230
|
mount Sidekiq::Web => "/sidekiq"
|
227
231
|
end
|
228
232
|
RUBY
|
229
233
|
|
230
|
-
|
231
|
-
gem "sidekiq"
|
232
|
-
end
|
234
|
+
append_file "Gemfile", %(gem "sidekiq")
|
233
235
|
end
|
234
236
|
|
235
237
|
def add_production_gems(&block)
|
@@ -363,6 +365,7 @@ module Decidim
|
|
363
365
|
return unless options[:demo]
|
364
366
|
|
365
367
|
copy_file "dummy_authorization_handler.rb", "app/services/dummy_authorization_handler.rb"
|
368
|
+
copy_file "ephemeral_dummy_authorization_handler.rb", "app/services/ephemeral_dummy_authorization_handler.rb"
|
366
369
|
copy_file "another_dummy_authorization_handler.rb", "app/services/another_dummy_authorization_handler.rb"
|
367
370
|
copy_file "verifications_initializer.rb", "config/initializers/decidim_verifications.rb"
|
368
371
|
end
|
@@ -384,6 +387,12 @@ module Decidim
|
|
384
387
|
copy_file "budgets_initializer.rb", "config/initializers/decidim_budgets.rb"
|
385
388
|
end
|
386
389
|
|
390
|
+
def ai_toolkit
|
391
|
+
return unless options[:demo]
|
392
|
+
|
393
|
+
copy_file "ai_initializer.rb", "config/initializers/decidim_ai.rb"
|
394
|
+
end
|
395
|
+
|
387
396
|
def timestamp_service
|
388
397
|
return unless options[:demo]
|
389
398
|
|
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.3.4
|
@@ -0,0 +1,111 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
if Decidim.module_installed?(:ai)
|
4
|
+
Decidim::Ai::Language.formatter = "Decidim::Ai::Language::Formatter"
|
5
|
+
|
6
|
+
Decidim::Ai::SpamDetection.reporting_user_email = "your-admin@example.org"
|
7
|
+
|
8
|
+
Decidim::Ai::SpamDetection.resource_score_threshold = 0.75 # default
|
9
|
+
|
10
|
+
# The entry must be a hash with the following keys:
|
11
|
+
# - name: the name of the analyzer
|
12
|
+
# - strategy: the class of the strategy to use
|
13
|
+
# - options: a hash with the options to pass to the strategy
|
14
|
+
# Example:
|
15
|
+
# Decidim::Ai::SpamDetection.resource_analyzers = [
|
16
|
+
# {
|
17
|
+
# name: :bayes,
|
18
|
+
# strategy: Decidim::Ai::SpamContent::BayesStrategy,
|
19
|
+
# options: {
|
20
|
+
# adapter: :redis,
|
21
|
+
# params: {
|
22
|
+
# url: lambda { ENV["REDIS_URL"] }
|
23
|
+
# scheme: "redis"
|
24
|
+
# host: "127.0.0.1"
|
25
|
+
# port: 6379
|
26
|
+
# path: nil
|
27
|
+
# timeout: 5.0
|
28
|
+
# password: nil
|
29
|
+
# db: 0
|
30
|
+
# driver: nil
|
31
|
+
# id: nil
|
32
|
+
# tcp_keepalive: 0
|
33
|
+
# reconnect_attempts: 1
|
34
|
+
# inherit_socket: false
|
35
|
+
# }
|
36
|
+
# }
|
37
|
+
# }
|
38
|
+
# ]
|
39
|
+
Decidim::Ai::SpamDetection.resource_analyzers = [
|
40
|
+
{
|
41
|
+
name: :bayes,
|
42
|
+
strategy: Decidim::Ai::SpamDetection::Strategy::Bayes,
|
43
|
+
options: {
|
44
|
+
adapter: ENV.fetch("DECIDIM_SPAM_DETECTION_BACKEND_RESOURCE", "redis"),
|
45
|
+
params: { url: ENV.fetch("DECIDIM_SPAM_DETECTION_BACKEND_RESOURCE_REDIS_URL", "redis://localhost:6379/2") }
|
46
|
+
}
|
47
|
+
}
|
48
|
+
]
|
49
|
+
|
50
|
+
# If you want to use a different spam detection service, you can define your own service.
|
51
|
+
# Refer to documentation for more details.
|
52
|
+
#
|
53
|
+
Decidim::Ai::SpamDetection.resource_detection_service = "Decidim::Ai::SpamDetection::Service"
|
54
|
+
|
55
|
+
# Customize here what are the analyzed models. You may want to use this to
|
56
|
+
# override what we register by default, or to register your own resources.
|
57
|
+
# Follow the documentation on how to trail more resources
|
58
|
+
Decidim::Ai::SpamDetection.resource_models = begin
|
59
|
+
models = {}
|
60
|
+
models["Decidim::Comments::Comment"] = "Decidim::Ai::SpamDetection::Resource::Comment" if Decidim.module_installed?("comments")
|
61
|
+
models["Decidim::Debates::Debate"] = "Decidim::Ai::SpamDetection::Resource::Debate" if Decidim.module_installed?("debates")
|
62
|
+
models["Decidim::Initiative"] = "Decidim::Ai::SpamDetection::Resource::Initiative" if Decidim.module_installed?("initiatives")
|
63
|
+
models["Decidim::Meetings::Meeting"] = "Decidim::Ai::SpamDetection::Resource::Meeting" if Decidim.module_installed?("meetings")
|
64
|
+
models["Decidim::Proposals::Proposal"] = "Decidim::Ai::SpamDetection::Resource::Proposal" if Decidim.module_installed?("proposals")
|
65
|
+
models["Decidim::Proposals::CollaborativeDraft"] = "Decidim::Ai::SpamDetection::Resource::CollaborativeDraft" if Decidim.module_installed?("proposals")
|
66
|
+
models
|
67
|
+
end
|
68
|
+
|
69
|
+
Decidim::Ai::SpamDetection.user_score_threshold = 0.75 # default
|
70
|
+
|
71
|
+
# The entry must be a hash with the following keys:
|
72
|
+
# - name: the name of the analyzer
|
73
|
+
# - strategy: the class of the strategy to use
|
74
|
+
# - options: a hash with the options to pass to the strategy
|
75
|
+
# Example:
|
76
|
+
# Decidim::Ai::SpamDetection.user_analyzers = [
|
77
|
+
# {
|
78
|
+
# name: :bayes,
|
79
|
+
# strategy: Decidim::Ai::SpamContent::BayesStrategy,
|
80
|
+
# options: {
|
81
|
+
# adapter: :redis,
|
82
|
+
# params: {
|
83
|
+
# url: lambda { ENV["REDIS_URL"] }
|
84
|
+
# }
|
85
|
+
# }
|
86
|
+
# }
|
87
|
+
# ]
|
88
|
+
Decidim::Ai::SpamDetection.user_analyzers = [
|
89
|
+
{
|
90
|
+
name: :bayes,
|
91
|
+
strategy: Decidim::Ai::SpamDetection::Strategy::Bayes,
|
92
|
+
options: {
|
93
|
+
adapter: ENV.fetch("DECIDIM_SPAM_DETECTION_BACKEND_USER", "redis"),
|
94
|
+
params: { url: ENV.fetch("DECIDIM_SPAM_DETECTION_BACKEND_USER_REDIS_URL", "redis://localhost:6379/3") }
|
95
|
+
}
|
96
|
+
}
|
97
|
+
]
|
98
|
+
|
99
|
+
# Customize here what are the analyzed models. You may want to use this to
|
100
|
+
# override what we register by default, or to register your own resources.
|
101
|
+
# Follow the documentation on how to trail more resources
|
102
|
+
Decidim::Ai::SpamDetection.user_models = {
|
103
|
+
"Decidim::UserGroup" => "Decidim::Ai::SpamDetection::Resource::UserBaseEntity",
|
104
|
+
"Decidim::User" => "Decidim::Ai::SpamDetection::Resource::UserBaseEntity"
|
105
|
+
}
|
106
|
+
|
107
|
+
# If you want to use a different spam detection service, you can define your own service.
|
108
|
+
# Refer to documentation for more details.
|
109
|
+
#
|
110
|
+
Decidim::Ai::SpamDetection.user_detection_service = "Decidim::Ai::SpamDetection::Service"
|
111
|
+
end
|
@@ -27,7 +27,6 @@ class DummyAuthorizationHandler < Decidim::AuthorizationHandler
|
|
27
27
|
attribute :document_number, String
|
28
28
|
attribute :postal_code, String
|
29
29
|
attribute :birthday, Decidim::Attributes::LocalizedDate
|
30
|
-
attribute :scope_id, Integer
|
31
30
|
|
32
31
|
# You can (and should) also define validations on each attribute:
|
33
32
|
#
|
@@ -36,7 +35,6 @@ class DummyAuthorizationHandler < Decidim::AuthorizationHandler
|
|
36
35
|
# You can also define custom validations:
|
37
36
|
#
|
38
37
|
validate :valid_document_number
|
39
|
-
validate :valid_scope_id
|
40
38
|
|
41
39
|
# The only method that needs to be implemented for an authorization handler.
|
42
40
|
# Here you can add your business logic to check if the authorization should
|
@@ -56,12 +54,6 @@ class DummyAuthorizationHandler < Decidim::AuthorizationHandler
|
|
56
54
|
document_number
|
57
55
|
end
|
58
56
|
|
59
|
-
# The user scope
|
60
|
-
#
|
61
|
-
def scope
|
62
|
-
user.organization.scopes.find_by(id: scope_id) if scope_id
|
63
|
-
end
|
64
|
-
|
65
57
|
# If you need to store any of the defined attributes in the authorization you
|
66
58
|
# can do it here.
|
67
59
|
#
|
@@ -69,7 +61,7 @@ class DummyAuthorizationHandler < Decidim::AuthorizationHandler
|
|
69
61
|
# it is created, and available though authorization.metadata
|
70
62
|
#
|
71
63
|
def metadata
|
72
|
-
super.merge(document_number:, postal_code
|
64
|
+
super.merge(document_number:, postal_code:)
|
73
65
|
end
|
74
66
|
|
75
67
|
private
|
@@ -78,21 +70,16 @@ class DummyAuthorizationHandler < Decidim::AuthorizationHandler
|
|
78
70
|
errors.add(:document_number, :invalid) unless document_number.to_s.end_with?("X")
|
79
71
|
end
|
80
72
|
|
81
|
-
def valid_scope_id
|
82
|
-
errors.add(:scope_id, :invalid) if scope_id && !scope
|
83
|
-
end
|
84
|
-
|
85
73
|
# If you need custom authorization logic, you can implement your own action
|
86
74
|
# authorizer. In this case, it allows to set a list of valid postal codes for
|
87
75
|
# an authorization.
|
88
76
|
class DummyActionAuthorizer < Decidim::Verifications::DefaultActionAuthorizer
|
89
|
-
attr_reader :allowed_postal_codes
|
77
|
+
attr_reader :allowed_postal_codes
|
90
78
|
|
91
79
|
# Overrides the parent class method, but it still uses it to keep the base behavior
|
92
80
|
def authorize
|
93
81
|
# Remove the additional setting from the options hash to avoid to be considered missing.
|
94
82
|
@allowed_postal_codes ||= options.delete("allowed_postal_codes")&.split(/[\W,;]+/)
|
95
|
-
@allowed_scope_id ||= options.delete("allowed_scope_id")&.to_i
|
96
83
|
|
97
84
|
status_code, data = *super
|
98
85
|
|
@@ -118,62 +105,18 @@ class DummyAuthorizationHandler < Decidim::AuthorizationHandler
|
|
118
105
|
end
|
119
106
|
end
|
120
107
|
|
121
|
-
if allowed_scope.present?
|
122
|
-
# Does not authorize users with different scope
|
123
|
-
status_code = :unauthorized if status_code == :ok && disallowed_user_user_scope
|
124
|
-
|
125
|
-
# Adds an extra message to inform the user about additional restrictions for this authorization
|
126
|
-
if disallowed_user_user_scope
|
127
|
-
if user_scope_id
|
128
|
-
i18n_scope_key = "extra_explanation.user_scope"
|
129
|
-
user_scope_params = { user_scope_name: }
|
130
|
-
else
|
131
|
-
i18n_scope_key = "extra_explanation.scope"
|
132
|
-
user_scope_params = {}
|
133
|
-
end
|
134
|
-
|
135
|
-
extra_explanations << { key: i18n_scope_key,
|
136
|
-
params: { scope: "decidim.verifications.dummy_authorization",
|
137
|
-
scope_name: allowed_scope.name[I18n.locale.to_s] }.merge(user_scope_params) }
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
108
|
data[:extra_explanation] = extra_explanations if extra_explanations.any?
|
142
109
|
|
143
110
|
[status_code, data]
|
144
111
|
end
|
145
112
|
|
146
|
-
# Adds the list of allowed postal codes
|
113
|
+
# Adds the list of allowed postal codes to the redirect URL, to allow forms to inform about it
|
147
114
|
def redirect_params
|
148
|
-
{ postal_codes: allowed_postal_codes&.join(",")
|
115
|
+
{ postal_codes: allowed_postal_codes&.join(",") }.merge(user_metadata_params)
|
149
116
|
end
|
150
117
|
|
151
118
|
private
|
152
119
|
|
153
|
-
def allowed_scope
|
154
|
-
@allowed_scope ||= Decidim::Scope.find(allowed_scope_id) if allowed_scope_id
|
155
|
-
end
|
156
|
-
|
157
|
-
def user_scope
|
158
|
-
@user_scope ||= Decidim::Scope.find(user_scope_id) if user_scope_id
|
159
|
-
end
|
160
|
-
|
161
|
-
def user_scope_id
|
162
|
-
return unless authorization
|
163
|
-
|
164
|
-
@user_scope_id ||= authorization.metadata["scope_id"]&.to_i
|
165
|
-
end
|
166
|
-
|
167
|
-
def user_scope_name
|
168
|
-
@user_scope_name ||= user_scope.name[I18n.locale.to_s] if authorization && user_scope
|
169
|
-
end
|
170
|
-
|
171
|
-
def disallowed_user_user_scope
|
172
|
-
return unless user_scope || allowed_scope.present?
|
173
|
-
|
174
|
-
allowed_scope_id != user_scope_id
|
175
|
-
end
|
176
|
-
|
177
120
|
def user_postal_code
|
178
121
|
@user_postal_code ||= authorization.metadata["postal_code"] if authorization && authorization.metadata
|
179
122
|
end
|
@@ -189,8 +132,6 @@ class DummyAuthorizationHandler < Decidim::AuthorizationHandler
|
|
189
132
|
|
190
133
|
@user_metadata_params ||= begin
|
191
134
|
user_metadata_params = {}
|
192
|
-
user_metadata_params[:user_scope_name] = user_scope.name[I18n.locale.to_s] if user_scope
|
193
|
-
|
194
135
|
user_metadata_params[:user_postal_code] = authorization.metadata["postal_code"] if authorization.metadata["postal_code"].present?
|
195
136
|
|
196
137
|
user_metadata_params
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class EphemeralDummyAuthorizationHandler < DummyAuthorizationHandler
|
4
|
+
# This method is set to use the same partial as DummyAuthorizationHandler
|
5
|
+
# instead of inferring it from the class name
|
6
|
+
def to_partial_path
|
7
|
+
"dummy_authorization/form"
|
8
|
+
end
|
9
|
+
end
|
@@ -405,6 +405,7 @@ Decidim.configure do |config|
|
|
405
405
|
config.password_similarity_length = Rails.application.secrets.decidim[:password_similarity_length] if Rails.application.secrets.decidim[:password_similarity_length].present?
|
406
406
|
config.denied_passwords = Rails.application.secrets.decidim[:denied_passwords] if Rails.application.secrets.decidim[:denied_passwords].present?
|
407
407
|
config.allow_open_redirects = Rails.application.secrets.decidim[:allow_open_redirects] if Rails.application.secrets.decidim[:allow_open_redirects].present?
|
408
|
+
config.enable_etiquette_validator = Rails.application.secrets.decidim[:enable_etiquette_validator] if Rails.application.secrets.decidim[:enable_etiquette_validator].present?
|
408
409
|
end
|
409
410
|
|
410
411
|
if Decidim.module_installed? :api
|
@@ -46,6 +46,7 @@ decidim_default: &decidim_default
|
|
46
46
|
social_share_services: <%%= Decidim::Env.new("DECIDIM_SOCIAL_SHARE_SERVICES", "X, Facebook, WhatsApp, Telegram").to_array.to_json %>
|
47
47
|
service_worker_enabled: <%%= Decidim::Env.new("DECIDIM_SERVICE_WORKER_ENABLED", Rails.env.exclude?("development")).to_boolean_string %>
|
48
48
|
page_blocks: <%%= Decidim::Env.new("DECIDIM_PAGE_BLOCKS", "terms-of-service").to_array %>
|
49
|
+
enable_etiquette_validator: <%%= Decidim::Env.new("DECIDIM_ENABLE_ETIQUETTE_VALIDATOR", true).to_boolean_string %>
|
49
50
|
admin_password:
|
50
51
|
expiration_days: <%%= Decidim::Env.new("DECIDIM_ADMIN_PASSWORD_EXPIRATION_DAYS", 90).to_i %>
|
51
52
|
min_length: <%%= Decidim::Env.new("DECIDIM_ADMIN_PASSWORD_MIN_LENGTH", 15).to_i %>
|
@@ -70,7 +71,7 @@ decidim_default: &decidim_default
|
|
70
71
|
creation_enabled: <%%= Decidim::Env.new("INITIATIVES_CREATION_ENABLED", "auto").default_or_present_if_exists.to_s %>
|
71
72
|
minimum_committee_members: <%%= Decidim::Env.new("INITIATIVES_MINIMUM_COMMITTEE_MEMBERS", 2).to_i %>
|
72
73
|
default_signature_time_period_length: <%%= Decidim::Env.new("INITIATIVES_DEFAULT_SIGNATURE_TIME_PERIOD_LENGTH", 120).to_i %>
|
73
|
-
default_components: <%%= Decidim::Env.new("INITIATIVES_DEFAULT_COMPONENTS", "pages, meetings").to_array.to_json %>
|
74
|
+
default_components: <%%= Decidim::Env.new("INITIATIVES_DEFAULT_COMPONENTS", "pages, meetings, blogs").to_array.to_json %>
|
74
75
|
first_notification_percentage: <%%= Decidim::Env.new("INITIATIVES_FIRST_NOTIFICATION_PERCENTAGE", 33).to_i %>
|
75
76
|
second_notification_percentage: <%%= Decidim::Env.new("INITIATIVES_SECOND_NOTIFICATION_PERCENTAGE", 66).to_i %>
|
76
77
|
stats_cache_expiration_time: <%%= Decidim::Env.new("INITIATIVES_STATS_CACHE_EXPIRATION_TIME", 5).to_i %>
|
@@ -111,21 +112,21 @@ default: &default
|
|
111
112
|
decidim:
|
112
113
|
<<: *decidim_default
|
113
114
|
omniauth:
|
115
|
+
google_oauth2:
|
116
|
+
enabled: <%%= Decidim::Env.new("OMNIAUTH_GOOGLE_CLIENT_ID").to_boolean_string %>
|
117
|
+
icon_path: "media/images/google.svg"
|
118
|
+
client_id: <%%= ENV["OMNIAUTH_GOOGLE_CLIENT_ID"] %>
|
119
|
+
client_secret: <%%= ENV["OMNIAUTH_GOOGLE_CLIENT_SECRET"] %>
|
114
120
|
facebook:
|
115
121
|
enabled: <%%= Decidim::Env.new("OMNIAUTH_FACEBOOK_APP_ID").to_boolean_string %>
|
116
122
|
app_id: <%%= ENV["OMNIAUTH_FACEBOOK_APP_ID"] %>
|
117
123
|
app_secret: <%%= ENV["OMNIAUTH_FACEBOOK_APP_SECRET"] %>
|
118
|
-
|
124
|
+
icon_path: "media/images/facebook.svg"
|
119
125
|
twitter:
|
120
126
|
enabled: <%%= Decidim::Env.new("OMNIAUTH_TWITTER_API_KEY").to_boolean_string %>
|
121
127
|
api_key: <%%= ENV["OMNIAUTH_TWITTER_API_KEY"] %>
|
122
128
|
api_secret: <%%= ENV["OMNIAUTH_TWITTER_API_SECRET"] %>
|
123
|
-
|
124
|
-
google_oauth2:
|
125
|
-
enabled: <%%= Decidim::Env.new("OMNIAUTH_GOOGLE_CLIENT_ID").to_boolean_string %>
|
126
|
-
icon: google-fill
|
127
|
-
client_id: <%%= ENV["OMNIAUTH_GOOGLE_CLIENT_ID"] %>
|
128
|
-
client_secret: <%%= ENV["OMNIAUTH_GOOGLE_CLIENT_SECRET"] %>
|
129
|
+
icon_path: "media/images/twitter-x.svg"
|
129
130
|
maps:
|
130
131
|
dynamic_provider: <%%= Decidim::Env.new("MAPS_DYNAMIC_PROVIDER", ENV["MAPS_PROVIDER"]).to_s %>
|
131
132
|
static_provider: <%%= Decidim::Env.new("MAPS_STATIC_PROVIDER", ENV["MAPS_PROVIDER"]).to_s %>
|
@@ -9,7 +9,19 @@ Decidim::Verifications.register_workflow(:dummy_authorization_handler) do |workf
|
|
9
9
|
|
10
10
|
workflow.options do |options|
|
11
11
|
options.attribute :allowed_postal_codes, type: :string, default: "08001", required: false
|
12
|
-
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
Decidim::Verifications.register_workflow(:ephemeral_dummy_authorization_handler) do |workflow|
|
16
|
+
workflow.ephemeral = true
|
17
|
+
workflow.form = "EphemeralDummyAuthorizationHandler"
|
18
|
+
workflow.action_authorizer = "DummyAuthorizationHandler::DummyActionAuthorizer"
|
19
|
+
workflow.expires_in = 1.month
|
20
|
+
workflow.renewable = true
|
21
|
+
workflow.time_between_renewals = 5.minutes
|
22
|
+
|
23
|
+
workflow.options do |options|
|
24
|
+
options.attribute :allowed_postal_codes, type: :string, default: "05400", required: false
|
13
25
|
end
|
14
26
|
end
|
15
27
|
|
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.3.4
|
@@ -5,7 +5,7 @@ source "https://rubygems.org"
|
|
5
5
|
|
6
6
|
ruby RUBY_VERSION
|
7
7
|
|
8
|
-
gem "decidim", "~> 0.
|
8
|
+
gem "decidim", "~> 0.30.0.rc1"
|
9
9
|
gem "decidim-<%= component_name %>", path: "."
|
10
10
|
|
11
11
|
gem "puma", ">= 6.3.1"
|
@@ -14,7 +14,7 @@ gem "bootsnap", "~> 1.4"
|
|
14
14
|
group :development, :test do
|
15
15
|
gem "byebug", "~> 11.0", platform: :mri
|
16
16
|
|
17
|
-
gem "decidim-dev", "~> 0.
|
17
|
+
gem "decidim-dev", "~> 0.30.0.rc1"
|
18
18
|
end
|
19
19
|
|
20
20
|
group :development do
|
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.version = Decidim::<%= component_module_name %>.version
|
9
9
|
s.authors = ["<%= %x[git config user.name].chomp %>"]
|
10
10
|
s.email = ["<%= %x[git config user.email].chomp %>"]
|
11
|
-
s.license = "AGPL-3.0"
|
11
|
+
s.license = "AGPL-3.0-or-later"
|
12
12
|
s.homepage = "https://decidim.org"
|
13
13
|
s.metadata = {
|
14
14
|
"bug_tracker_uri" => "https://github.com/decidim/decidim/issues",
|
@@ -3,7 +3,7 @@
|
|
3
3
|
"version": "0.0.1",
|
4
4
|
"description": <%= JSON.generate(component_description || "") %>,
|
5
5
|
"private": true,
|
6
|
-
"license": "AGPL-3.0",
|
6
|
+
"license": "AGPL-3.0-or-later",
|
7
7
|
"scripts": {
|
8
8
|
"lint": "eslint -c .eslintrc.json --no-error-on-unmatched-pattern --ignore-pattern app/packs/vendor --ext .js app/packs",
|
9
9
|
"stylelint": "stylelint app/packs/**/*.scss"
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "uri"
|
4
|
+
|
3
5
|
shared_context "when generating a new application" do
|
4
6
|
let(:env) do |example|
|
5
7
|
#
|
@@ -63,10 +65,10 @@ shared_examples_for "a new development application" do
|
|
63
65
|
Decidim::GemManager.plugins.each do |plugin|
|
64
66
|
Dir.glob("#{plugin}db/migrate/*.rb").each do |migration|
|
65
67
|
lines = File.readlines(migration)
|
66
|
-
tables.concat(lines.
|
67
|
-
dropped.concat(lines.
|
68
|
-
tables.concat(lines.
|
69
|
-
dropped.concat(lines.
|
68
|
+
tables.concat(lines.grep(/create_table/).map { |line| line.match(/(:)([a-z_0-9]+)/)[2] })
|
69
|
+
dropped.concat(lines.grep(/drop_table/).map { |line| line.match(/(:)([a-z_0-9]+)/)[2] })
|
70
|
+
tables.concat(lines.grep(/rename_table/).map { |line| line.match(/(, :)([a-z_0-9]+)/)[2] })
|
71
|
+
dropped.concat(lines.grep(/rename_table/).map { |line| line.match(/(:)([a-z_0-9]+)/)[2] })
|
70
72
|
end
|
71
73
|
end
|
72
74
|
tables.each do |table|
|
@@ -345,7 +347,7 @@ shared_examples_for "an application with configurable env vars" do
|
|
345
347
|
%w(decidim initiatives creation_enabled) => "auto",
|
346
348
|
%w(decidim initiatives minimum_committee_members) => 2,
|
347
349
|
%w(decidim initiatives default_signature_time_period_length) => 120,
|
348
|
-
%w(decidim initiatives default_components) => %w(pages meetings),
|
350
|
+
%w(decidim initiatives default_components) => %w(pages meetings blogs),
|
349
351
|
%w(decidim initiatives first_notification_percentage) => 33,
|
350
352
|
%w(decidim initiatives second_notification_percentage) => 66,
|
351
353
|
%w(decidim initiatives stats_cache_expiration_time) => 5,
|
@@ -834,7 +836,7 @@ shared_examples_for "an application with extra configurable env vars" do
|
|
834
836
|
"creation_enabled" => true,
|
835
837
|
"minimum_committee_members" => 2,
|
836
838
|
"default_signature_time_period_length" => 120,
|
837
|
-
"default_components" => %w(pages meetings),
|
839
|
+
"default_components" => %w(pages meetings blogs),
|
838
840
|
"first_notification_percentage" => 33,
|
839
841
|
"second_notification_percentage" => 66,
|
840
842
|
"stats_cache_expiration_time" => 300, # 5.minutes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decidim-generators
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.30.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josep Jaume Rey Peroy
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2025-02-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: decidim-core
|
@@ -18,14 +18,14 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.
|
21
|
+
version: 0.30.0.rc1
|
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.
|
28
|
+
version: 0.30.0.rc1
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: bundler
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
@@ -64,6 +64,7 @@ files:
|
|
64
64
|
- lib/decidim/generators/app_templates/Dockerfile.erb
|
65
65
|
- lib/decidim/generators/app_templates/LICENSE-AGPLv3.txt
|
66
66
|
- lib/decidim/generators/app_templates/README.md.erb
|
67
|
+
- lib/decidim/generators/app_templates/ai_initializer.rb
|
67
68
|
- lib/decidim/generators/app_templates/another_dummy_authorization_handler.rb
|
68
69
|
- lib/decidim/generators/app_templates/budgets_initializer.rb
|
69
70
|
- lib/decidim/generators/app_templates/budgets_workflow_random.en.yml
|
@@ -78,6 +79,7 @@ files:
|
|
78
79
|
- lib/decidim/generators/app_templates/docker-compose-etherpad.yml
|
79
80
|
- lib/decidim/generators/app_templates/docker-compose.yml.erb
|
80
81
|
- lib/decidim/generators/app_templates/dummy_authorization_handler.rb
|
82
|
+
- lib/decidim/generators/app_templates/ephemeral_dummy_authorization_handler.rb
|
81
83
|
- lib/decidim/generators/app_templates/initializer.rb
|
82
84
|
- lib/decidim/generators/app_templates/package.json
|
83
85
|
- lib/decidim/generators/app_templates/rack_profiler_initializer.rb
|
@@ -127,7 +129,7 @@ files:
|
|
127
129
|
- lib/decidim/generators/version.rb
|
128
130
|
homepage: https://decidim.org
|
129
131
|
licenses:
|
130
|
-
- AGPL-3.0
|
132
|
+
- AGPL-3.0-or-later
|
131
133
|
metadata:
|
132
134
|
bug_tracker_uri: https://github.com/decidim/decidim/issues
|
133
135
|
documentation_uri: https://docs.decidim.org/
|
@@ -142,14 +144,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
142
144
|
requirements:
|
143
145
|
- - "~>"
|
144
146
|
- !ruby/object:Gem::Version
|
145
|
-
version: 3.
|
147
|
+
version: 3.3.0
|
146
148
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
147
149
|
requirements:
|
148
150
|
- - ">="
|
149
151
|
- !ruby/object:Gem::Version
|
150
152
|
version: '0'
|
151
153
|
requirements: []
|
152
|
-
rubygems_version: 3.
|
154
|
+
rubygems_version: 3.5.11
|
153
155
|
signing_key:
|
154
156
|
specification_version: 4
|
155
157
|
summary: Citizen participation framework for Ruby on Rails.
|