decidim-core 0.28.0 → 0.28.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (246) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/activity_cell.rb +2 -2
  3. data/app/cells/decidim/address/online.erb +27 -9
  4. data/app/cells/decidim/address/show.erb +27 -12
  5. data/app/cells/decidim/address_cell.rb +29 -0
  6. data/app/cells/decidim/announcement/show.erb +2 -2
  7. data/app/cells/decidim/author/show.erb +5 -5
  8. data/app/cells/decidim/authorization_modal/show.erb +8 -4
  9. data/app/cells/decidim/authorization_modal_cell.rb +1 -0
  10. data/app/cells/decidim/card/show.erb +1 -1
  11. data/app/cells/decidim/card_metadata/show.erb +2 -2
  12. data/app/cells/decidim/card_metadata_cell.rb +3 -3
  13. data/app/cells/decidim/coauthorships_cell.rb +1 -1
  14. data/app/cells/decidim/content_blocks/menu_breadcrumb_last_activity_cell.rb +6 -0
  15. data/app/cells/decidim/content_blocks/participatory_space_hero_cell.rb +20 -4
  16. data/app/cells/decidim/content_blocks/participatory_space_hero_settings_form/show.erb +8 -0
  17. data/app/cells/decidim/content_blocks/participatory_space_hero_settings_form_cell.rb +13 -0
  18. data/app/cells/decidim/content_blocks/participatory_space_metadata_cell.rb +1 -1
  19. data/app/cells/decidim/data_consent/category.erb +1 -1
  20. data/app/cells/decidim/footer_pages_cell.rb +3 -3
  21. data/app/cells/decidim/nav_links/show.erb +2 -2
  22. data/app/cells/decidim/notification/moderated.erb +12 -0
  23. data/app/cells/decidim/notification_cell.rb +5 -1
  24. data/app/cells/decidim/profile/details.erb +1 -1
  25. data/app/cells/decidim/profile/tabs.erb +3 -2
  26. data/app/cells/decidim/progress_bar/show.erb +1 -1
  27. data/app/cells/decidim/progress_bar_cell.rb +2 -0
  28. data/app/cells/decidim/report_button/flag_modal.erb +5 -1
  29. data/app/cells/decidim/resource_types_filter/show.erb +3 -3
  30. data/app/cells/decidim/statistic/show.erb +2 -2
  31. data/app/cells/decidim/tags_cell.rb +3 -1
  32. data/app/cells/decidim/upload_modal/modal.erb +1 -2
  33. data/app/commands/decidim/create_omniauth_registration.rb +1 -3
  34. data/app/commands/decidim/messaging/reply_to_conversation.rb +3 -0
  35. data/app/commands/decidim/messaging/start_conversation.rb +3 -0
  36. data/app/controllers/concerns/decidim/devise_authentication_methods.rb +36 -0
  37. data/app/controllers/concerns/decidim/force_authentication.rb +1 -1
  38. data/app/controllers/concerns/decidim/paginable.rb +1 -1
  39. data/app/controllers/concerns/decidim/use_organization_time_zone.rb +1 -1
  40. data/app/controllers/decidim/devise/omniauth_registrations_controller.rb +1 -22
  41. data/app/controllers/decidim/devise/sessions_controller.rb +1 -24
  42. data/app/controllers/decidim/gamification/badges_controller.rb +2 -0
  43. data/app/controllers/decidim/links_controller.rb +15 -2
  44. data/app/events/decidim/welcome_notification_event.rb +6 -9
  45. data/app/helpers/concerns/decidim/flash_helper_extensions.rb +2 -2
  46. data/app/helpers/decidim/application_helper.rb +0 -18
  47. data/app/helpers/decidim/cells_paginate_helper.rb +1 -1
  48. data/app/helpers/decidim/check_boxes_tree_helper.rb +7 -8
  49. data/app/helpers/decidim/layout_helper.rb +1 -1
  50. data/app/helpers/decidim/map_helper.rb +1 -1
  51. data/app/helpers/decidim/menu_helper.rb +2 -0
  52. data/app/helpers/decidim/newsletters_helper.rb +83 -16
  53. data/app/helpers/decidim/paginate_helper.rb +1 -1
  54. data/app/helpers/decidim/sanitize_helper.rb +9 -0
  55. data/app/helpers/decidim/social_share_button_helper.rb +1 -1
  56. data/app/helpers/decidim/user_profile_helper.rb +7 -2
  57. data/app/mailers/decidim/application_mailer.rb +40 -6
  58. data/app/mailers/decidim/messaging/conversation_mailer.rb +3 -72
  59. data/app/models/decidim/push_notification_message.rb +38 -0
  60. data/app/packs/entrypoints/decidim_overrides.scss +2 -0
  61. data/app/packs/images/decidim/.keep +0 -0
  62. data/app/packs/src/decidim/a11y.js +15 -1
  63. data/app/packs/src/decidim/abide_form_validator_fixer.js +44 -0
  64. data/app/packs/src/decidim/account_form.js +1 -1
  65. data/app/packs/src/decidim/data_consent/consent_manager.test.js +1 -1
  66. data/app/packs/src/decidim/data_consent/index.js +1 -1
  67. data/app/packs/src/decidim/direct_uploads/upload_field.js +1 -1
  68. data/app/packs/src/decidim/direct_uploads/upload_modal.js +5 -5
  69. data/app/packs/src/decidim/editor/extensions/hashtag/index.js +1 -1
  70. data/app/packs/src/decidim/editor/extensions/mention/index.js +1 -1
  71. data/app/packs/src/decidim/editor/extensions/video_embed/index.js +3 -0
  72. data/app/packs/src/decidim/editor/test/editor/create.test.js +1 -1
  73. data/app/packs/src/decidim/editor/test/extensions/bold.test.js +2 -3
  74. data/app/packs/src/decidim/editor/test/extensions/character_count.test.js +2 -2
  75. data/app/packs/src/decidim/editor/test/extensions/decidim_kit.test.js +2 -3
  76. data/app/packs/src/decidim/editor/test/extensions/dialog.test.js +2 -2
  77. data/app/packs/src/decidim/editor/test/extensions/emoji.test.js +2 -2
  78. data/app/packs/src/decidim/editor/test/extensions/hashtag.test.js +2 -2
  79. data/app/packs/src/decidim/editor/test/extensions/heading.test.js +2 -2
  80. data/app/packs/src/decidim/editor/test/extensions/image.test.js +4 -4
  81. data/app/packs/src/decidim/editor/test/extensions/indent.test.js +2 -2
  82. data/app/packs/src/decidim/editor/test/extensions/link.test.js +3 -3
  83. data/app/packs/src/decidim/editor/test/extensions/mention.test.js +2 -2
  84. data/app/packs/src/decidim/editor/test/extensions/ordered_list.test.js +2 -2
  85. data/app/packs/src/decidim/editor/test/extensions/video_embed.test.js +3 -3
  86. data/app/packs/src/decidim/editor/test/helpers.js +5 -4
  87. data/app/packs/src/decidim/editor/test/toolbar/basic.test.js +2 -2
  88. data/app/packs/src/decidim/editor/test/toolbar/content.test.js +2 -2
  89. data/app/packs/src/decidim/editor/test/toolbar/full.test.js +3 -3
  90. data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic.js +6 -6
  91. data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic_block.js +2 -2
  92. data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic_formatting.js +1 -1
  93. data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic_indent.js +2 -2
  94. data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic_link.js +2 -2
  95. data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic_list.js +2 -2
  96. data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic_styling.js +2 -2
  97. data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_content.js +7 -7
  98. data/app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_content_styling.js +2 -2
  99. data/app/packs/src/decidim/editor/test/toolbar/shared/context.js +1 -1
  100. data/app/packs/src/decidim/editor/test/utilities/paste_transform.test.js +2 -2
  101. data/app/packs/src/decidim/external_domain_warning.js +13 -0
  102. data/app/packs/src/decidim/external_domain_warning.test.js +1 -1
  103. data/app/packs/src/decidim/external_link.js +48 -9
  104. data/app/packs/src/decidim/external_link.test.js +1 -1
  105. data/app/packs/src/decidim/focus_guard.js +8 -20
  106. data/app/packs/src/decidim/form_filter.component_for_testing.js +1 -1
  107. data/app/packs/src/decidim/form_filter.js +3 -3
  108. data/app/packs/src/decidim/geocoding/attach_input.js +1 -1
  109. data/app/packs/src/decidim/i18n.test.js +1 -1
  110. data/app/packs/src/decidim/index.js +33 -2
  111. data/app/packs/src/decidim/input_hashtags.js +1 -1
  112. data/app/packs/src/decidim/input_mentions.js +1 -1
  113. data/app/packs/src/decidim/input_multiple_mentions.js +1 -1
  114. data/app/packs/src/decidim/sw/index.js +3 -3
  115. data/app/packs/src/decidim/user_registrations.js +1 -1
  116. data/app/packs/src/decidim/vizzs/index.js +1 -1
  117. data/app/packs/stylesheets/decidim/_accordion.scss +2 -2
  118. data/app/packs/stylesheets/decidim/_cards.scss +4 -4
  119. data/app/packs/stylesheets/decidim/_dropdown.scss +2 -2
  120. data/app/packs/stylesheets/decidim/_layout.scss +7 -7
  121. data/app/packs/stylesheets/decidim/_modal_update.scss +1 -3
  122. data/app/packs/stylesheets/decidim/application.scss +0 -3
  123. data/app/packs/stylesheets/decidim/decidim_application.scss +4 -0
  124. data/app/packs/stylesheets/decidim/legacy/leaflet.scss +88 -107
  125. data/app/presenters/decidim/admin_log/oauth_application_resource_presenter.rb +1 -1
  126. data/app/presenters/decidim/admin_log/organization_presenter.rb +1 -1
  127. data/app/presenters/decidim/log/diff_presenter.rb +1 -1
  128. data/app/presenters/decidim/log/resource_presenter.rb +7 -1
  129. data/app/presenters/decidim/notification_to_mailer_presenter.rb +9 -0
  130. data/app/services/decidim/events_manager.rb +6 -0
  131. data/app/services/decidim/iframe_disabler.rb +4 -0
  132. data/app/services/decidim/log/diff_changeset_calculator.rb +1 -1
  133. data/app/services/decidim/push_notification_message_sender.rb +40 -0
  134. data/app/services/decidim/send_push_notification.rb +22 -8
  135. data/app/uploaders/decidim/background_image_uploader.rb +11 -0
  136. data/app/views/decidim/account/show.html.erb +2 -2
  137. data/app/views/decidim/application/_collection.html.erb +2 -2
  138. data/app/views/decidim/application/_document.html.erb +3 -3
  139. data/app/views/decidim/devise/registrations/new.html.erb +2 -2
  140. data/app/views/decidim/endorsements/update_buttons_and_counters.js.erb +2 -1
  141. data/app/views/decidim/gamification/badges/index.html.erb +34 -33
  142. data/app/views/decidim/links/_modal.html.erb +1 -1
  143. data/app/views/decidim/links/new.html.erb +3 -1
  144. data/app/views/decidim/manifests/show.json.erb +1 -1
  145. data/app/views/decidim/messaging/conversations/create.js.erb +1 -1
  146. data/app/views/decidim/notifications_digest_mailer/_email_content.html.erb +7 -0
  147. data/app/views/decidim/notifications_settings/show.html.erb +6 -6
  148. data/app/views/decidim/offline/show.html.erb +15 -9
  149. data/app/views/decidim/pages/_tabbed.html.erb +2 -2
  150. data/app/views/decidim/searches/_filters.html.erb +2 -2
  151. data/app/views/decidim/shared/_filters.html.erb +2 -2
  152. data/app/views/decidim/shared/_orders.html.erb +2 -2
  153. data/app/views/decidim/shared/filters/_collection.html.erb +5 -3
  154. data/app/views/decidim/shared/filters/_dropdown_label.html.erb +21 -19
  155. data/app/views/layouts/decidim/_head.html.erb +1 -0
  156. data/app/views/layouts/decidim/_js_configuration.html.erb +3 -1
  157. data/app/views/layouts/decidim/_wrapper.html.erb +1 -1
  158. data/app/views/layouts/decidim/footer/_main_links.html.erb +3 -1
  159. data/app/views/layouts/decidim/footer/_main_social_media_links.html.erb +5 -5
  160. data/app/views/layouts/decidim/footer/_mini.html.erb +2 -2
  161. data/app/views/layouts/decidim/header/_main_links_desktop.html.erb +4 -2
  162. data/app/views/layouts/decidim/header/_menu_breadcrumb_items.html.erb +2 -0
  163. data/app/views/layouts/decidim/header/_menu_breadcrumb_mobile_tablet.html.erb +1 -1
  164. data/app/views/layouts/decidim/shared/_layout_user_profile.html.erb +2 -2
  165. data/config/assets.rb +1 -0
  166. data/config/locales/ar.yml +60 -8
  167. data/config/locales/bg.yml +909 -2
  168. data/config/locales/ca.yml +31 -24
  169. data/config/locales/cs.yml +7 -3
  170. data/config/locales/de.yml +37 -30
  171. data/config/locales/el.yml +11 -7
  172. data/config/locales/en.yml +10 -3
  173. data/config/locales/es-MX.yml +17 -10
  174. data/config/locales/es-PY.yml +17 -10
  175. data/config/locales/es.yml +59 -52
  176. data/config/locales/eu.yml +26 -10
  177. data/config/locales/fi-plain.yml +11 -4
  178. data/config/locales/fi.yml +14 -7
  179. data/config/locales/fr-CA.yml +14 -7
  180. data/config/locales/fr.yml +14 -7
  181. data/config/locales/ga-IE.yml +9 -0
  182. data/config/locales/gl.yml +5 -2
  183. data/config/locales/he-IL.yml +1 -0
  184. data/config/locales/hu.yml +264 -8
  185. data/config/locales/id-ID.yml +0 -2
  186. data/config/locales/it.yml +9 -6
  187. data/config/locales/ja.yml +14 -7
  188. data/config/locales/kaa.yml +5 -0
  189. data/config/locales/lb.yml +9 -6
  190. data/config/locales/lt.yml +8 -12
  191. data/config/locales/lv.yml +8 -3
  192. data/config/locales/nl.yml +8 -3
  193. data/config/locales/no.yml +9 -6
  194. data/config/locales/pl.yml +616 -2
  195. data/config/locales/pt-BR.yml +202 -19
  196. data/config/locales/pt.yml +9 -6
  197. data/config/locales/ro-RO.yml +10 -5
  198. data/config/locales/ru.yml +15 -2
  199. data/config/locales/sk.yml +8 -3
  200. data/config/locales/sl.yml +8 -0
  201. data/config/locales/sv.yml +32 -6
  202. data/config/locales/tr-TR.yml +24 -9
  203. data/config/locales/uk.yml +22 -2
  204. data/config/locales/zh-CN.yml +0 -6
  205. data/config/locales/zh-TW.yml +10 -11
  206. data/decidim-core.gemspec +90 -0
  207. data/lib/decidim/asset_router/storage.rb +2 -0
  208. data/lib/decidim/attribute_encryptor.rb +6 -4
  209. data/lib/decidim/attributes/time_with_zone.rb +1 -1
  210. data/lib/decidim/core/engine.rb +7 -6
  211. data/lib/decidim/core/seeds.rb +37 -33
  212. data/lib/decidim/core/test/factories.rb +296 -89
  213. data/lib/decidim/core/test/shared_examples/amendable/amendment_created_event_examples.rb +6 -26
  214. data/lib/decidim/core/test/shared_examples/amendable/amendment_promoted_event_examples.rb +8 -26
  215. data/lib/decidim/core/test/shared_examples/comments_examples.rb +76 -6
  216. data/lib/decidim/core/test/shared_examples/has_attachment_collections.rb +8 -6
  217. data/lib/decidim/core/test/shared_examples/has_attachments.rb +8 -8
  218. data/lib/decidim/core/test/shared_examples/has_category.rb +27 -0
  219. data/lib/decidim/core/test/shared_examples/has_reference.rb +1 -1
  220. data/lib/decidim/core/test/shared_examples/has_space_in_mcell_examples.rb +1 -1
  221. data/lib/decidim/core/test/shared_examples/logo_email.rb +2 -2
  222. data/lib/decidim/core/test/shared_examples/map_examples.rb +3 -0
  223. data/lib/decidim/core/test/shared_examples/resource_endorsed_event_examples.rb +5 -2
  224. data/lib/decidim/core/test/shared_examples/resource_locator_presenter_examples.rb +134 -0
  225. data/lib/decidim/core/test/shared_examples/simple_event.rb +18 -2
  226. data/lib/decidim/core/test.rb +1 -0
  227. data/lib/decidim/core/version.rb +1 -1
  228. data/lib/decidim/core.rb +7 -1
  229. data/lib/decidim/engine_router.rb +17 -4
  230. data/lib/decidim/events/base_event.rb +7 -3
  231. data/lib/decidim/events/simple_event.rb +3 -17
  232. data/lib/decidim/form_builder.rb +8 -2
  233. data/lib/decidim/has_category.rb +1 -1
  234. data/lib/decidim/has_conversations.rb +91 -0
  235. data/lib/decidim/organization_settings.rb +10 -2
  236. data/lib/decidim/participable.rb +17 -0
  237. data/lib/decidim/upgrade/wysiwyg_migrator.rb +7 -0
  238. data/lib/decidim/view_model.rb +1 -0
  239. data/lib/decidim/webpacker/webpack/.modernizrrc +9 -0
  240. data/lib/premailer/adapter/decidim.rb +5 -4
  241. data/lib/tasks/decidim_reminders_tasks.rake +1 -0
  242. data/lib/tasks/upgrade/decidim_fix_categorization.rake +15 -0
  243. metadata +26 -27
  244. data/app/views/decidim/searches/index.js.erb +0 -7
  245. data/config/brakeman.ignore +0 -37
  246. data/config/environment.rb +0 -3
