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.
- checksums.yaml +4 -4
- data/app/cells/decidim/activity_cell.rb +2 -2
- data/app/cells/decidim/card_cell.rb +2 -2
- data/app/cells/decidim/card_m/top.erb +1 -1
- data/app/cells/decidim/card_m_cell.rb +1 -1
- data/app/cells/decidim/follow_button_cell.rb +1 -1
- data/app/cells/decidim/notification/moderated.erb +24 -0
- data/app/cells/decidim/notification_cell.rb +5 -1
- data/app/cells/decidim/scopes_picker/scope_picker_values.erb +1 -1
- data/app/cells/decidim/tags_cell.rb +3 -1
- data/app/cells/decidim/user_profile_cell.rb +1 -1
- data/app/commands/decidim/create_omniauth_registration.rb +2 -4
- data/app/commands/decidim/messaging/reply_to_conversation.rb +3 -0
- data/app/commands/decidim/messaging/start_conversation.rb +3 -0
- data/app/controllers/concerns/decidim/devise_authentication_methods.rb +36 -0
- data/app/controllers/concerns/decidim/force_authentication.rb +1 -1
- data/app/controllers/concerns/decidim/paginable.rb +1 -1
- data/app/controllers/concerns/decidim/use_organization_time_zone.rb +1 -1
- data/app/controllers/decidim/devise/omniauth_registrations_controller.rb +1 -22
- data/app/controllers/decidim/devise/sessions_controller.rb +1 -24
- data/app/controllers/decidim/links_controller.rb +13 -1
- data/app/controllers/decidim/widgets_controller.rb +6 -0
- data/app/events/decidim/welcome_notification_event.rb +6 -9
- data/app/helpers/decidim/cells_paginate_helper.rb +1 -1
- data/app/helpers/decidim/check_boxes_tree_helper.rb +4 -4
- data/app/helpers/decidim/newsletters_helper.rb +83 -16
- data/app/helpers/decidim/resource_helper.rb +1 -1
- data/app/helpers/decidim/sanitize_helper.rb +9 -0
- data/app/helpers/decidim/user_profile_helper.rb +7 -2
- data/app/mailers/decidim/application_mailer.rb +40 -6
- data/app/mailers/decidim/messaging/conversation_mailer.rb +3 -72
- data/app/models/decidim/push_notification_message.rb +39 -0
- data/app/packs/images/decidim/.keep +0 -0
- data/app/packs/src/decidim/input_hashtags.js +1 -1
- data/app/packs/src/decidim/input_mentions.js +1 -1
- data/app/packs/src/decidim/input_multiple_mentions.js +1 -1
- data/app/packs/src/decidim/vizzs/index.js +1 -1
- data/app/packs/stylesheets/decidim/plugins/leaflet.scss +118 -114
- data/app/presenters/decidim/admin_log/oauth_application_resource_presenter.rb +1 -1
- data/app/presenters/decidim/admin_log/organization_presenter.rb +1 -1
- data/app/presenters/decidim/log/resource_presenter.rb +7 -1
- data/app/presenters/decidim/notification_to_mailer_presenter.rb +9 -0
- data/app/services/decidim/events_manager.rb +6 -0
- data/app/services/decidim/log/diff_changeset_calculator.rb +1 -1
- data/app/services/decidim/push_notification_message_sender.rb +36 -0
- data/app/services/decidim/send_push_notification.rb +22 -8
- data/app/views/decidim/devise/registrations/new.html.erb +2 -2
- data/app/views/decidim/links/new.html.erb +2 -0
- data/app/views/decidim/notifications_digest_mailer/_email_content.html.erb +7 -0
- data/app/views/decidim/shared/_address_details.html.erb +2 -2
- data/app/views/layouts/decidim/_js_configuration.html.erb +1 -0
- data/config/locales/ar.yml +4 -3
- data/config/locales/bg.yml +484 -1
- data/config/locales/ca.yml +23 -22
- data/config/locales/cs.yml +0 -1
- data/config/locales/de.yml +28 -27
- data/config/locales/el.yml +5 -4
- data/config/locales/en.yml +1 -0
- data/config/locales/eo.yml +3 -0
- data/config/locales/es-MX.yml +6 -5
- data/config/locales/es-PY.yml +6 -5
- data/config/locales/es.yml +25 -24
- data/config/locales/eu.yml +12 -2
- data/config/locales/fi-plain.yml +1 -0
- data/config/locales/fi.yml +4 -3
- data/config/locales/fr-CA.yml +5 -4
- data/config/locales/fr.yml +3 -2
- data/config/locales/ga-IE.yml +5 -0
- data/config/locales/gl.yml +3 -0
- data/config/locales/he-IL.yml +1 -0
- data/config/locales/hu.yml +41 -9
- data/config/locales/it.yml +5 -4
- data/config/locales/ja.yml +5 -3
- data/config/locales/lb.yml +5 -4
- data/config/locales/lt.yml +4 -4
- data/config/locales/lv.yml +4 -1
- data/config/locales/nl.yml +4 -1
- data/config/locales/no.yml +5 -4
- data/config/locales/pl.yml +168 -1
- data/config/locales/pt-BR.yml +113 -22
- data/config/locales/pt.yml +5 -4
- data/config/locales/ro-RO.yml +1 -3
- data/config/locales/ru.yml +13 -0
- data/config/locales/sk.yml +6 -1
- data/config/locales/sl.yml +5 -0
- data/config/locales/sv.yml +26 -3
- data/config/locales/tr-TR.yml +3 -3
- data/config/locales/uk.yml +15 -0
- data/config/locales/zh-CN.yml +0 -4
- data/config/locales/zh-TW.yml +4 -4
- data/decidim-core.gemspec +78 -0
- data/lib/decidim/acts_as_tree.rb +14 -1
- data/lib/decidim/asset_router/storage.rb +4 -0
- data/lib/decidim/attribute_encryptor.rb +6 -4
- data/lib/decidim/core/engine.rb +7 -3
- data/lib/decidim/core/test/factories.rb +314 -95
- data/lib/decidim/core/test/shared_examples/amendable/amendment_created_event_examples.rb +6 -26
- data/lib/decidim/core/test/shared_examples/amendable/amendment_promoted_event_examples.rb +8 -26
- data/lib/decidim/core/test/shared_examples/comments_examples.rb +32 -0
- data/lib/decidim/core/test/shared_examples/embed_resource_examples.rb +187 -11
- data/lib/decidim/core/test/shared_examples/has_attachment_collections.rb +8 -6
- data/lib/decidim/core/test/shared_examples/has_attachments.rb +4 -4
- data/lib/decidim/core/test/shared_examples/has_category.rb +27 -0
- data/lib/decidim/core/test/shared_examples/has_reference.rb +1 -1
- data/lib/decidim/core/test/shared_examples/has_space_in_mcell_examples.rb +1 -2
- data/lib/decidim/core/test/shared_examples/resource_endorsed_event_examples.rb +6 -3
- data/lib/decidim/core/test/shared_examples/resource_locator_presenter_examples.rb +134 -0
- data/lib/decidim/core/test/shared_examples/searchable_results_examples.rb +1 -1
- data/lib/decidim/core/test/shared_examples/simple_event.rb +50 -2
- data/lib/decidim/core/test.rb +1 -0
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/core.rb +1 -0
- data/lib/decidim/engine_router.rb +17 -4
- data/lib/decidim/events/base_event.rb +9 -2
- data/lib/decidim/events/simple_event.rb +3 -17
- data/lib/decidim/form_builder.rb +13 -1
- data/lib/decidim/has_category.rb +1 -1
- data/lib/decidim/has_conversations.rb +91 -0
- data/lib/decidim/organization_settings.rb +10 -2
- data/lib/decidim/participable.rb +17 -0
- data/lib/decidim/view_model.rb +1 -0
- data/lib/decidim/webpacker/webpack/.modernizrrc +9 -0
- data/lib/premailer/adapter/decidim.rb +5 -4
- data/lib/tasks/decidim_reminders_tasks.rake +1 -0
- data/lib/tasks/upgrade/decidim_fix_categorization.rake +15 -0
- metadata +29 -27
- 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
|
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
|
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
|
data/lib/decidim/core/test.rb
CHANGED
@@ -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"
|
data/lib/decidim/core/version.rb
CHANGED
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
|
-
|
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
|
-
|
109
|
+
decidim_sanitize_translated(resource.title)
|
107
110
|
elsif resource.respond_to?(:name)
|
108
|
-
|
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", **
|
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)
|
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
|
-
|
125
|
+
decidim_sanitize_translated(participatory_space.try(:title))
|
140
126
|
end
|
141
127
|
end
|
142
128
|
end
|
data/lib/decidim/form_builder.rb
CHANGED
@@ -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
|
data/lib/decidim/has_category.rb
CHANGED
@@ -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" =>
|
134
|
-
"avatar" =>
|
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)
|
data/lib/decidim/participable.rb
CHANGED
@@ -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,
|
data/lib/decidim/view_model.rb
CHANGED
@@ -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
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
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
|
@@ -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
|