decidim-core 0.23.1 → 0.23.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of decidim-core might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/assets/javascripts/decidim/core/bundle.js +1 -1
- data/app/assets/javascripts/decidim/core/bundle.js.map +1 -1
- data/app/assets/javascripts/decidim/editor.js.es6 +1 -1
- data/app/cells/decidim/tos_page/announcement.erb +0 -1
- data/app/cells/decidim/tos_page/form.erb +17 -0
- data/app/helpers/decidim/paginate_helper.rb +1 -10
- data/app/helpers/decidim/sanitize_helper.rb +8 -0
- data/app/jobs/decidim/data_portability_export_job.rb +3 -3
- data/app/jobs/decidim/open_data_job.rb +1 -1
- data/app/mailers/decidim/application_mailer.rb +1 -0
- data/app/models/decidim/organization.rb +1 -1
- data/app/models/decidim/user.rb +11 -3
- data/app/presenters/decidim/admin_log/component_presenter.rb +2 -2
- data/app/presenters/decidim/admin_log/moderation_presenter.rb +2 -2
- data/app/presenters/decidim/admin_log/organization_presenter.rb +2 -2
- data/app/presenters/decidim/admin_log/user_presenter.rb +2 -2
- data/app/presenters/decidim/log/base_presenter.rb +9 -1
- data/app/scrubbers/decidim/newsletter_scrubber.rb +31 -0
- data/app/services/decidim/tokenizer.rb +38 -0
- data/app/services/decidim/traceability.rb +3 -0
- data/app/uploaders/decidim/application_uploader.rb +4 -0
- data/app/views/decidim/newsletter_mailer/newsletter.html.erb +1 -1
- data/app/views/decidim/pages/_standalone.html.erb +1 -1
- data/app/views/decidim/pages/_tabbed.html.erb +1 -1
- data/config/locales/ca.yml +1 -1
- data/config/locales/cs.yml +11 -11
- data/config/locales/de.yml +135 -126
- data/config/locales/es-MX.yml +1 -1
- data/config/locales/eu.yml +6 -0
- data/config/locales/fi.yml +6 -6
- data/config/locales/fr.yml +2 -2
- data/config/locales/gl.yml +7 -1
- data/config/locales/ja.yml +5 -5
- data/config/locales/lv.yml +2 -1
- data/config/locales/nl.yml +9 -9
- data/config/locales/no.yml +12 -0
- data/config/locales/si-LK.yml +1 -0
- data/config/locales/sv.yml +1 -1
- data/config/locales/sw-KE.yml +1 -0
- data/config/locales/tr-TR.yml +586 -244
- data/db/seeds.rb +7 -2
- data/lib/decidim/core/engine.rb +5 -0
- data/lib/decidim/core/test.rb +2 -0
- data/lib/decidim/core/test/shared_examples/admin_log_presenter_examples.rb +34 -0
- data/lib/decidim/core/test/shared_examples/counts_commentators_as_newsletter_participants.rb +31 -0
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/form_builder.rb +3 -2
- data/lib/decidim/has_private_users.rb +1 -1
- data/lib/decidim/newsletter_participant.rb +2 -4
- data/lib/decidim/paddable.rb +11 -4
- data/lib/premailer/adapter/decidim.rb +33 -0
- metadata +17 -10
- data/app/cells/decidim/tos_page/sticky_form.erb +0 -29
data/db/seeds.rb
CHANGED
@@ -16,6 +16,9 @@ if !Rails.env.production? || ENV["SEED"]
|
|
16
16
|
table.tr("_", "/").classify.safe_constantize
|
17
17
|
end.compact.each(&:reset_column_information)
|
18
18
|
|
19
|
+
smtp_label = Faker::Twitter.unique.screen_name
|
20
|
+
smtp_email = Faker::Internet.email
|
21
|
+
|
19
22
|
organization = Decidim::Organization.first || Decidim::Organization.create!(
|
20
23
|
name: Faker::Company.name,
|
21
24
|
twitter_handler: Faker::Hipster.word,
|
@@ -24,7 +27,9 @@ if !Rails.env.production? || ENV["SEED"]
|
|
24
27
|
youtube_handler: Faker::Hipster.word,
|
25
28
|
github_handler: Faker::Hipster.word,
|
26
29
|
smtp_settings: {
|
27
|
-
from:
|
30
|
+
from: "#{smtp_label} <#{smtp_email}>",
|
31
|
+
from_email: smtp_email,
|
32
|
+
from_label: smtp_label,
|
28
33
|
user_name: Faker::Twitter.unique.screen_name,
|
29
34
|
encrypted_password: Decidim::AttributeEncryptor.encrypt(Faker::Internet.password(8)),
|
30
35
|
address: ENV["DECIDIM_HOST"] || "localhost",
|
@@ -173,7 +178,7 @@ if !Rails.env.production? || ENV["SEED"]
|
|
173
178
|
email: Faker::Internet.email,
|
174
179
|
confirmed_at: Time.current,
|
175
180
|
extended_data: {
|
176
|
-
document_number: Faker::Number.number(10),
|
181
|
+
document_number: Faker::Number.number(10).to_s,
|
177
182
|
phone: Faker::PhoneNumber.phone_number,
|
178
183
|
verified_at: verified_at
|
179
184
|
},
|
data/lib/decidim/core/engine.rb
CHANGED
@@ -28,6 +28,7 @@ require "omniauth-twitter"
|
|
28
28
|
require "omniauth-google-oauth2"
|
29
29
|
require "invisible_captcha"
|
30
30
|
require "premailer/rails"
|
31
|
+
require "premailer/adapter/decidim"
|
31
32
|
require "geocoder"
|
32
33
|
require "paper_trail"
|
33
34
|
require "cells/rails"
|
@@ -507,6 +508,10 @@ module Decidim
|
|
507
508
|
NOBSPW.configuration.use_ruby_grep = true
|
508
509
|
end
|
509
510
|
|
511
|
+
initializer "decidim.premailer" do
|
512
|
+
Premailer::Adapter.use = :decidim
|
513
|
+
end
|
514
|
+
|
510
515
|
config.to_prepare do
|
511
516
|
FoundationRailsHelper::FlashHelper.send(:include, Decidim::FlashHelperExtensions)
|
512
517
|
end
|
data/lib/decidim/core/test.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "decidim/core/test/shared_examples/acts_as_author_examples"
|
4
|
+
require "decidim/core/test/shared_examples/admin_log_presenter_examples"
|
4
5
|
require "decidim/core/test/shared_examples/authorable"
|
5
6
|
require "decidim/core/test/shared_examples/coauthorable"
|
6
7
|
require "decidim/core/test/shared_examples/publicable"
|
@@ -13,6 +14,7 @@ require "decidim/core/test/shared_examples/has_scope"
|
|
13
14
|
require "decidim/core/test/shared_examples/has_category"
|
14
15
|
require "decidim/core/test/shared_examples/has_reference"
|
15
16
|
require "decidim/core/test/shared_examples/comments_examples"
|
17
|
+
require "decidim/core/test/shared_examples/counts_commentators_as_newsletter_participants"
|
16
18
|
require "decidim/core/test/shared_examples/announcements_examples"
|
17
19
|
require "decidim/core/test/shared_examples/process_announcements_examples"
|
18
20
|
require "decidim/core/test/shared_examples/reportable"
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "spec_helper"
|
4
|
+
|
5
|
+
shared_examples "present admin log entry" do
|
6
|
+
subject(:presenter) { described_class.new(action_log, helper) }
|
7
|
+
|
8
|
+
let(:organization) { create(:organization) }
|
9
|
+
let(:user) { create(:user, organization: organization) }
|
10
|
+
let(:action) { "create" }
|
11
|
+
let(:action_log) do
|
12
|
+
create(
|
13
|
+
:action_log,
|
14
|
+
user: user,
|
15
|
+
action: action,
|
16
|
+
resource: admin_log_resource
|
17
|
+
)
|
18
|
+
end
|
19
|
+
|
20
|
+
before do
|
21
|
+
helper.extend(Decidim::ApplicationHelper)
|
22
|
+
helper.extend(Decidim::TranslationsHelper)
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "#present" do
|
26
|
+
subject { presenter.present }
|
27
|
+
|
28
|
+
context "when the logged action is one that shows diff and the action log does not have an associated version" do
|
29
|
+
it "returns an empty diff" do
|
30
|
+
expect(subject).not_to include("class=\"logs__log__diff\"")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "spec_helper"
|
4
|
+
|
5
|
+
shared_examples_for "counts commentators as newsletter participants" do
|
6
|
+
# non participant commentator (comments into other spaces)
|
7
|
+
let!(:non_participant) { create(:user, :confirmed, newsletter_notifications_at: Time.current, organization: component_out_of_newsletter.organization) }
|
8
|
+
# expects resource_out_of_newsletter to belong to a space which has NOT been selected in the newsletter
|
9
|
+
let!(:outlier_comment) { create(:comment, author: non_participant, commentable: resource_out_of_newsletter) }
|
10
|
+
|
11
|
+
let(:commentators_ids) { [] }
|
12
|
+
let(:recipients_ids) { author_ids + commentators_ids }
|
13
|
+
|
14
|
+
context "without commentators" do
|
15
|
+
it "returns zero participants" do
|
16
|
+
expect(subject).to match_array(recipients_ids)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
context "with commentators, counts commentators in the current space" do
|
21
|
+
# participant commentator
|
22
|
+
let!(:commentator_participant) { create(:user, :confirmed, newsletter_notifications_at: Time.current, organization: organization) }
|
23
|
+
# expects resource_in_newsletter to belong to a space selected in the newsletter
|
24
|
+
let!(:comment_in_newsletter) { create(:comment, author: commentator_participant, commentable: resource_in_newsletter) }
|
25
|
+
let(:commentators_ids) { [commentator_participant.id] }
|
26
|
+
|
27
|
+
it "returns only commenters in the selected spaces" do
|
28
|
+
expect(subject).to match_array(recipients_ids)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/decidim/core/version.rb
CHANGED
data/lib/decidim/form_builder.rb
CHANGED
@@ -405,11 +405,12 @@ module Decidim
|
|
405
405
|
def upload(attribute, options = {})
|
406
406
|
self.multipart = true
|
407
407
|
options[:optional] = options[:optional].nil? ? true : options[:optional]
|
408
|
-
|
408
|
+
label_text = options[:label] || label_for(attribute)
|
409
|
+
alt_text = label_text
|
409
410
|
|
410
411
|
file = object.send attribute
|
411
412
|
template = ""
|
412
|
-
template += label(attribute,
|
413
|
+
template += label(attribute, label_text + required_for_attribute(attribute))
|
413
414
|
template += upload_help(attribute, options)
|
414
415
|
template += @template.file_field @object_name, attribute
|
415
416
|
|
@@ -9,10 +9,8 @@ module Decidim
|
|
9
9
|
|
10
10
|
included do
|
11
11
|
# Returns a User collection Participants
|
12
|
-
#
|
13
|
-
def self.newsletter_participant_ids(_component)
|
14
|
-
nil
|
15
|
-
end
|
12
|
+
# Behaves as an abstract method, you must overwrite it in each includer class.
|
13
|
+
def self.newsletter_participant_ids(_component); end
|
16
14
|
end
|
17
15
|
end
|
18
16
|
end
|
data/lib/decidim/paddable.rb
CHANGED
@@ -64,10 +64,17 @@ module Decidim
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def pad_id
|
67
|
-
@pad_id ||= [
|
68
|
-
|
69
|
-
|
70
|
-
|
67
|
+
@pad_id ||= [reference, token].join("-").slice(0, 50)
|
68
|
+
end
|
69
|
+
|
70
|
+
# compatibilize with old versions if no salt available (less secure)
|
71
|
+
def token
|
72
|
+
if defined?(salt) && salt.present?
|
73
|
+
tokenizer = Decidim::Tokenizer.new(salt: salt)
|
74
|
+
return tokenizer.hex_digest(id)
|
75
|
+
end
|
76
|
+
|
77
|
+
Digest::MD5.hexdigest("#{id}-#{Rails.application.secrets.secret_key_base}")
|
71
78
|
end
|
72
79
|
|
73
80
|
def build_pad_url(id)
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Premailer
|
4
|
+
module Adapter
|
5
|
+
# Decidim adapter for Premailer
|
6
|
+
module Decidim
|
7
|
+
include ::Premailer::Adapter::Nokogiri
|
8
|
+
|
9
|
+
# Converts the HTML document to a format suitable for plain-text e-mail.
|
10
|
+
#
|
11
|
+
# If present, uses the <body> element as its base; otherwise uses the whole document.
|
12
|
+
#
|
13
|
+
# Customized for Decidim in order to strip the inline <style> tags away
|
14
|
+
# from the plain text body.
|
15
|
+
#
|
16
|
+
# @return [String] a plain text.
|
17
|
+
def to_plain_text
|
18
|
+
html_src = begin
|
19
|
+
@doc.at("body").inner_html
|
20
|
+
rescue StandardError
|
21
|
+
""
|
22
|
+
end
|
23
|
+
|
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, "")
|
28
|
+
|
29
|
+
convert_to_text(html_src, @options[:line_length], @html_encoding)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decidim-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.23.
|
4
|
+
version: 0.23.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josep Jaume Rey Peroy
|
8
8
|
- Marc Riera Casals
|
9
9
|
- Oriol Gual Oliva
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2021-02-09 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: active_link_to
|
@@ -844,28 +844,28 @@ dependencies:
|
|
844
844
|
requirements:
|
845
845
|
- - '='
|
846
846
|
- !ruby/object:Gem::Version
|
847
|
-
version: 0.23.
|
847
|
+
version: 0.23.2
|
848
848
|
type: :runtime
|
849
849
|
prerelease: false
|
850
850
|
version_requirements: !ruby/object:Gem::Requirement
|
851
851
|
requirements:
|
852
852
|
- - '='
|
853
853
|
- !ruby/object:Gem::Version
|
854
|
-
version: 0.23.
|
854
|
+
version: 0.23.2
|
855
855
|
- !ruby/object:Gem::Dependency
|
856
856
|
name: decidim-dev
|
857
857
|
requirement: !ruby/object:Gem::Requirement
|
858
858
|
requirements:
|
859
859
|
- - '='
|
860
860
|
- !ruby/object:Gem::Version
|
861
|
-
version: 0.23.
|
861
|
+
version: 0.23.2
|
862
862
|
type: :development
|
863
863
|
prerelease: false
|
864
864
|
version_requirements: !ruby/object:Gem::Requirement
|
865
865
|
requirements:
|
866
866
|
- - '='
|
867
867
|
- !ruby/object:Gem::Version
|
868
|
-
version: 0.23.
|
868
|
+
version: 0.23.2
|
869
869
|
description: Adds core features so other engines can hook into the framework.
|
870
870
|
email:
|
871
871
|
- josepjaume@gmail.com
|
@@ -1235,8 +1235,8 @@ files:
|
|
1235
1235
|
- app/cells/decidim/tags/show.erb
|
1236
1236
|
- app/cells/decidim/tags_cell.rb
|
1237
1237
|
- app/cells/decidim/tos_page/announcement.erb
|
1238
|
+
- app/cells/decidim/tos_page/form.erb
|
1238
1239
|
- app/cells/decidim/tos_page/refuse_btn_modal.erb
|
1239
|
-
- app/cells/decidim/tos_page/sticky_form.erb
|
1240
1240
|
- app/cells/decidim/tos_page_cell.rb
|
1241
1241
|
- app/cells/decidim/translation_bar/show.erb
|
1242
1242
|
- app/cells/decidim/translation_bar_cell.rb
|
@@ -1642,6 +1642,7 @@ files:
|
|
1642
1642
|
- app/queries/decidim/user_groups/member_memberships.rb
|
1643
1643
|
- app/resolvers/decidim/core/metric_resolver.rb
|
1644
1644
|
- app/resolvers/decidim/hashtags_resolver.rb
|
1645
|
+
- app/scrubbers/decidim/newsletter_scrubber.rb
|
1645
1646
|
- app/scrubbers/decidim/user_input_scrubber.rb
|
1646
1647
|
- app/serializers/decidim/exporters/participatory_space_components_serializer.rb
|
1647
1648
|
- app/serializers/decidim/exporters/serializer.rb
|
@@ -1663,6 +1664,7 @@ files:
|
|
1663
1664
|
- app/services/decidim/resource_search.rb
|
1664
1665
|
- app/services/decidim/settings_change.rb
|
1665
1666
|
- app/services/decidim/static_map_generator.rb
|
1667
|
+
- app/services/decidim/tokenizer.rb
|
1666
1668
|
- app/services/decidim/traceability.rb
|
1667
1669
|
- app/services/decidim/zip_stream/zip_stream_writer.rb
|
1668
1670
|
- app/types/decidim/core/amendment_type.rb
|
@@ -1971,12 +1973,14 @@ files:
|
|
1971
1973
|
- config/locales/pt.yml
|
1972
1974
|
- config/locales/ro-RO.yml
|
1973
1975
|
- config/locales/ru.yml
|
1976
|
+
- config/locales/si-LK.yml
|
1974
1977
|
- config/locales/sk-SK.yml
|
1975
1978
|
- config/locales/sk.yml
|
1976
1979
|
- config/locales/sl.yml
|
1977
1980
|
- config/locales/so-SO.yml
|
1978
1981
|
- config/locales/sr-CS.yml
|
1979
1982
|
- config/locales/sv.yml
|
1983
|
+
- config/locales/sw-KE.yml
|
1980
1984
|
- config/locales/ti-ER.yml
|
1981
1985
|
- config/locales/tr-TR.yml
|
1982
1986
|
- config/locales/uk.yml
|
@@ -2210,6 +2214,7 @@ files:
|
|
2210
2214
|
- lib/decidim/core/test.rb
|
2211
2215
|
- lib/decidim/core/test/factories.rb
|
2212
2216
|
- lib/decidim/core/test/shared_examples/acts_as_author_examples.rb
|
2217
|
+
- lib/decidim/core/test/shared_examples/admin_log_presenter_examples.rb
|
2213
2218
|
- lib/decidim/core/test/shared_examples/admin_resource_gallery_examples.rb
|
2214
2219
|
- lib/decidim/core/test/shared_examples/amendable/accept_amendment_examples.rb
|
2215
2220
|
- lib/decidim/core/test/shared_examples/amendable/amendment_accepted_event_examples.rb
|
@@ -2236,6 +2241,7 @@ files:
|
|
2236
2241
|
- lib/decidim/core/test/shared_examples/coauthorable_interface_examples.rb
|
2237
2242
|
- lib/decidim/core/test/shared_examples/comments_examples.rb
|
2238
2243
|
- lib/decidim/core/test/shared_examples/component_type.rb
|
2244
|
+
- lib/decidim/core/test/shared_examples/counts_commentators_as_newsletter_participants.rb
|
2239
2245
|
- lib/decidim/core/test/shared_examples/edit_link_shared_examples.rb
|
2240
2246
|
- lib/decidim/core/test/shared_examples/embed_resource_examples.rb
|
2241
2247
|
- lib/decidim/core/test/shared_examples/endorsable_interface_examples.rb
|
@@ -2408,6 +2414,7 @@ files:
|
|
2408
2414
|
- lib/decidim/view_model.rb
|
2409
2415
|
- lib/devise/models/decidim_newsletterable.rb
|
2410
2416
|
- lib/devise/models/decidim_validatable.rb
|
2417
|
+
- lib/premailer/adapter/decidim.rb
|
2411
2418
|
- lib/tasks/decidim_data_portability_tasks.rake
|
2412
2419
|
- lib/tasks/decidim_locales_tasks.rake
|
2413
2420
|
- lib/tasks/decidim_metrics_tasks.rake
|
@@ -2481,7 +2488,7 @@ homepage: https://github.com/decidim/decidim
|
|
2481
2488
|
licenses:
|
2482
2489
|
- AGPL-3.0
|
2483
2490
|
metadata: {}
|
2484
|
-
post_install_message:
|
2491
|
+
post_install_message:
|
2485
2492
|
rdoc_options: []
|
2486
2493
|
require_paths:
|
2487
2494
|
- lib
|
@@ -2497,7 +2504,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
2497
2504
|
version: '0'
|
2498
2505
|
requirements: []
|
2499
2506
|
rubygems_version: 3.0.3
|
2500
|
-
signing_key:
|
2507
|
+
signing_key:
|
2501
2508
|
specification_version: 4
|
2502
2509
|
summary: The core of the Decidim framework.
|
2503
2510
|
test_files: []
|
@@ -1,29 +0,0 @@
|
|
1
|
-
<div data-sticky-container class="cell-sticky">
|
2
|
-
<div class="sticky"
|
3
|
-
data-sticky
|
4
|
-
data-stick-to="bottom"
|
5
|
-
data-margin-bottom="0"
|
6
|
-
data-top-anchor="sticky-top-stop:top"
|
7
|
-
data-btm-anchor="sticky-btm-stop:top"
|
8
|
-
data-sticky-on="small">
|
9
|
-
<article class="card">
|
10
|
-
<div class="card__content">
|
11
|
-
<div class="card__header">
|
12
|
-
<h5 class="card__title text-center">
|
13
|
-
<%= t("form.legend", scope: "decidim.pages.terms_and_conditions") %>
|
14
|
-
</h5>
|
15
|
-
</div>
|
16
|
-
|
17
|
-
<div class="row column flex-center">
|
18
|
-
<%= cell "decidim/tos_page", :refuse_btn_modal %>
|
19
|
-
|
20
|
-
<%= button_to decidim.accept_tos_path, method: :put, class: "button button--nomargin small" do %>
|
21
|
-
<%= t("form.agreement", scope: "decidim.pages.terms_and_conditions") %>
|
22
|
-
<% end %>
|
23
|
-
</div>
|
24
|
-
</div>
|
25
|
-
</article>
|
26
|
-
</div>
|
27
|
-
</div>
|
28
|
-
|
29
|
-
<div id="sticky-btm-stop"></div>
|