data/lib/decidim/core.rb CHANGED
@@ -122,6 +122,7 @@ module Decidim
122
122
  autoload :ModerationTools, "decidim/moderation_tools"
123
123
  autoload :ContentSecurityPolicy, "decidim/content_security_policy"
124
124
  autoload :IconRegistry, "decidim/icon_registry"
125
+ autoload :HasConversations, "decidim/has_conversations"
125
126
 
126
127
  include ActiveSupport::Configurable
127
128
  # Loads seeds from all engines.
@@ -190,8 +191,13 @@ module Decidim
190
191
  resource_type.constantize.find_each do |resource|
191
192
  # exclude the users that already endorsed
192
193
  users = resource.endorsements.map(&:author)
193
- rand(50).times do
194
+ remaining_count = Decidim::User.count - users.count
195
+ next if remaining_count < 1
196
+
197
+ rand([50, remaining_count].min).times do
194
198
  user = (Decidim::User.all - users).sample
199
+ next unless user
200
+
195
201
  Decidim::Endorsement.create!(resource:, author: user)
196
202
  users << user
197
203
  end
@@ -16,7 +16,7 @@ module Decidim
16
16
  #
17
17
  # @return [EngineRouter] The new engine router
18
18
  def self.main_proxy(target)
19
- new(target.mounted_engine, target.mounted_params)
19
+ new(target.mounted_engine, target.mounted_params, target)
20
20
  end
