decidim-core 0.27.6 → 0.27.8
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/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/version_cell.rb +1 -1
- data/app/controllers/concerns/decidim/force_authentication.rb +1 -1
- data/app/controllers/concerns/decidim/use_organization_time_zone.rb +1 -1
- data/app/controllers/decidim/links_controller.rb +13 -1
- data/app/mailers/decidim/application_mailer.rb +40 -6
- data/app/presenters/decidim/admin_log/organization_presenter.rb +1 -1
- data/app/presenters/decidim/log/resource_presenter.rb +7 -1
- data/app/services/decidim/log/diff_changeset_calculator.rb +1 -1
- data/app/views/decidim/links/new.html.erb +2 -0
- data/config/locales/ar.yml +0 -1
- data/config/locales/bg.yml +410 -1
- data/config/locales/ca.yml +1 -0
- data/config/locales/cs.yml +0 -1
- data/config/locales/de.yml +3 -2
- data/config/locales/el.yml +4 -1
- data/config/locales/en.yml +1 -0
- data/config/locales/eo.yml +3 -0
- data/config/locales/es-MX.yml +5 -4
- data/config/locales/es-PY.yml +5 -4
- data/config/locales/es.yml +5 -4
- data/config/locales/eu.yml +1 -0
- data/config/locales/fi-plain.yml +1 -0
- data/config/locales/fi.yml +1 -0
- data/config/locales/fr-CA.yml +3 -2
- data/config/locales/fr.yml +1 -0
- data/config/locales/ga-IE.yml +5 -0
- data/config/locales/hu.yml +0 -1
- data/config/locales/is-IS.yml +3 -0
- data/config/locales/it.yml +4 -1
- data/config/locales/ja.yml +2 -1
- data/config/locales/lb.yml +4 -1
- data/config/locales/lt.yml +4 -1
- data/config/locales/lv.yml +4 -1
- data/config/locales/nl.yml +4 -1
- data/config/locales/no.yml +4 -1
- data/config/locales/pl.yml +31 -0
- data/config/locales/pt-BR.yml +0 -1
- data/config/locales/pt.yml +4 -1
- data/config/locales/ro-RO.yml +1 -0
- data/config/locales/ru.yml +4 -0
- data/config/locales/sk.yml +4 -1
- data/config/locales/sl.yml +5 -0
- data/config/locales/sv.yml +4 -1
- data/config/locales/tr-TR.yml +2 -0
- data/config/locales/uk.yml +1 -0
- data/config/locales/zh-CN.yml +0 -1
- data/config/locales/zh-TW.yml +4 -1
- data/lib/decidim/core/test/factories.rb +9 -3
- data/lib/decidim/core/test/shared_examples/has_attachment_collections.rb +3 -3
- data/lib/decidim/core/test/shared_examples/has_attachments.rb +1 -1
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/events/base_event.rb +4 -0
- data/lib/decidim/form_builder.rb +13 -1
- data/lib/decidim/organization_settings.rb +10 -2
- metadata +11 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 613a2587e3833271a196216ce4a8e4392511b034bc0dc3e2b20a5cb3bedf76a5
|
4
|
+
data.tar.gz: 1bc7b0f0bc225ea6daccbfdf06f827570208b745ad0b34b95fc0caf002a332da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e643e5ccaf5ed945eb08eb5c902229f77ebb86fd0a59792bf7d5973c747f1c9ca5d92bd716ee45e0b7a3148af086576da7034ca35d7ac167e024ed302ae85370
|
7
|
+
data.tar.gz: 96326656a293f01a177c3c8b34bd4454450fa2a538107c6299d9fc9aaaa92de8a7b558ae4d007ce9afcb749bfe2fef7eed989e0eebae27031819d78d6c5aaed3
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<div class="card card--widget">
|
2
|
+
<ul class="card-data">
|
3
|
+
<li class="card-data__item">
|
4
|
+
<div class="card__link text-center">
|
5
|
+
<%= resource_icon notification.resource, class: "icon--large" %>
|
6
|
+
<span class="text-medium mt-xs" title="<%= l(notification.created_at) %>" data-tooltip="true" data-disable-hover="false">
|
7
|
+
<%= notification.created_at_in_words %>
|
8
|
+
</span>
|
9
|
+
</div>
|
10
|
+
</li>
|
11
|
+
<li class="card-data__item card-data__item--expand absolutes">
|
12
|
+
<div class="mr-s">
|
13
|
+
<span class="text-small"><%= notification.event_class.constantize.model_name.human %></span>
|
14
|
+
<br>
|
15
|
+
<%= t("decidim.notifications.show.moderated") %>
|
16
|
+
</div>
|
17
|
+
<div class="right center mr-s">
|
18
|
+
<%= link_to model, remote: true, method: :delete, class: "mark-as-read-button" do %>
|
19
|
+
<%= icon "circle-x", class: "card__link", aria_label: t("mark_as_read", scope: "layouts.decidim.notifications_dashboard"), role: "img" %>
|
20
|
+
<% end %>
|
21
|
+
</div>
|
22
|
+
</li>
|
23
|
+
</ul>
|
24
|
+
</div>
|
@@ -50,7 +50,7 @@ module Decidim
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def i18n(string, **params)
|
53
|
-
t(string, **params, scope: i18n_scope, default: t(string, **params, scope: default_i18n_scope))
|
53
|
+
decidim_html_escape(t(string, **params, scope: i18n_scope, default: t(string, **params, scope: default_i18n_scope)))
|
54
54
|
end
|
55
55
|
|
56
56
|
def i18n_scope
|
@@ -17,7 +17,7 @@ module Decidim
|
|
17
17
|
# Breaks the request lifecycle, if user is not authenticated.
|
18
18
|
# Otherwise returns.
|
19
19
|
def ensure_authenticated!
|
20
|
-
return true unless current_organization
|
20
|
+
return true unless current_organization&.force_users_to_authenticate_before_access_organization
|
21
21
|
|
22
22
|
# Next stop: Let's check whether auth is ok
|
23
23
|
unless user_signed_in?
|
@@ -35,7 +35,19 @@ module Decidim
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def external_url
|
38
|
-
@external_url ||= URI.parse(
|
38
|
+
@external_url ||= URI.parse(escape_url(params[:external_url]))
|
39
|
+
end
|
40
|
+
|
41
|
+
def escape_url(external_url)
|
42
|
+
before_fragment, fragment = external_url.split("#", 2)
|
43
|
+
escaped_before_fragment = URI::Parser.new.escape(before_fragment)
|
44
|
+
|
45
|
+
if fragment
|
46
|
+
escaped_fragment = URI::Parser.new.escape(fragment)
|
47
|
+
"#{escaped_before_fragment}##{escaped_fragment}"
|
48
|
+
else
|
49
|
+
escaped_before_fragment
|
50
|
+
end
|
39
51
|
end
|
40
52
|
end
|
41
53
|
end
|
@@ -7,23 +7,57 @@ module Decidim
|
|
7
7
|
include LocalisedMailer
|
8
8
|
include MultitenantAssetHost
|
9
9
|
after_action :set_smtp
|
10
|
+
after_action :set_from
|
10
11
|
|
11
12
|
default from: Decidim.config.mailer_sender
|
12
13
|
layout "decidim/mailer"
|
13
14
|
|
14
15
|
private
|
15
16
|
|
17
|
+
attr_reader :organization
|
18
|
+
|
16
19
|
def set_smtp
|
17
|
-
return if
|
20
|
+
return if organization.nil? || organization.smtp_settings.blank? || organization.smtp_settings.except("from", "from_label", "from_email").all?(&:blank?)
|
18
21
|
|
19
|
-
mail.from = @organization.smtp_settings["from"].presence || mail.from
|
20
22
|
mail.reply_to = mail.reply_to || Decidim.config.mailer_reply
|
21
23
|
mail.delivery_method.settings.merge!(
|
22
|
-
address:
|
23
|
-
port:
|
24
|
-
user_name:
|
25
|
-
password: Decidim::AttributeEncryptor.decrypt(
|
24
|
+
address: organization.smtp_settings["address"],
|
25
|
+
port: organization.smtp_settings["port"],
|
26
|
+
user_name: organization.smtp_settings["user_name"],
|
27
|
+
password: Decidim::AttributeEncryptor.decrypt(organization.smtp_settings["encrypted_password"])
|
26
28
|
) { |_k, o, v| v.presence || o }.compact_blank!
|
27
29
|
end
|
30
|
+
|
31
|
+
def set_from
|
32
|
+
return if organization.nil?
|
33
|
+
return if already_defined_name_in_mail?(mail.from.first)
|
34
|
+
|
35
|
+
mail.from = sender
|
36
|
+
end
|
37
|
+
|
38
|
+
def sender
|
39
|
+
return Decidim.config.mailer_sender if return_mailer_sender?
|
40
|
+
return default_sender if organization.smtp_settings.blank?
|
41
|
+
return default_sender if organization.smtp_settings["from"].nil?
|
42
|
+
return default_sender if organization.smtp_settings["from"].empty?
|
43
|
+
|
44
|
+
smtp_settings_from = organization.smtp_settings["from"]
|
45
|
+
return smtp_settings_from if already_defined_name_in_mail?(smtp_settings_from)
|
46
|
+
|
47
|
+
email_address_with_name(smtp_settings_from, organization.name)
|
48
|
+
end
|
49
|
+
|
50
|
+
def default_sender
|
51
|
+
email_address_with_name(Decidim.config.mailer_sender, organization.name)
|
52
|
+
end
|
53
|
+
|
54
|
+
def already_defined_name_in_mail?(mail_address)
|
55
|
+
# if there is an space, there is already a name in the address
|
56
|
+
mail_address.match?(/ /)
|
57
|
+
end
|
58
|
+
|
59
|
+
def return_mailer_sender?
|
60
|
+
already_defined_name_in_mail?(Decidim.config.mailer_sender) && organization.smtp_settings.present?
|
61
|
+
end
|
28
62
|
end
|
29
63
|
end
|
@@ -10,6 +10,8 @@ module Decidim
|
|
10
10
|
# overwrite `BasePresenter#resource_presenter` to return your custom resource presenter.
|
11
11
|
# The only requirement for custom renderers is that they should respond to `present`.
|
12
12
|
class ResourcePresenter
|
13
|
+
include Decidim::SanitizeHelper
|
14
|
+
|
13
15
|
# Public: Initializes the presenter.
|
14
16
|
#
|
15
17
|
# resource - An instance of a model that can be located by
|
@@ -65,7 +67,11 @@ module Decidim
|
|
65
67
|
#
|
66
68
|
# Returns an HTML-safe String.
|
67
69
|
def present_resource_name
|
68
|
-
|
70
|
+
if resource.present? && resource.respond_to?(:presenter) && resource.presenter.respond_to?(:title)
|
71
|
+
resource.presenter.title(html_escape: true)
|
72
|
+
else
|
73
|
+
decidim_escape_translated(extra["title"]).html_safe
|
74
|
+
end
|
69
75
|
end
|
70
76
|
end
|
71
77
|
end
|
@@ -86,7 +86,7 @@ module Decidim
|
|
86
86
|
locales.flat_map do |locale|
|
87
87
|
previous_value = values.first.try(:[], locale)
|
88
88
|
new_value = values.last.try(:[], locale)
|
89
|
-
if previous_value == new_value
|
89
|
+
if previous_value == new_value || (previous_value.nil? && new_value.blank?)
|
90
90
|
nil
|
91
91
|
else
|
92
92
|
label = generate_label(attribute, locale)
|