decidim-core 0.27.0.rc1 → 0.27.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of decidim-core might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/cells/decidim/announcement_cell.rb +1 -1
- data/app/cells/decidim/content_blocks/cta/show.erb +1 -1
- data/app/cells/decidim/content_blocks/cta_cell.rb +1 -1
- data/app/cells/decidim/content_blocks/hero/show.erb +2 -2
- data/app/cells/decidim/content_blocks/hero_cell.rb +1 -0
- data/app/cells/decidim/content_blocks/highlighted_content_banner/show.erb +2 -2
- data/app/cells/decidim/content_blocks/stats_cell.rb +1 -0
- data/app/cells/decidim/content_blocks/sub_hero_cell.rb +1 -1
- data/app/cells/decidim/data_consent/category.erb +19 -19
- data/app/cells/decidim/data_consent/dialog.erb +12 -12
- data/app/cells/decidim/data_consent/modal.erb +13 -13
- data/app/cells/decidim/data_consent_cell.rb +3 -3
- data/app/commands/decidim/update_account.rb +3 -1
- data/app/controllers/concerns/decidim/resource_versions_concern.rb +4 -0
- data/app/controllers/decidim/devise/registrations_controller.rb +5 -1
- data/app/controllers/decidim/last_activities_controller.rb +1 -0
- data/app/events/decidim/resource_endorsed_event.rb +2 -1
- data/app/forms/decidim/account_form.rb +1 -1
- data/app/forms/decidim/user_group_form.rb +1 -1
- data/app/helpers/decidim/filters_helper.rb +5 -1
- data/app/helpers/decidim/sanitize_helper.rb +12 -3
- data/app/models/decidim/action_log.rb +9 -9
- data/app/models/decidim/notification.rb +11 -2
- data/app/models/decidim/user_base_entity.rb +1 -0
- data/app/packs/entrypoints/decidim_core.js +1 -1
- data/app/packs/src/decidim/account_form.js +68 -18
- data/app/packs/src/decidim/{cookie_consent → data_consent}/consent_manager.js +27 -24
- data/app/packs/src/decidim/data_consent/consent_manager.test.js +280 -0
- data/app/packs/src/decidim/{cookie_consent/cookie_consent.js → data_consent/index.js} +12 -12
- data/app/packs/src/decidim/input_character_counter.js +57 -34
- data/app/packs/src/decidim/sw/a2hs.js +10 -1
- data/app/packs/stylesheets/decidim/modules/_cards.scss +2 -0
- data/app/packs/stylesheets/decidim/modules/_comments.scss +2 -0
- data/app/packs/stylesheets/decidim/modules/{_cookie-consent.scss → _data-consent.scss} +10 -10
- data/app/packs/stylesheets/decidim/modules/_forms.scss +5 -0
- data/app/packs/stylesheets/decidim/modules/_modules.scss +1 -1
- data/app/permissions/decidim/permissions.rb +4 -2
- data/app/presenters/decidim/push_notification_presenter.rb +2 -1
- data/app/presenters/decidim/user_presenter.rb +4 -1
- data/app/scrubbers/decidim/admin_input_scrubber.rb +25 -0
- data/app/scrubbers/decidim/user_input_scrubber.rb +3 -5
- data/app/services/decidim/iframe_disabler.rb +2 -3
- data/app/services/decidim/notifications_digest_sending_decider.rb +6 -2
- data/app/services/decidim/send_push_notification.rb +14 -12
- data/app/views/decidim/account/_password_fields.html.erb +2 -2
- data/app/views/decidim/download_your_data/show.html.erb +1 -1
- data/app/views/decidim/notifications_settings/show.html.erb +65 -67
- data/app/views/decidim/pages/_standalone.html.erb +1 -1
- data/app/views/decidim/pages/_tabbed.html.erb +1 -1
- data/app/views/decidim/user_interests/show.html.erb +11 -13
- data/app/views/layouts/decidim/_application.html.erb +1 -1
- data/app/views/layouts/decidim/_data_consent_warning.html.erb +8 -0
- data/app/views/layouts/decidim/_main_footer.html.erb +1 -1
- data/config/locales/am-ET.yml +0 -1
- data/config/locales/ar.yml +0 -9
- data/config/locales/bg.yml +0 -9
- data/config/locales/ca.yml +18 -23
- data/config/locales/cs.yml +19 -24
- data/config/locales/da.yml +0 -1
- data/config/locales/de.yml +204 -10
- data/config/locales/el.yml +0 -9
- data/config/locales/en.yml +17 -22
- data/config/locales/es-MX.yml +20 -25
- data/config/locales/es-PY.yml +19 -24
- data/config/locales/es.yml +20 -25
- data/config/locales/et.yml +0 -1
- data/config/locales/eu.yml +1 -10
- data/config/locales/fi-plain.yml +17 -22
- data/config/locales/fi.yml +17 -22
- data/config/locales/fr-CA.yml +29 -20
- data/config/locales/fr.yml +42 -33
- data/config/locales/ga-IE.yml +0 -2
- data/config/locales/gl.yml +0 -9
- data/config/locales/hr.yml +0 -1
- data/config/locales/hu.yml +250 -9
- data/config/locales/id-ID.yml +0 -9
- data/config/locales/it.yml +1 -10
- data/config/locales/ja.yml +30 -24
- data/config/locales/ko.yml +0 -1
- data/config/locales/lb.yml +0 -9
- data/config/locales/lt.yml +1949 -0
- data/config/locales/lv.yml +0 -9
- data/config/locales/mt.yml +0 -1
- data/config/locales/nl.yml +16 -10
- data/config/locales/no.yml +1 -10
- data/config/locales/om-ET.yml +0 -1
- data/config/locales/pl.yml +0 -9
- data/config/locales/pt-BR.yml +2 -11
- data/config/locales/pt.yml +0 -9
- data/config/locales/ro-RO.yml +0 -9
- data/config/locales/si-LK.yml +0 -1
- data/config/locales/sk.yml +0 -9
- data/config/locales/so-SO.yml +0 -1
- data/config/locales/sv.yml +9 -14
- data/config/locales/sw-KE.yml +0 -1
- data/config/locales/ti-ER.yml +0 -1
- data/config/locales/tr-TR.yml +0 -9
- data/config/locales/val-ES.yml +0 -1
- data/config/locales/vi.yml +0 -1
- data/config/locales/zh-CN.yml +2 -11
- data/config/locales/zh-TW.yml +0 -1
- data/config/routes.rb +20 -2
- data/lib/decidim/attributes/model.rb +9 -1
- data/lib/decidim/content_parsers/hashtag_parser.rb +1 -1
- data/lib/decidim/core/engine.rb +1 -1
- data/lib/decidim/core/test/shared_examples/resource_endorsed_event_examples.rb +60 -0
- data/lib/decidim/core/test/shared_examples/versions_controller_examples.rb +40 -0
- data/lib/decidim/core/test/shared_examples/with_endorsable_permissions_examples.rb +1 -1
- data/lib/decidim/core/test.rb +2 -0
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/core.rb +52 -13
- data/lib/decidim/dependency_resolver.rb +272 -0
- data/lib/decidim/events/simple_event.rb +1 -0
- data/lib/decidim/has_resource_permission.rb +0 -2
- data/lib/decidim/map/provider/dynamic_map/here.rb +46 -1
- data/lib/decidim/nicknamizable.rb +1 -1
- data/lib/decidim/translatable_attributes.rb +8 -1
- data/lib/decidim/url_option_resolver.rb +1 -1
- metadata +15 -11
- data/app/views/decidim/devise/registrations/edit.html.erb +0 -41
- data/app/views/layouts/decidim/_cookie_warning.html.erb +0 -8
@@ -0,0 +1,272 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
# The dependency resolver provides information about the Decidim module
|
5
|
+
# dependencies. For instance, it can be used to check if a particular Decidim
|
6
|
+
# module is needed by the instance or not.
|
7
|
+
#
|
8
|
+
# This is a singleton utility in order to make it perform better when it is
|
9
|
+
# called from different places throughout the application.
|
10
|
+
#
|
11
|
+
# @example Checking whether a module is needed by the instance
|
12
|
+
# Decidim::DependencyResolver.instance.needed?("decidim-proposals")
|
13
|
+
class DependencyResolver
|
14
|
+
include Singleton
|
15
|
+
|
16
|
+
def initialize
|
17
|
+
@cache = []
|
18
|
+
end
|
19
|
+
|
20
|
+
# Finds a gem specification for the gem with the name provided as the
|
21
|
+
# argument.
|
22
|
+
#
|
23
|
+
# When bundler is available, searches whether the gem is listed in the
|
24
|
+
# Gemfile or required as a dependency for one of the gems in the Gemfile or
|
25
|
+
# their dependencies.
|
26
|
+
#
|
27
|
+
# When bundler is not available, gets the gem specification from the loaded
|
28
|
+
# specs which means any gems available in the gem install folder.
|
29
|
+
#
|
30
|
+
# @param gem [String] The name for the gem to be looked up.
|
31
|
+
# @return [Bundler::LazySpecification, Gem::Specification, nil] When bundler
|
32
|
+
# is available, returns `Bundler::LazySpecification`. When bundler is not
|
33
|
+
# available, returns `Gem::Specification`. Both of these implement the
|
34
|
+
# necessary methods for the other checks. In both cases returns nil if
|
35
|
+
# the gem is not found.
|
36
|
+
def lookup(gem)
|
37
|
+
# In case the lookup method is called with a spec definition, return the
|
38
|
+
# definition itself.
|
39
|
+
return gem unless gem.is_a?(String)
|
40
|
+
|
41
|
+
if bundler?
|
42
|
+
lookup = Lookup.new
|
43
|
+
return lookup.spec(gem) if cache.include?(gem)
|
44
|
+
|
45
|
+
# Keep a local cache of the already processed gems in order to avoid
|
46
|
+
# double lookups.
|
47
|
+
lookup.find(Bundler.definition.dependencies, gem) do |dependency|
|
48
|
+
if potential_module?(dependency.name)
|
49
|
+
cache_miss = cache.exclude?(dependency.name)
|
50
|
+
cache << dependency.name if cache_miss
|
51
|
+
cache_miss
|
52
|
+
else
|
53
|
+
false
|
54
|
+
end
|
55
|
+
end
|
56
|
+
else
|
57
|
+
return unless potential_module?(gem)
|
58
|
+
|
59
|
+
Gem.loaded_specs[gem]
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
# Resolves the main load file path for module defined by the gem
|
64
|
+
# specification.
|
65
|
+
#
|
66
|
+
# @param spec [Bundler::LazySpecification, Gem::Specification, String] The
|
67
|
+
# gem specification to test or the name of the gem.
|
68
|
+
# @return [String] A string pointing the path to the module's main load
|
69
|
+
# file.
|
70
|
+
def module_path(spec)
|
71
|
+
spec = lookup(spec)
|
72
|
+
return unless spec
|
73
|
+
|
74
|
+
"#{spec.full_gem_path}/lib/#{spec.name.gsub("-", "/")}.rb"
|
75
|
+
end
|
76
|
+
|
77
|
+
# Resolves whether the module for the gem specification defines the main
|
78
|
+
# load file.
|
79
|
+
#
|
80
|
+
# @param spec [Bundler::LazySpecification, Gem::Specification, String] The
|
81
|
+
# gem specification to test or the name of the gem.
|
82
|
+
# @return [Boolean] A boolean indicating if the gem defined by the spec is
|
83
|
+
# available for loading.
|
84
|
+
def available?(spec)
|
85
|
+
path = module_path(spec)
|
86
|
+
return false unless path
|
87
|
+
|
88
|
+
File.exist?(path)
|
89
|
+
end
|
90
|
+
|
91
|
+
# Checks if the module for the gem speficiation has been loaded through
|
92
|
+
# `require "decidim/foo"`.
|
93
|
+
#
|
94
|
+
# @param spec [Bundler::LazySpecification, Gem::Specification, String] The
|
95
|
+
# gem specification to test or the name of the gem.
|
96
|
+
# @return [Boolean] A boolean indicating if the gem defined by the spec is
|
97
|
+
# loaded.
|
98
|
+
def loaded?(spec)
|
99
|
+
return false unless available?(spec)
|
100
|
+
|
101
|
+
$LOADED_FEATURES.include?(module_path(spec))
|
102
|
+
end
|
103
|
+
|
104
|
+
# Resolves whether the target gem is needed or not, i.e. does it need to be
|
105
|
+
# loaded.
|
106
|
+
#
|
107
|
+
# When bundler is available, the dependencies are resolved based on the
|
108
|
+
# modules defined in the Gemfile which means that the gem is always needed
|
109
|
+
# when it is reported as available by the resolver (i.e. defined as a
|
110
|
+
# dependency in the Gemfile itself or one of those gems depend on it).
|
111
|
+
#
|
112
|
+
# When bundler is not available, this will check whether the Decidim module
|
113
|
+
# provided by the gem has been already required/loaded or not. In this
|
114
|
+
# situation, it is impossible to know whether the implementer has intended
|
115
|
+
# the gem to be used or not, so we assume in these situations implementers
|
116
|
+
# will load all the gems they want before running any initializers. This
|
117
|
+
# means that the `require "decidim/foo"` statements have to be listed for
|
118
|
+
# all modules before the initialization process.
|
119
|
+
#
|
120
|
+
# @param spec [Bundler::LazySpecification, Gem::Specification, String] The
|
121
|
+
# gem specification to test or the name of the gem.
|
122
|
+
# @return [Boolean] A boolean indicating if the gem defined by the spec is
|
123
|
+
# needed.
|
124
|
+
def needed?(spec)
|
125
|
+
spec = lookup(spec)
|
126
|
+
return false unless spec
|
127
|
+
|
128
|
+
if bundler?
|
129
|
+
available?(spec)
|
130
|
+
else
|
131
|
+
loaded?(spec)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
private
|
136
|
+
|
137
|
+
attr_accessor :cache
|
138
|
+
|
139
|
+
# Reports whether bundler is available.
|
140
|
+
#
|
141
|
+
# @return [Boolean] A boolean indicating if bundler is available or not.
|
142
|
+
def bundler?
|
143
|
+
defined?(Bundler)
|
144
|
+
end
|
145
|
+
|
146
|
+
# Only match the decidim gems. Skip the decidim-dev gem because it has
|
147
|
+
# "decidim" as a runtime dependency which would cause all the default
|
148
|
+
# gems to be always reported as available.
|
149
|
+
#
|
150
|
+
# @return [Boolean] A boolean indicating if the given gem name is a
|
151
|
+
# potential Decidim module to be processed.
|
152
|
+
def potential_module?(name)
|
153
|
+
name != "decidim-dev" && name =~ /decidim(-.*)?/
|
154
|
+
end
|
155
|
+
|
156
|
+
# The lookup class takes care of the individual recursive lookups over a
|
157
|
+
# dependency tree.
|
158
|
+
class Lookup
|
159
|
+
# @param debug [Boolean] A boolean indicating if the debug mode is enabled
|
160
|
+
# or not. False by default.
|
161
|
+
def initialize(debug: false)
|
162
|
+
@current_level = 0
|
163
|
+
return unless debug
|
164
|
+
|
165
|
+
formatter = proc do |_severity, _datetime, _progname, msg|
|
166
|
+
"#{msg}\n"
|
167
|
+
end
|
168
|
+
@logger = Logger.new($stdout, formatter: formatter)
|
169
|
+
logger.debug!
|
170
|
+
end
|
171
|
+
|
172
|
+
# Iterates recursively through the runtime dependencies array and their
|
173
|
+
# sub-dependencies to find whether the provided gem is included. This
|
174
|
+
# always iterates through the whole dependency tree even when the gem is
|
175
|
+
# already found in order not to process the same dependencies multiple
|
176
|
+
# times and to make the cache work correctly when calling this.
|
177
|
+
#
|
178
|
+
# @param dependencies [Array] An array of the dependencies to iterate
|
179
|
+
# through.
|
180
|
+
# @param gem [String] The name of the gem to find.
|
181
|
+
# @yield [dependency] Yields each dependency to be processed to the
|
182
|
+
# provided block to check if that dependency needs to be processed or
|
183
|
+
# not.
|
184
|
+
# @yieldparam [Gem::Dependency] The runtime dependency being processed.
|
185
|
+
# @yieldreturn [Boolean] A boolean indicating whether this dependency
|
186
|
+
# needs to be processed or not. True indicates it needs to be processed
|
187
|
+
# and false indicates processing is not needed.
|
188
|
+
# @return [Bundler::LazySpecification, nil] The specification for the gem
|
189
|
+
# or nil when it is not found.
|
190
|
+
def find(dependencies, gem, &block)
|
191
|
+
found = nil
|
192
|
+
dependencies.each do |dependency|
|
193
|
+
next unless process?(dependency, &block)
|
194
|
+
|
195
|
+
spec = spec(dependency.name)
|
196
|
+
next unless spec # E.g. the "bundler" gem is not in the locked gems
|
197
|
+
|
198
|
+
log(dependency)
|
199
|
+
|
200
|
+
found ||= spec if spec.name == gem
|
201
|
+
|
202
|
+
@current_level += 1
|
203
|
+
# Do not se the found value directly here because otherwise the
|
204
|
+
# recursive call would not be made if the target gem is already found.
|
205
|
+
sub_spec = find(spec.dependencies, gem, &block)
|
206
|
+
@current_level -= 1
|
207
|
+
found ||= sub_spec
|
208
|
+
end
|
209
|
+
|
210
|
+
found
|
211
|
+
end
|
212
|
+
|
213
|
+
# Finds a gem specification from the locked gems of the instance.
|
214
|
+
#
|
215
|
+
# Note that this does not resolve if the module is needed or not. This may
|
216
|
+
# also return the gem specification even when it is not listed in the
|
217
|
+
# Gemfile, e.g. when the Decidim gems are installed through git.
|
218
|
+
#
|
219
|
+
# @param name [String] The name of the gem to find.
|
220
|
+
# @return [Bundler::LazySpecification, nil] The specification for the gem
|
221
|
+
# or nil if the gem is not listed in the locked gems.
|
222
|
+
def spec(name)
|
223
|
+
Bundler.definition.locked_gems.specs.find { |s| s.name == name }
|
224
|
+
end
|
225
|
+
|
226
|
+
private
|
227
|
+
|
228
|
+
attr_reader :logger, :current_level
|
229
|
+
|
230
|
+
# Decides whether a dependency needs to be processed, i.e. compared
|
231
|
+
# whether it is the gem to be found.
|
232
|
+
#
|
233
|
+
# @param dependency [Gem::Dependency] The dependency being processed.
|
234
|
+
# @yield [dependency] Yields each dependency to be processed to the
|
235
|
+
# provided block to check if that dependency needs to be processed or
|
236
|
+
# not.
|
237
|
+
# @yieldparam [Gem::Dependency] The runtime dependency being processed.
|
238
|
+
# @yieldreturn [Boolean] A boolean indicating whether this dependency
|
239
|
+
# needs to be processed or not. True indicates it needs to be processed
|
240
|
+
# and false indicates processing is not needed.
|
241
|
+
# @return [Boolean] A boolean indicating whether the dependency needs to
|
242
|
+
# be processed, i.e. compared whether it is the gem to be found.
|
243
|
+
def process?(dependency)
|
244
|
+
return false unless dependency.type == :runtime
|
245
|
+
return true unless block_given?
|
246
|
+
|
247
|
+
yield(dependency)
|
248
|
+
end
|
249
|
+
|
250
|
+
# Writes a log message for the given dependency at the current level of
|
251
|
+
# processing. When debugging is enabled, will produce the following kind
|
252
|
+
# of log output indicating the lookup tree.
|
253
|
+
#
|
254
|
+
# @example
|
255
|
+
# decidim-admin
|
256
|
+
# --decidim-core
|
257
|
+
# ----decidim-api
|
258
|
+
# decidim-assemblies
|
259
|
+
# decidim-blogs
|
260
|
+
# --decidim-comments
|
261
|
+
#
|
262
|
+
# @param dependency [Gem::Dependency] The dependency to be logged at the
|
263
|
+
# current level of processing.
|
264
|
+
# @return [Boolean] A boolean indicating whether logging happened or not.
|
265
|
+
def log(dependency)
|
266
|
+
return false unless logger
|
267
|
+
|
268
|
+
logger.debug("#{"--" * current_level}#{dependency.name}")
|
269
|
+
end
|
270
|
+
end
|
271
|
+
end
|
272
|
+
end
|
@@ -40,6 +40,7 @@ module Decidim
|
|
40
40
|
def email_subject_i18n_options
|
41
41
|
sanitized_values = { resource_title: decidim_sanitize(resource_title) }
|
42
42
|
sanitized_values[:mentioned_proposal_title] = decidim_sanitize(mentioned_proposal_title) if i18n_options.has_key?(:mentioned_proposal_title)
|
43
|
+
sanitized_values[:participatory_space_title] = decidim_sanitize(participatory_space_title) if i18n_options.has_key?(:participatory_space_title)
|
43
44
|
i18n_options.merge(sanitized_values)
|
44
45
|
end
|
45
46
|
|
@@ -14,8 +14,6 @@ module Decidim
|
|
14
14
|
|
15
15
|
delegate :resource_manifest, :resource_key, to: :class
|
16
16
|
|
17
|
-
alias_method :manifest, :resource_manifest
|
18
|
-
|
19
17
|
# Public: Whether the permissions for this object actions can be set at resource level.
|
20
18
|
def allow_resource_permissions?
|
21
19
|
false
|
@@ -33,7 +33,7 @@ module Decidim
|
|
33
33
|
)
|
34
34
|
end
|
35
35
|
|
36
|
-
base_config.merge(api_key: api_key)
|
36
|
+
base_config.merge(api_key: api_key, language: language_code)
|
37
37
|
end
|
38
38
|
|
39
39
|
# A builder for the HERE maps which needs to be configured differently
|
@@ -44,6 +44,51 @@ module Decidim
|
|
44
44
|
template.javascript_pack_tag("decidim_map_provider_here", defer: false)
|
45
45
|
end
|
46
46
|
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def language_code
|
51
|
+
primary = I18n.locale.to_s
|
52
|
+
secondary = primary.split("-")[0]
|
53
|
+
available_language_codes[primary] || available_language_codes[secondary] || ""
|
54
|
+
end
|
55
|
+
|
56
|
+
def available_language_codes
|
57
|
+
@available_language_codes ||= {
|
58
|
+
"ar" => "ara", # Arabic
|
59
|
+
"eu" => "baq", # Basque
|
60
|
+
"ca" => "cat", # Catalan
|
61
|
+
"zh" => "chi", # Chinese (simplified)
|
62
|
+
# "" => "cht", # Chinese (traditional)
|
63
|
+
"cs" => "cze", # Czech
|
64
|
+
"da" => "dan", # Danish
|
65
|
+
"nl" => "dut", # Dutch
|
66
|
+
"en" => "eng", # English
|
67
|
+
"fi" => "fin", # Finnish
|
68
|
+
"fr" => "fre", # French
|
69
|
+
"de" => "ger", # German
|
70
|
+
"ga" => "gle", # Gaelic
|
71
|
+
"el" => "gre", # Greek
|
72
|
+
"he" => "heb", # Hebrew
|
73
|
+
"hi" => "hin", # Hindi
|
74
|
+
"id" => "ind", # Indonesian
|
75
|
+
"it" => "ita", # Italian
|
76
|
+
"no" => "nor", # Norwegian
|
77
|
+
"fa" => "per", # Persian
|
78
|
+
"pl" => "pol", # Polish
|
79
|
+
"pt" => "por", # Portuguese
|
80
|
+
"ru" => "rus", # Russian
|
81
|
+
"si" => "sin", # Sinhalese
|
82
|
+
"es" => "spa", # Spanish
|
83
|
+
"sv" => "swe", # Swedish
|
84
|
+
"th" => "tha", # Thai
|
85
|
+
"tr" => "tur", # Turkish
|
86
|
+
"uk" => "ukr", # Ukrainian
|
87
|
+
"ur" => "urd", # Urdu
|
88
|
+
"vi" => "vie", # Vietnamese
|
89
|
+
"cy" => "wel" # Welsh
|
90
|
+
}
|
91
|
+
end
|
47
92
|
end
|
48
93
|
end
|
49
94
|
end
|
@@ -52,7 +52,7 @@ module Decidim
|
|
52
52
|
candidate = name
|
53
53
|
|
54
54
|
2.step do |n|
|
55
|
-
return candidate if Decidim::
|
55
|
+
return candidate if Decidim::UserBaseEntity.where("nickname ILIKE ?", candidate.downcase).where(scope).empty?
|
56
56
|
|
57
57
|
candidate = numbered_variation_of(name, n)
|
58
58
|
end
|
@@ -43,7 +43,14 @@ module Decidim
|
|
43
43
|
|
44
44
|
define_method attribute_name do
|
45
45
|
field = public_send(name) || {}
|
46
|
-
value =
|
46
|
+
value =
|
47
|
+
if field.is_a?(Hash)
|
48
|
+
field[locale.to_s] || field[locale.to_sym]
|
49
|
+
else
|
50
|
+
# The value may not be a hash in case the attribute type was
|
51
|
+
# changed and the old value is still stored against the record.
|
52
|
+
field
|
53
|
+
end
|
47
54
|
value_type = self.class.attribute_types[attribute_name.to_s]
|
48
55
|
value_type ? value_type.cast(value) : value
|
49
56
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decidim-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.27.0.
|
4
|
+
version: 0.27.0.rc2
|
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: 2022-
|
13
|
+
date: 2022-09-19 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: active_link_to
|
@@ -740,28 +740,28 @@ dependencies:
|
|
740
740
|
requirements:
|
741
741
|
- - '='
|
742
742
|
- !ruby/object:Gem::Version
|
743
|
-
version: 0.27.0.
|
743
|
+
version: 0.27.0.rc2
|
744
744
|
type: :runtime
|
745
745
|
prerelease: false
|
746
746
|
version_requirements: !ruby/object:Gem::Requirement
|
747
747
|
requirements:
|
748
748
|
- - '='
|
749
749
|
- !ruby/object:Gem::Version
|
750
|
-
version: 0.27.0.
|
750
|
+
version: 0.27.0.rc2
|
751
751
|
- !ruby/object:Gem::Dependency
|
752
752
|
name: decidim-dev
|
753
753
|
requirement: !ruby/object:Gem::Requirement
|
754
754
|
requirements:
|
755
755
|
- - '='
|
756
756
|
- !ruby/object:Gem::Version
|
757
|
-
version: 0.27.0.
|
757
|
+
version: 0.27.0.rc2
|
758
758
|
type: :development
|
759
759
|
prerelease: false
|
760
760
|
version_requirements: !ruby/object:Gem::Requirement
|
761
761
|
requirements:
|
762
762
|
- - '='
|
763
763
|
- !ruby/object:Gem::Version
|
764
|
-
version: 0.27.0.
|
764
|
+
version: 0.27.0.rc2
|
765
765
|
description: Adds core features so other engines can hook into the framework.
|
766
766
|
email:
|
767
767
|
- josepjaume@gmail.com
|
@@ -1410,8 +1410,9 @@ files:
|
|
1410
1410
|
- app/packs/src/decidim/configuration.js
|
1411
1411
|
- app/packs/src/decidim/confirm.js
|
1412
1412
|
- app/packs/src/decidim/conversations.js
|
1413
|
-
- app/packs/src/decidim/
|
1414
|
-
- app/packs/src/decidim/
|
1413
|
+
- app/packs/src/decidim/data_consent/consent_manager.js
|
1414
|
+
- app/packs/src/decidim/data_consent/consent_manager.test.js
|
1415
|
+
- app/packs/src/decidim/data_consent/index.js
|
1415
1416
|
- app/packs/src/decidim/data_picker.js
|
1416
1417
|
- app/packs/src/decidim/datalist_select.js
|
1417
1418
|
- app/packs/src/decidim/decidim_application.js
|
@@ -1556,7 +1557,7 @@ files:
|
|
1556
1557
|
- app/packs/stylesheets/decidim/modules/_conference-speaker.scss
|
1557
1558
|
- app/packs/stylesheets/decidim/modules/_confirm.scss
|
1558
1559
|
- app/packs/stylesheets/decidim/modules/_conversation.scss
|
1559
|
-
- app/packs/stylesheets/decidim/modules/
|
1560
|
+
- app/packs/stylesheets/decidim/modules/_data-consent.scss
|
1560
1561
|
- app/packs/stylesheets/decidim/modules/_data-picker.scss
|
1561
1562
|
- app/packs/stylesheets/decidim/modules/_datepicker.scss
|
1562
1563
|
- app/packs/stylesheets/decidim/modules/_definition-data.scss
|
@@ -1723,6 +1724,7 @@ files:
|
|
1723
1724
|
- app/queries/decidim/user_groups/member_memberships.rb
|
1724
1725
|
- app/resolvers/decidim/core/metric_resolver.rb
|
1725
1726
|
- app/resolvers/decidim/hashtags_resolver.rb
|
1727
|
+
- app/scrubbers/decidim/admin_input_scrubber.rb
|
1726
1728
|
- app/scrubbers/decidim/newsletter_scrubber.rb
|
1727
1729
|
- app/scrubbers/decidim/user_input_scrubber.rb
|
1728
1730
|
- app/serializers/decidim/exporters/participatory_space_components_serializer.rb
|
@@ -1820,7 +1822,6 @@ files:
|
|
1820
1822
|
- app/views/decidim/devise/omniauth_registrations/new.html.erb
|
1821
1823
|
- app/views/decidim/devise/passwords/edit.html.erb
|
1822
1824
|
- app/views/decidim/devise/passwords/new.html.erb
|
1823
|
-
- app/views/decidim/devise/registrations/edit.html.erb
|
1824
1825
|
- app/views/decidim/devise/registrations/new.html.erb
|
1825
1826
|
- app/views/decidim/devise/sessions/new.html.erb
|
1826
1827
|
- app/views/decidim/devise/shared/_links.html.erb
|
@@ -1963,8 +1964,8 @@ files:
|
|
1963
1964
|
- app/views/kaminari/decidim/_prev_page.html.erb
|
1964
1965
|
- app/views/layouts/decidim/_admin_links.html.erb
|
1965
1966
|
- app/views/layouts/decidim/_application.html.erb
|
1966
|
-
- app/views/layouts/decidim/_cookie_warning.html.erb
|
1967
1967
|
- app/views/layouts/decidim/_cors.html.erb
|
1968
|
+
- app/views/layouts/decidim/_data_consent_warning.html.erb
|
1968
1969
|
- app/views/layouts/decidim/_decidim_javascript.html.erb
|
1969
1970
|
- app/views/layouts/decidim/_edit_link.html.erb
|
1970
1971
|
- app/views/layouts/decidim/_head.html.erb
|
@@ -2477,6 +2478,7 @@ files:
|
|
2477
2478
|
- lib/decidim/core/test/shared_examples/railtie_examples.rb
|
2478
2479
|
- lib/decidim/core/test/shared_examples/reportable.rb
|
2479
2480
|
- lib/decidim/core/test/shared_examples/reports_examples.rb
|
2481
|
+
- lib/decidim/core/test/shared_examples/resource_endorsed_event_examples.rb
|
2480
2482
|
- lib/decidim/core/test/shared_examples/resource_search_examples.rb
|
2481
2483
|
- lib/decidim/core/test/shared_examples/resourceable.rb
|
2482
2484
|
- lib/decidim/core/test/shared_examples/rich_text_editor_examples.rb
|
@@ -2495,9 +2497,11 @@ files:
|
|
2495
2497
|
- lib/decidim/core/test/shared_examples/traceable_interface_examples.rb
|
2496
2498
|
- lib/decidim/core/test/shared_examples/translated_event_examples.rb
|
2497
2499
|
- lib/decidim/core/test/shared_examples/uncommentable_component_examples.rb
|
2500
|
+
- lib/decidim/core/test/shared_examples/versions_controller_examples.rb
|
2498
2501
|
- lib/decidim/core/test/shared_examples/with_endorsable_permissions_examples.rb
|
2499
2502
|
- lib/decidim/core/version.rb
|
2500
2503
|
- lib/decidim/db/common-passwords.txt
|
2504
|
+
- lib/decidim/dependency_resolver.rb
|
2501
2505
|
- lib/decidim/deprecations.rb
|
2502
2506
|
- lib/decidim/diffy_extension.rb
|
2503
2507
|
- lib/decidim/download_your_data.rb
|
@@ -1,41 +0,0 @@
|
|
1
|
-
<h2><%= t("devise.registrations.edit.title", resource: resource_class.model_name.human) %></h2>
|
2
|
-
|
3
|
-
<%= decidim_form_for(resource, namespace: "registration", as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
|
4
|
-
<%= render "devise/shared/error_messages", resource: resource %>
|
5
|
-
<%= form_required_explanation %>
|
6
|
-
<%= invisible_captcha %>
|
7
|
-
|
8
|
-
<div class="field">
|
9
|
-
<%= f.email_field :email, autocomplete: "email" %>
|
10
|
-
</div>
|
11
|
-
|
12
|
-
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
|
13
|
-
<p>
|
14
|
-
<%= t("devise.registrations.edit.currently_waiting_confirmation_for_email", email: resource.unconfirmed_email) %>
|
15
|
-
</p>
|
16
|
-
<% end %>
|
17
|
-
|
18
|
-
<div class="field">
|
19
|
-
<%= f.password_field :password, password_field_options_for(current_user) %>
|
20
|
-
</div>
|
21
|
-
|
22
|
-
<div class="field">
|
23
|
-
<%= f.password_field :password_confirmation, password_field_options_for(current_user).except(:help_text) %>
|
24
|
-
</div>
|
25
|
-
|
26
|
-
<div class="field">
|
27
|
-
<%= f.password_field :current_password, autocomplete: "current-password" %>
|
28
|
-
</div>
|
29
|
-
|
30
|
-
<div class="field">
|
31
|
-
<%= f.text_field :name, autocomplete: "name" %>
|
32
|
-
</div>
|
33
|
-
|
34
|
-
<div><%= f.submit t("devise.registrations.edit.update") %></div>
|
35
|
-
<% end %>
|
36
|
-
|
37
|
-
<h3><%= t("devise.registrations.edit.cancel_my_account") %></h3>
|
38
|
-
|
39
|
-
<p><%= t("devise.registrations.edit.unhappy") %> <%= link_to t("devise.registrations.edit.cancel_my_account"), registration_path(resource_name), data: { confirm: t("devise.registrations.edit.are_you_sure") }, method: :delete %>.</p>
|
40
|
-
|
41
|
-
<%= link_to t("devise.shared.links.back"), :back %>
|
@@ -1,8 +0,0 @@
|
|
1
|
-
<div class="cookie-warning flex-center padding-1 hide">
|
2
|
-
<p>
|
3
|
-
<%= t("layouts.decidim.cookie_consent.warning.need_cookies", cookies: t("layouts.decidim.cookie_consent.warning.all_cookies")) %>
|
4
|
-
</p>
|
5
|
-
<a href="#" class="button margin-vertical-2" data-open="cc-modal">
|
6
|
-
<%= t("change_cookie_settings", scope: "layouts.decidim.cookie_consent.warning") %>
|
7
|
-
</a>
|
8
|
-
</div>
|