21
21
 
22
22
  # Instantiates a router to the backend engine for an object.
@@ -25,12 +25,13 @@ module Decidim
25
25
  #
26
26
  # @return [EngineRouter] The new engine router
27
27
  def self.admin_proxy(target)
28
- new(target.mounted_admin_engine, target.mounted_params)
28
+ new(target.mounted_admin_engine, target.mounted_params, target)
29
29
  end
30
30
 
31
- def initialize(engine, default_url_options)
31
+ def initialize(engine, default_url_options, target = nil)
32
32
  @engine = engine
33
33
  @default_url_options = default_url_options
34
+ @target = target
34
35
  end
35
36
 
36
37
  def default_url_options
@@ -44,11 +45,23 @@ module Decidim
44
45
  def method_missing(method_name, *args)
45
46
  return super unless route_helper?(method_name)
46
47
 
47
- send(@engine).send(method_name, *args)
48
+ filter_slug_params!(method_name)
49
+
50
+ send(engine).send(method_name, *args)
48
51
  end
49
52
 
50
53
  private
51
54
 
55
+ attr_reader :engine, :target
56
+
57
+ def filter_slug_params!(method_name)
58
+ return if target.nil?
59
+ return unless target.respond_to?(:mounted_params)
60
+
61
+ skip_space_slug = target.respond_to?(:slug_param_name) && target.respond_to?(:skip_space_slug?) && target.skip_space_slug?(method_name)
62
+ @default_url_options.except!(target.slug_param_name) if skip_space_slug == true
63
+ end
64
+
52
65
  def route_helper?(method_name)
