decidim-core 0.27.5 → 0.27.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/activity_cell.rb +2 -2
  3. data/app/cells/decidim/card_cell.rb +2 -2
  4. data/app/cells/decidim/card_m/top.erb +1 -1
  5. data/app/cells/decidim/card_m_cell.rb +1 -1
  6. data/app/cells/decidim/follow_button_cell.rb +1 -1
  7. data/app/cells/decidim/notification/moderated.erb +24 -0
  8. data/app/cells/decidim/notification_cell.rb +5 -1
  9. data/app/cells/decidim/scopes_picker/scope_picker_values.erb +1 -1
  10. data/app/cells/decidim/tags_cell.rb +3 -1
  11. data/app/cells/decidim/user_profile_cell.rb +1 -1
  12. data/app/commands/decidim/create_omniauth_registration.rb +2 -4
  13. data/app/commands/decidim/messaging/reply_to_conversation.rb +3 -0
  14. data/app/commands/decidim/messaging/start_conversation.rb +3 -0
  15. data/app/controllers/concerns/decidim/devise_authentication_methods.rb +36 -0
  16. data/app/controllers/concerns/decidim/force_authentication.rb +1 -1
  17. data/app/controllers/concerns/decidim/paginable.rb +1 -1
  18. data/app/controllers/concerns/decidim/use_organization_time_zone.rb +1 -1
  19. data/app/controllers/decidim/devise/omniauth_registrations_controller.rb +1 -22
  20. data/app/controllers/decidim/devise/sessions_controller.rb +1 -24
  21. data/app/controllers/decidim/links_controller.rb +13 -1
  22. data/app/controllers/decidim/widgets_controller.rb +6 -0
  23. data/app/events/decidim/welcome_notification_event.rb +6 -9
  24. data/app/helpers/decidim/cells_paginate_helper.rb +1 -1
  25. data/app/helpers/decidim/check_boxes_tree_helper.rb +4 -4
  26. data/app/helpers/decidim/newsletters_helper.rb +83 -16
  27. data/app/helpers/decidim/resource_helper.rb +1 -1
  28. data/app/helpers/decidim/sanitize_helper.rb +9 -0
  29. data/app/helpers/decidim/user_profile_helper.rb +7 -2
  30. data/app/mailers/decidim/application_mailer.rb +40 -6
  31. data/app/mailers/decidim/messaging/conversation_mailer.rb +3 -72
  32. data/app/models/decidim/push_notification_message.rb +39 -0
  33. data/app/packs/images/decidim/.keep +0 -0
  34. data/app/packs/src/decidim/input_hashtags.js +1 -1
  35. data/app/packs/src/decidim/input_mentions.js +1 -1
  36. data/app/packs/src/decidim/input_multiple_mentions.js +1 -1
  37. data/app/packs/src/decidim/vizzs/index.js +1 -1
  38. data/app/packs/stylesheets/decidim/plugins/leaflet.scss +118 -114
  39. data/app/presenters/decidim/admin_log/oauth_application_resource_presenter.rb +1 -1
  40. data/app/presenters/decidim/admin_log/organization_presenter.rb +1 -1
  41. data/app/presenters/decidim/log/resource_presenter.rb +7 -1
  42. data/app/presenters/decidim/notification_to_mailer_presenter.rb +9 -0
  43. data/app/services/decidim/events_manager.rb +6 -0
  44. data/app/services/decidim/log/diff_changeset_calculator.rb +1 -1
  45. data/app/services/decidim/push_notification_message_sender.rb +36 -0
  46. data/app/services/decidim/send_push_notification.rb +22 -8
  47. data/app/views/decidim/devise/registrations/new.html.erb +2 -2
  48. data/app/views/decidim/links/new.html.erb +2 -0
  49. data/app/views/decidim/notifications_digest_mailer/_email_content.html.erb +7 -0
  50. data/app/views/decidim/shared/_address_details.html.erb +2 -2
  51. data/app/views/layouts/decidim/_js_configuration.html.erb +1 -0
  52. data/config/locales/ar.yml +4 -3
  53. data/config/locales/bg.yml +484 -1
  54. data/config/locales/ca.yml +23 -22
  55. data/config/locales/cs.yml +0 -1
  56. data/config/locales/de.yml +28 -27
  57. data/config/locales/el.yml +5 -4
  58. data/config/locales/en.yml +1 -0
  59. data/config/locales/eo.yml +3 -0
  60. data/config/locales/es-MX.yml +6 -5
  61. data/config/locales/es-PY.yml +6 -5
  62. data/config/locales/es.yml +25 -24
  63. data/config/locales/eu.yml +12 -2
  64. data/config/locales/fi-plain.yml +1 -0
  65. data/config/locales/fi.yml +4 -3
  66. data/config/locales/fr-CA.yml +5 -4
  67. data/config/locales/fr.yml +3 -2
  68. data/config/locales/ga-IE.yml +5 -0
  69. data/config/locales/gl.yml +3 -0
  70. data/config/locales/he-IL.yml +1 -0
  71. data/config/locales/hu.yml +41 -9
  72. data/config/locales/it.yml +5 -4
  73. data/config/locales/ja.yml +5 -3
  74. data/config/locales/lb.yml +5 -4
  75. data/config/locales/lt.yml +4 -4
  76. data/config/locales/lv.yml +4 -1
  77. data/config/locales/nl.yml +4 -1
  78. data/config/locales/no.yml +5 -4
  79. data/config/locales/pl.yml +168 -1
  80. data/config/locales/pt-BR.yml +113 -22
  81. data/config/locales/pt.yml +5 -4
  82. data/config/locales/ro-RO.yml +1 -3
  83. data/config/locales/ru.yml +13 -0
  84. data/config/locales/sk.yml +6 -1
  85. data/config/locales/sl.yml +5 -0
  86. data/config/locales/sv.yml +26 -3
  87. data/config/locales/tr-TR.yml +3 -3
  88. data/config/locales/uk.yml +15 -0
  89. data/config/locales/zh-CN.yml +0 -4
  90. data/config/locales/zh-TW.yml +4 -4
  91. data/decidim-core.gemspec +78 -0
  92. data/lib/decidim/acts_as_tree.rb +14 -1
  93. data/lib/decidim/asset_router/storage.rb +4 -0
  94. data/lib/decidim/attribute_encryptor.rb +6 -4
  95. data/lib/decidim/core/engine.rb +7 -3
  96. data/lib/decidim/core/test/factories.rb +314 -95
  97. data/lib/decidim/core/test/shared_examples/amendable/amendment_created_event_examples.rb +6 -26
  98. data/lib/decidim/core/test/shared_examples/amendable/amendment_promoted_event_examples.rb +8 -26
  99. data/lib/decidim/core/test/shared_examples/comments_examples.rb +32 -0
  100. data/lib/decidim/core/test/shared_examples/embed_resource_examples.rb +187 -11
  101. data/lib/decidim/core/test/shared_examples/has_attachment_collections.rb +8 -6
  102. data/lib/decidim/core/test/shared_examples/has_attachments.rb +4 -4
  103. data/lib/decidim/core/test/shared_examples/has_category.rb +27 -0
  104. data/lib/decidim/core/test/shared_examples/has_reference.rb +1 -1
  105. data/lib/decidim/core/test/shared_examples/has_space_in_mcell_examples.rb +1 -2
  106. data/lib/decidim/core/test/shared_examples/resource_endorsed_event_examples.rb +6 -3
  107. data/lib/decidim/core/test/shared_examples/resource_locator_presenter_examples.rb +134 -0
  108. data/lib/decidim/core/test/shared_examples/searchable_results_examples.rb +1 -1
  109. data/lib/decidim/core/test/shared_examples/simple_event.rb +50 -2
  110. data/lib/decidim/core/test.rb +1 -0
  111. data/lib/decidim/core/version.rb +1 -1
  112. data/lib/decidim/core.rb +1 -0
  113. data/lib/decidim/engine_router.rb +17 -4
  114. data/lib/decidim/events/base_event.rb +9 -2
  115. data/lib/decidim/events/simple_event.rb +3 -17
  116. data/lib/decidim/form_builder.rb +13 -1
  117. data/lib/decidim/has_category.rb +1 -1
  118. data/lib/decidim/has_conversations.rb +91 -0
  119. data/lib/decidim/organization_settings.rb +10 -2
  120. data/lib/decidim/participable.rb +17 -0
  121. data/lib/decidim/view_model.rb +1 -0
  122. data/lib/decidim/webpacker/webpack/.modernizrrc +9 -0
  123. data/lib/premailer/adapter/decidim.rb +5 -4
  124. data/lib/tasks/decidim_reminders_tasks.rake +1 -0
  125. data/lib/tasks/upgrade/decidim_fix_categorization.rake +15 -0
  126. metadata +29 -27
  127. data/config/environment.rb +0 -3