53
66
  method_name.to_s.match?(/_(url|path)$/)
54
67
  end
@@ -7,7 +7,7 @@ module Decidim
7
7
  # notifications dashboard and to generate other notifications (emails, for example).
8
8
  class BaseEvent
9
9
  extend ActiveModel::Translation
10
- include Decidim::TranslatableAttributes
10
+ include Decidim::SanitizeHelper
11
11
 
12
12
  class_attribute :types
13
13
  self.types = []
@@ -103,14 +103,18 @@ module Decidim
103
103
  return unless resource
104
104
 
105
105
  title = if resource.respond_to?(:title)
106
- translated_attribute(resource.title)
106
+ decidim_sanitize_translated(resource.title)
107
107
  elsif resource.respond_to?(:name)
108
- translated_attribute(resource.name)
108
+ decidim_sanitize_translated(resource.name)
109
109
  end
110
110
 
111
111
  Decidim::ContentProcessor.render_without_format(title, links: false).html_safe
112
112
  end
113
113
 
114
+ def hidden_resource?
115
+ resource.respond_to?(:hidden?) && resource.hidden?
116
+ end
117
+
114
118
  private
115
119
 
116
120
  def component
@@ -11,7 +11,6 @@ module Decidim
11
11
  include Decidim::Events::EmailEvent
12
12
  include Decidim::Events::NotificationEvent
13
13
  include Decidim::ComponentPathHelper
14
- include Decidim::SanitizeHelper
15
14
 
16
15
  delegate :created_at, to: :resource
17
16
 
@@ -34,14 +33,7 @@ module Decidim
34
33
  end
35
34
 
36
35
  def email_subject
37
- I18n.t("email_subject", **email_subject_i18n_options).html_safe
38
- end
39
-
40
- def email_subject_i18n_options
41
- sanitized_values = { resource_title: decidim_sanitize(resource_title) }
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)
44
- i18n_options.merge(sanitized_values)
36
+ I18n.t("email_subject", **i18n_options).html_safe
45
37
  end
46
38
 
47
39
  def email_intro
@@ -77,13 +69,7 @@ module Decidim
77
69
 
78
70
  # Public: The Hash of options to pass to the I18.t method.
79
71
  def i18n_options
80
- default_i18n_options.merge(event_interpolations).transform_values do |value|
81
- if value.is_a?(String)
82
- decidim_html_escape(value)
83
- else
84
- value
85
- end
86
- end
72
+ default_i18n_options.merge(event_interpolations)
87
73
  end
88
74
 
89
75
  # Caches the path for the given resource when it is a Decidim::Component.
@@ -136,7 +122,7 @@ module Decidim
136
122
  end
137
123
 
138
124
  def participatory_space_title
139
- translated_attribute(participatory_space.try(:title))
125
+ decidim_sanitize_translated(participatory_space.try(:title))
140
126
  end
141
127
  end
142
128
  end
@@ -79,7 +79,7 @@ module Decidim
79
79
  tabs_content = content_tag(:div, class: "tabs-content", data: { tabs_content: tabs_id }) do
80
80
  locales.each_with_index.inject("".html_safe) do |string, (locale, index)|
81
81
  tab_content_id = "#{tabs_id}-#{name}-panel-#{index}"
82
- string + content_tag(:div, class: tab_element_class_for("panel", index), id: tab_content_id) do
82
+ string + content_tag(:div, class: tab_element_class_for("panel", index), id: tab_content_id, "aria-hidden": tab_attr_aria_hidden_for(index)) do
83
83
  if hashtaggable
84
84
  hashtaggable_text_field(type, name, locale, options.merge(label: false))
85
85
  elsif type.to_sym == :editor
@@ -164,7 +164,7 @@ module Decidim
164
164
  tabs_content = content_tag(:div, class: "tabs-content", data: { tabs_content: tabs_id }) do
165
165
  handlers.each_with_index.inject("".html_safe) do |string, (handler, index)|
166
166
  tab_content_id = sanitize_tabs_selector "#{tabs_id}-#{name}-panel-#{index}"
167
- string + content_tag(:div, class: tab_element_class_for("panel", index), id: tab_content_id) do
167
+ string + content_tag(:div, class: tab_element_class_for("panel", index), id: tab_content_id, "aria-hidden": tab_attr_aria_hidden_for(index)) do
168
168
  send(type, "#{handler}_handler", options.merge(label: false))
169
169
  end
170
170
  end
@@ -746,6 +746,12 @@ module Decidim
746
746
  element_class
747
747
  end
748
748
 
749
+ def tab_attr_aria_hidden_for(index)
750
+ return "false" if index.zero?
751
+
752
+ "true"
753
+ end
754
+
749
755
  def locales
750
756
  @locales ||= if @template.respond_to?(:available_locales)
751
757
  Set.new([@template.current_locale] + @template.available_locales).to_a
@@ -8,7 +8,7 @@ module Decidim
8
8
  extend ActiveSupport::Concern
9
9
 
10
10
  included do
11
- has_one :categorization, as: :categorizable
11
+ has_one :categorization, as: :categorizable, class_name: "Decidim::Categorization", dependent: :destroy
12
12
  has_one :category, through: :categorization
13
13
 
14
14
  scope :with_category, lambda { |category|
@@ -0,0 +1,91 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "active_support/concern"
4
+
5
+ module Decidim
6
+ module HasConversations
7
+ extend ActiveSupport::Concern
8
+
9
+ included do
10
+ def new_conversation(originator, user, conversation)
11
+ send_notification(
12
+ from: originator,
13
+ to: user,
14
+ conversation:,
15
+ message: conversation.messages.first.body,
16
+ action: "new_conversation"
17
+ )
18
+ end
19
+
20
+ def new_group_conversation(originator, manager, conversation, group)
21
+ send_notification(
22
+ from: originator,
23
+ to: manager,
24
+ conversation:,
25
+ message: conversation.messages.first.body,
26
+ action: "new_group_conversation",
27
+ third_party: group
28
+ )
29
+ end
30
+
31
+ def comanagers_new_conversation(group, user, conversation, manager)
32
+ send_notification(
33
+ from: group,
34
+ to: user,
35
+ conversation:,
36
+ message: conversation.messages.first.body,
37
+ action: "comanagers_new_conversation",
38
+ third_party: manager
39
+ )
40
+ end
41
+
42
+ def new_message(sender, user, conversation, message)
43
+ send_notification(
44
+ from: sender,
45
+ to: user,
46
+ conversation:,
47
+ message: message.body,
48
+ action: "new_message"
49
+ )
50
+ end
51
+
52
+ def new_group_message(sender, user, conversation, message, group)
53
+ send_notification(
54
+ from: sender,
55
+ to: user,
56
+ conversation:,
57
+ message: message.body,
58
+ action: "new_group_message",
59
+ third_party: group
60
+ )
61
+ end
62
+
63
+ def comanagers_new_message(sender, user, conversation, message, manager)
64
+ send_notification(
65
+ from: sender,
66
+ to: user,
67
+ conversation:,
68
+ message: message.body,
69
+ action: "comanagers_new_message",
70
+ third_party: manager
71
+ )
72
+ end
73
+
74
+ private
75
+
76
+ def get_subject(action:, sender:, third_party:)
77
+ I18n.t(
78
+ "conversation_mailer.#{action}.subject",
79
+ scope: "decidim.messaging",
80
+ sender: sender.name,
81
+ manager: third_party&.name,
82
+ group: third_party&.name
83
+ )
84
+ end
85
+
86
+ def send_notification
87
+ raise NotImplementedError, "You must define a send_notification method"
88
+ end
89
+ end
90
+ end
91
+ end
@@ -129,12 +129,20 @@ module Decidim
129
129
  )
130
130
  },
131
131
  "maximum_file_size" => {
132
- "default" => 10.0,
133
- "avatar" => 5.0
132
+ "default" => default_maximum_attachment_size,
133
+ "avatar" => default_maximum_avatar_size
134
134
  }
135
135
  }
136
136
  }
137
137
  end
138
+
139
+ def default_maximum_attachment_size
140
+ (Rails.application.secrets.decidim[:maximum_attachment_size].presence || 10).to_f
141
+ end
142
+
143
+ def default_maximum_avatar_size
144
+ (Rails.application.secrets.decidim[:maximum_avatar_size].presence || 5).to_f
145
+ end
138
146
  end
139
147
 
140
148
  def initialize(organization)