@@ -28,10 +28,10 @@ shared_context "when a simple event" do
28
28
  let(:extra) { {} }
29
29
  let(:resource_path) { resource_locator(resource).path }
30
30
  let(:resource_url) { resource_locator(resource).url }
31
- let(:resource_title) { resource.title["en"] }
31
+ let(:resource_title) { decidim_sanitize_translated(resource.title) }
32
32
  # to be used when resource is a component resource, not a participatory space, in which case should be overriden
33
33
  let(:participatory_space) { resource.participatory_space }
34
- let(:participatory_space_title) { participatory_space.title["en"] }
34
+ let(:participatory_space_title) { decidim_sanitize_translated(participatory_space.title) }
35
35
  let(:participatory_space_path) { Decidim::ResourceLocatorPresenter.new(participatory_space).path }
36
36
  let(:participatory_space_url) { Decidim::ResourceLocatorPresenter.new(participatory_space).url }
37
37
  let(:author) do
@@ -65,6 +65,7 @@ shared_examples_for "a simple event" do |skip_space_checks|
65
65
  it "is generated correctly" do
66
66
  expect(subject.email_subject).to be_kind_of(String)
67
67
  expect(subject.email_subject).not_to include("translation missing")
68
+ expect(subject.email_subject).not_to include("script")
68
69
  end