@@ -12,6 +12,23 @@ module Decidim
12
12
  :mounted_engine, :mounted_admin_engine, :admin_extension_module, :admins_query,
13
13
  to: :class
14
14
 
15
+ def skip_space_slug?(method_name)
16
+ [
17
+ "edit_#{underscored_name}_path".to_sym,
18
+ "edit_#{underscored_name}_url".to_sym,
19
+ "new_#{underscored_name}_path".to_sym,
20
+ "new_#{underscored_name}_url".to_sym,
21
+ "#{underscored_name}_path".to_sym,
22
+ "#{underscored_name}_url".to_sym,
23
+ "#{underscored_name.pluralize}_path".to_sym,
24
+ "#{underscored_name.pluralize}_url".to_sym
25
+ ].include?(method_name)
26
+ end
27
+
28
+ def slug_param_name
29
+ "#{underscored_name}_slug".to_sym
30
+ end
31
+
15
32
  def mounted_params
16
33
  {
17
34
  host: organization.host,
@@ -258,6 +258,9 @@ module Decidim
258
258
  parent
259
259
  end
260
260
 
261
+ # rubocop: disable Metrics/CyclomaticComplexity
262
+ # rubocop: disable Metrics/PerceivedComplexity
263
+
261
264
  # Quill.js did not support multi-level lists which is why it used a CSS
262
265
  # hack to make it visually look like the list has multiple levels. This
263
266
  # is not semantically correct but for users with no visual impairments it
@@ -321,6 +324,8 @@ module Decidim
321
324
  current_parent = parent
322
325
  current_level = 0
323
326
  list.children.each do |item|
327
+ next unless item.is_a?(Nokogiri::XML::Element) && item.name == "li"
328
+
324
329
  indent = detect_indent(item)
325
330
  if indent == current_level || li.nil?
326
331
  if item.child.name == "p"
@@ -356,6 +361,8 @@ module Decidim
356
361
 
357
362
  parent
358
363
  end
364
+ # rubocop: enable Metrics/CyclomaticComplexity
365
+ # rubocop: enable Metrics/PerceivedComplexity
359
366
 
360
367
  # Converts iframe embeds to the new format. We assume all iframes are
361
368
  # video embeds as this the only type of embed what Quill.js supported and
@@ -16,6 +16,7 @@ module Decidim
16
16
  include Cell::Caching::Notifications
17
17
  include Decidim::MarkupHelper
18
18
  include Decidim::LayoutHelper
19
+ include Decidim::SanitizeHelper
19
20
 
20
21
  delegate :current_organization, to: :controller
21
22
 
@@ -0,0 +1,9 @@
1
+ {
2
+ "minify": true,
3
+ "options": [
4
+ "setClasses"
5
+ ],
6
+ "feature-detects": [
7
+ "css/transitions"
8
+ ]
9
+ }
@@ -16,15 +16,16 @@ class Premailer
16
16
  # @return [String] a plain text.
17
17
  def to_plain_text
18
18
  html_src = begin
19
+ @doc.css("style").remove
19
20
  @doc.at("body").inner_html
20
21
  rescue StandardError
21
22
  ""
22
23
  end
23
24
 
24
- html_src = @doc.to_html unless html_src && html_src.present?
25
-
26
- # remove style tags and content
27
- html_src.gsub!(%r{<style.*?/style>}m, "")
25
+ unless html_src && html_src.present?
26
+ @doc.css("style").remove
27
+ html_src = @doc.to_html
28
+ end
28
29
 
29
30
  convert_to_text(html_src, @options[:line_length], @html_encoding)
30
31
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  namespace :decidim do
4
4
  namespace :reminders do
5
+ desc "Sends all the email reminders defined in the manifests"
5
6
  task :all, [] => :environment do
6
7
  Decidim.reminders_registry.all.each do |reminder_manifest|
7
8
  call_reminder_job(reminder_manifest)
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ namespace :decidim do
4
+ namespace :upgrade do
5
+ desc "Remove orphan categorizations"
6
+ task fix_orphan_categorizations: :environment do
7
+ logger = Logger.new($stdout)
8
+ logger.info("Removing orphan categorizations...")
9
+
10
+ Decidim::Categorization.find_each do |categorization|
11
+ categorization.destroy if categorization.categorizable.nil?
12
+ end
13
+ end
14
+ end
15
+ 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.28.0
4
+ version: 0.28.2
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-12-20 00:00:00.000000000 Z
13
+ date: 2024-07-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: active_link_to
@@ -390,20 +390,6 @@ dependencies:
390
390
  - - "~>"
391
391
  - !ruby/object:Gem::Version
392
392
  version: '4.9'
393
- - !ruby/object:Gem::Dependency
394
- name: mustache
395
- requirement: !ruby/object:Gem::Requirement
396
- requirements:
397
- - - "~>"
398
- - !ruby/object:Gem::Version
399
- version: 1.1.0
400
- type: :runtime
401
- prerelease: false
402
- version_requirements: !ruby/object:Gem::Requirement
403
- requirements:
404
- - - "~>"
405
- - !ruby/object:Gem::Version
406
- version: 1.1.0
407
393
  - !ruby/object:Gem::Dependency
408
394
  name: net-smtp
409
395
  requirement: !ruby/object:Gem::Requirement
@@ -778,28 +764,28 @@ dependencies:
778
764
  requirements:
779
765
  - - '='
780
766
  - !ruby/object:Gem::Version
781
- version: 0.28.0
782
- type: :runtime
767
+ version: 0.28.2
768
+ type: :development
783
769
  prerelease: false
784
770
  version_requirements: !ruby/object:Gem::Requirement
785
771
  requirements:
786
772
  - - '='
787
773
  - !ruby/object:Gem::Version
788
- version: 0.28.0
774
+ version: 0.28.2
789
775
  - !ruby/object:Gem::Dependency
790
776
  name: decidim-dev
791
777
  requirement: !ruby/object:Gem::Requirement
792
778
  requirements:
793
779
  - - '='
794
780
  - !ruby/object:Gem::Version
795
- version: 0.28.0
781
+ version: 0.28.2
796
782
  type: :development
797
783
  prerelease: false
798
784
  version_requirements: !ruby/object:Gem::Requirement
799
785
  requirements:
800
786
  - - '='
801
787
  - !ruby/object:Gem::Version
802
- version: 0.28.0
788
+ version: 0.28.2
803
789
  description: Adds core features so other engines can hook into the framework.
804
790
  email:
805
791
  - josepjaume@gmail.com
@@ -931,6 +917,8 @@ files:
931
917
  - app/cells/decidim/content_blocks/participatory_space_extra_data_cell.rb
932
918
  - app/cells/decidim/content_blocks/participatory_space_hero/show.erb
933
919
  - app/cells/decidim/content_blocks/participatory_space_hero_cell.rb
920
+ - app/cells/decidim/content_blocks/participatory_space_hero_settings_form/show.erb
921
+ - app/cells/decidim/content_blocks/participatory_space_hero_settings_form_cell.rb
934
922
  - app/cells/decidim/content_blocks/participatory_space_images/content.erb
935
923
  - app/cells/decidim/content_blocks/participatory_space_images_cell.rb
936
924
  - app/cells/decidim/content_blocks/participatory_space_last_activity/content.erb
@@ -1035,6 +1023,7 @@ files:
1035
1023
  - app/cells/decidim/newsletter_templates/image_text_cta_cell.rb
1036
1024
  - app/cells/decidim/newsletter_templates/image_text_cta_settings_form/show.erb
1037
1025
  - app/cells/decidim/newsletter_templates/image_text_cta_settings_form_cell.rb
1026
+ - app/cells/decidim/notification/moderated.erb
1038
1027
  - app/cells/decidim/notification/show.erb
1039
1028
  - app/cells/decidim/notification_cell.rb
1040
1029
  - app/cells/decidim/notifications/show.erb
@@ -1185,6 +1174,7 @@ files:
1185
1174
  - app/commands/decidim/validate_upload.rb
1186
1175
  - app/constraints/decidim/current_component.rb
1187
1176
  - app/controllers/concerns/decidim/amendments_controller.rb
1177
+ - app/controllers/concerns/decidim/devise_authentication_methods.rb
1188
1178
  - app/controllers/concerns/decidim/devise_controllers.rb
1189
1179
  - app/controllers/concerns/decidim/disable_redirection_to_external_host.rb
1190
1180
  - app/controllers/concerns/decidim/filter_resource.rb
@@ -1462,6 +1452,7 @@ files:
1462
1452
  - app/models/decidim/participatory_space_role_config/participatory_space_admin.rb
1463
1453
  - app/models/decidim/participatory_space_role_config/valuator.rb
1464
1454
  - app/models/decidim/permission_action.rb
1455
+ - app/models/decidim/push_notification_message.rb
1465
1456
  - app/models/decidim/reminder.rb
1466
1457
  - app/models/decidim/reminder_delivery.rb
1467
1458
  - app/models/decidim/reminder_record.rb
@@ -1494,6 +1485,7 @@ files:
1494
1485
  - app/packs/entrypoints/decidim_map.scss
1495
1486
  - app/packs/entrypoints/decidim_map_provider_default.js
1496
1487
  - app/packs/entrypoints/decidim_map_provider_here.js
1488
+ - app/packs/entrypoints/decidim_overrides.scss
1497
1489
  - app/packs/entrypoints/decidim_sw.js
1498
1490
  - app/packs/entrypoints/decidim_widget.js
1499
1491
  - app/packs/fonts/decidim/source-sans-pro-v21-cyrillic_cyrillic-ext_greek_greek-ext_latin_latin-ext_vietnamese-600.eot
@@ -1511,6 +1503,7 @@ files:
1511
1503
  - app/packs/fonts/decidim/source-sans-pro-v21-cyrillic_cyrillic-ext_greek_greek-ext_latin_latin-ext_vietnamese-regular.ttf
1512
1504
  - app/packs/fonts/decidim/source-sans-pro-v21-cyrillic_cyrillic-ext_greek_greek-ext_latin_latin-ext_vietnamese-regular.woff
1513
1505
  - app/packs/fonts/decidim/source-sans-pro-v21-cyrillic_cyrillic-ext_greek_greek-ext_latin_latin-ext_vietnamese-regular.woff2
1506
+ - app/packs/images/decidim/.keep
1514
1507
  - app/packs/images/decidim/avatar-multiuser.png
1515
1508
  - app/packs/images/decidim/brands/google.svg
1516
1509
  - app/packs/images/decidim/cc-badge.png
@@ -1546,6 +1539,7 @@ files:
1546
1539
  - app/packs/images/decidim/vendor/social-share-button/x.svg
1547
1540
  - app/packs/images/decidim/vendor/social-share-button/xing.svg
1548
1541
  - app/packs/src/decidim/a11y.js
1542
+ - app/packs/src/decidim/abide_form_validator_fixer.js
1549
1543
  - app/packs/src/decidim/account_form.js
1550
1544
  - app/packs/src/decidim/append_elements.js
1551
1545
  - app/packs/src/decidim/append_redirect_url_to_modals.js
@@ -1879,6 +1873,7 @@ files:
1879
1873
  - app/services/decidim/notifications_digest_sending_decider.rb
1880
1874
  - app/services/decidim/notifications_subscriptions_persistor.rb
1881
1875
  - app/services/decidim/open_data_exporter.rb
1876
+ - app/services/decidim/push_notification_message_sender.rb
1882
1877
  - app/services/decidim/resource_search.rb
1883
1878
  - app/services/decidim/send_push_notification.rb
1884
1879
  - app/services/decidim/settings_change.rb
@@ -1889,6 +1884,7 @@ files:
1889
1884
  - app/uploaders/decidim/application_uploader.rb
1890
1885
  - app/uploaders/decidim/attachment_uploader.rb
1891
1886
  - app/uploaders/decidim/avatar_uploader.rb
1887
+ - app/uploaders/decidim/background_image_uploader.rb
1892
1888
  - app/uploaders/decidim/banner_image_uploader.rb
1893
1889
  - app/uploaders/decidim/cw/application_uploader.rb
1894
1890
  - app/uploaders/decidim/cw/attachment_uploader.rb
@@ -2032,7 +2028,6 @@ files:
2032
2028
  - app/views/decidim/searches/_filters.html.erb
2033
2029
  - app/views/decidim/searches/_resources_filter_block.html.erb
2034
2030
  - app/views/decidim/searches/index.html.erb
2035
- - app/views/decidim/searches/index.js.erb
2036
2031
  - app/views/decidim/shared/_authorization_modal.html.erb
2037
2032
  - app/views/decidim/shared/_comments.html.erb
2038
2033
  - app/views/decidim/shared/_component_announcement.html.erb
@@ -2130,8 +2125,6 @@ files:
2130
2125
  - app/views/layouts/decidim/shared/_linked_resource.html.erb
2131
2126
  - app/views/layouts/decidim/user_profile.html.erb
2132
2127
  - config/assets.rb
2133
- - config/brakeman.ignore
2134
- - config/environment.rb
2135
2128
  - config/initializers/active_support.rb
2136
2129
  - config/initializers/browser.rb
2137
2130
  - config/initializers/carrierwave.rb
@@ -2172,6 +2165,7 @@ files:
2172
2165
  - config/locales/ga-IE.yml
2173
2166
  - config/locales/gl.yml
2174
2167
  - config/locales/gn-PY.yml
2168
+ - config/locales/he-IL.yml
2175
2169
  - config/locales/hr-HR.yml
2176
2170
  - config/locales/hr.yml
2177
2171
  - config/locales/hu.yml
@@ -2441,6 +2435,7 @@ files:
2441
2435
  - db/seeds/city2.jpeg
2442
2436
  - db/seeds/homepage_image.jpg
2443
2437
  - db/seeds/logo.png
2438
+ - decidim-core.gemspec
2444
2439
  - lib/decidim/action_authorization.rb
2445
2440
  - lib/decidim/acts_as_author.rb
2446
2441
  - lib/decidim/acts_as_tree.rb
@@ -2659,6 +2654,7 @@ files:
2659
2654
  - lib/decidim/core/test/shared_examples/reportable.rb
2660
2655
  - lib/decidim/core/test/shared_examples/reports_examples.rb
2661
2656
  - lib/decidim/core/test/shared_examples/resource_endorsed_event_examples.rb
2657
+ - lib/decidim/core/test/shared_examples/resource_locator_presenter_examples.rb
2662
2658
  - lib/decidim/core/test/shared_examples/resource_search_examples.rb
2663
2659
  - lib/decidim/core/test/shared_examples/resourceable.rb
2664
2660
  - lib/decidim/core/test/shared_examples/rich_text_editor_examples.rb
@@ -2743,6 +2739,7 @@ files:
2743
2739
  - lib/decidim/has_attachments.rb
2744
2740
  - lib/decidim/has_category.rb
2745
2741
  - lib/decidim/has_component.rb
2742
+ - lib/decidim/has_conversations.rb
2746
2743
  - lib/decidim/has_private_users.rb
2747
2744
  - lib/decidim/has_reference.rb
2748
2745
  - lib/decidim/has_resource_permission.rb
@@ -2836,6 +2833,7 @@ files:
2836
2833
  - lib/decidim/webpacker/postcss.config.js
2837
2834
  - lib/decidim/webpacker/runner.rb
2838
2835
  - lib/decidim/webpacker/shakapacker.yml
2836
+ - lib/decidim/webpacker/webpack/.modernizrrc
2839
2837
  - lib/decidim/webpacker/webpack/custom.js
2840
2838
  - lib/decidim/webpacker/webpack/webpack.config.js
2841
2839
  - lib/devise/models/decidim_newsletterable.rb
@@ -2857,6 +2855,7 @@ files:
2857
2855
  - lib/tasks/decidim_tasks.rake
2858
2856
  - lib/tasks/decidim_webpacker_tasks.rake
2859
2857
  - lib/tasks/upgrade/decidim_deduplicate_endorsements.rake
2858
+ - lib/tasks/upgrade/decidim_fix_categorization.rake
2860
2859
  - lib/tasks/upgrade/decidim_fix_nickname_uniqueness.rake
2861
2860
  - lib/tasks/upgrade/decidim_fix_short_url_resolver.rake
2862
2861
  - lib/tasks/upgrade/decidim_migrate_wysiwyg_content.rake
@@ -2877,16 +2876,16 @@ require_paths:
2877
2876
  - lib
2878
2877
  required_ruby_version: !ruby/object:Gem::Requirement
2879
2878
  requirements:
2880
- - - ">="
2879
+ - - "~>"
2881
2880
  - !ruby/object:Gem::Version
2882
- version: '3.1'
2881
+ version: 3.1.0
2883
2882
  required_rubygems_version: !ruby/object:Gem::Requirement
2884
2883
  requirements:
2885
2884
  - - ">="
2886
2885
  - !ruby/object:Gem::Version
2887
2886
  version: '0'
2888
2887
  requirements: []
2889
- rubygems_version: 3.4.22
2888
+ rubygems_version: 3.3.7
2890
2889
  signing_key:
2891
2890
  specification_version: 4
2892
2891
  summary: The core of the Decidim framework.
@@ -1,7 +0,0 @@
1
- var $results = $('#results');
2
- var $filters = $('.search-filters');
3
- var $count = $('#search-count');
4
-
5
- $results.html('<%= j(cell("decidim/search_results", @sections, params:).show).strip.html_safe %>');
6
- $filters.html('<%= j(render partial: "filters").strip.html_safe %>');
7
- $count.html('<%= j(render partial: "count").strip.html_safe %>');