69
70
  end
70
71
 
@@ -100,6 +101,7 @@ shared_examples_for "a simple event" do |skip_space_checks|
100
101
  it "is generated correctly" do
101
102
  expect(subject.notification_title).to be_kind_of(String)
102
103
  expect(subject.notification_title).not_to include("translation missing")
104
+ expect(subject.notification_title).not_to include("script")
103
105
  end
104
106
  end
105
107
 
@@ -129,6 +131,12 @@ shared_examples_for "a simple event" do |skip_space_checks|
129
131
  expect(subject.participatory_space_url).to start_with("http")
130
132
  end
131
133
  end
134
+
135
+ describe "participatory_space_title" do
136
+ it "is generated correctly" do
137
+ expect(translated(participatory_space.title)).to include("script")
138
+ end
139
+ end
132
140
  end
133
141
 
134
142
  describe "i18n_options" do
@@ -152,3 +160,43 @@ shared_examples_for "a simple event" do |skip_space_checks|
152
160
  end
153
161
  end
154
162
  end
163
+
164
+ shared_examples_for "a simple event email" do
165
+ describe "email_subject" do
166
+ it "is generated correctly" do
167
+ expect(subject.email_subject).to eq(email_subject)
168
+ end
169
+
170
+ # it "is html safe" do
171
+ # # pending "Enable after #12547 is merged"
172
+ # expect(subject.email_subject).not_to include("script")
173
+ # end
174
+ end
175
+
176
+ describe "email_intro" do
177
+ it "is generated correctly" do
178
+ expect(subject.email_intro).to eq(email_intro)
179
+ end
180
+ end
181
+
182
+ describe "email_outro" do
183
+ it "is generated correctly" do
184
+ expect(subject.email_outro).to eq(email_outro)
185
+ end
186
+ end
187
+ end
188
+
189
+ shared_examples_for "a simple event notification" do
190
+ describe "notification_title" do
191
+ it "is generated correctly" do
192
+ expect(subject.notification_title)
193
+ .to eq(notification_title)
194
+ end
195
+ #
196
+ # it "is html safe" do
197
+ # pp subject.notification_title
198
+ # pending "Enable after #12547 is merged"
199
+ # expect(subject.notification_title).not_to include("script")
200
+ # end
201
+ end
202
+ end
@@ -76,3 +76,4 @@ require "decidim/core/test/shared_examples/resource_endorsed_event_examples"
76
76
  require "decidim/core/test/shared_examples/versions_controller_examples"
77
77
  require "decidim/core/test/shared_examples/mcell_examples"
78
78
  require "decidim/core/test/shared_examples/digest_mail_examples"
79
+ require "decidim/core/test/shared_examples/resource_locator_presenter_examples"
@@ -4,7 +4,7 @@ module Decidim
4
4
  # This holds the decidim-core version.
5
5
  module Core
6
6
  def self.version
7
- "0.27.5"
7
+ "0.27.7"
8
8
  end
9
9
  end
10
10
  end
data/lib/decidim/core.rb CHANGED
@@ -114,6 +114,7 @@ module Decidim
114
114
  autoload :ControllerHelpers, "decidim/controller_helpers"
115
115
  autoload :ProcessesFileLocally, "decidim/processes_file_locally"
116
116
  autoload :DependencyResolver, "decidim/dependency_resolver"
117
+ autoload :HasConversations, "decidim/has_conversations"
117
118
 
118
119
  include ActiveSupport::Configurable
119
120
  # Loads seeds from all engines.
@@ -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
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "../../../app/helpers/decidim/sanitize_helper"
4
+
3
5
  module Decidim
4
6
  module Events
5
7
  # This class serves as a base for all event classes. Event classes are intended to
@@ -8,6 +10,7 @@ module Decidim
8
10
  class BaseEvent
9
11
  extend ActiveModel::Translation
10
12
  include Decidim::TranslatableAttributes
13
+ include Decidim::SanitizeHelper
11
14
 
12
15
  class_attribute :types
13
16
  self.types = []
@@ -103,14 +106,18 @@ module Decidim
103
106
  return unless resource
104
107
 
105
108
  title = if resource.respond_to?(:title)
106
- translated_attribute(resource.title)
109
+ decidim_sanitize_translated(resource.title)
107
110
  elsif resource.respond_to?(:name)
108
- translated_attribute(resource.name)
111
+ decidim_sanitize_translated(resource.name)
109
112
  end
110
113
 
111
114
  Decidim::ContentProcessor.render_without_format(title, links: false).html_safe
112
115
  end
113
116
 
117
+ def hidden_resource?
118
+ resource.respond_to?(:hidden?) && resource.hidden?
119
+ end
120
+
114
121
  private
115
122
 
116
123
  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's 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
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "foundation_rails_helper/form_builder"
4
+ require_relative "../../app/helpers/decidim/sanitize_helper"
4
5
 
5
6
  module Decidim
6
7
  # This custom FormBuilder adds fields needed to deal with translatable fields,
@@ -9,6 +10,7 @@ module Decidim
9
10
  include ActionView::Context
10
11
  include Decidim::TranslatableAttributes
11
12
  include Decidim::Map::Autocomplete::FormBuilder
13
+ include Decidim::SanitizeHelper
12
14
 
13
15
  # Public: generates a check boxes input from a collection and adds help
14
16
  # text and errors.
@@ -192,11 +194,12 @@ module Decidim
192
194
  options.delete(:required)
193
195
  hashtaggable = options.delete(:hashtaggable)
194
196
  hidden_options = extract_validations(name, options).merge(options)
197
+ sanitized_value = sanitize_editor_value(object.send(name))
195
198
 
196
199
  content_tag(:div, class: "editor #{"hashtags__container" if hashtaggable}") do
197
200
  template = ""
198
201
  template += label(name, label_text + required_for_attribute(name)) if options.fetch(:label, true)
199
- template += hidden_field(name, hidden_options)
202
+ template += hidden_field(name, hidden_options.merge(value: sanitized_value))
200
203
  template += content_tag(:div, nil, class: "editor-container #{"js-hashtags" if hashtaggable}", data: {
201
204
  toolbar: toolbar,
202
205
  disabled: options[:disabled],
@@ -941,5 +944,14 @@ module Decidim
941
944
 
942
945
  object.class
943
946
  end
947
+
948
+ # Private: Sanitize editor values to prevent malformed values being display in the
949
+ # WYSIWYG editor
950
+ #
951
+ def sanitize_editor_value(value)
952
+ sanitized_value = decidim_sanitize_editor_admin(value)
953
+
954
+ sanitized_value == %(<div class="ql-editor-display"></div>) ? "" : sanitized_value
955
+ end
944
956
  end
945
957
  end
@@ -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: 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: 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: 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: 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: 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: 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
@@ -130,12 +130,20 @@ module Decidim
130
130
  )
131
131
  },
132
132
  "maximum_file_size" => {
133
- "default" => 10.0,
134
- "avatar" => 5.0
133
+ "default" => default_maximum_attachment_size,
134
+ "avatar" => default_maximum_avatar_size
135
135
  }
136
136
  }
137
137
  }
138
138
  end
139
+
140
+ def default_maximum_attachment_size
141
+ (Rails.application.secrets.decidim[:maximum_attachment_size].presence || 10).to_f
142
+ end
143
+
144
+ def default_maximum_avatar_size
145
+ (Rails.application.secrets.decidim[:maximum_avatar_size].presence || 5).to_f
146
+ end
139
147
  end
140
148
 
141
149
  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,
@@ -16,6 +16,7 @@ module Decidim
16
16
  include Cell::Caching::Notifications
17
17
  include Decidim::MarkupHelper
18
18
  include ::Webpacker::Helper
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