decidim-core 0.27.2 → 0.27.3

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.

Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/upload_modal/files.erb +1 -0
  3. data/app/cells/decidim/upload_modal_cell.rb +14 -4
  4. data/app/commands/decidim/attachment_methods.rb +20 -2
  5. data/app/commands/decidim/create_registration.rb +1 -0
  6. data/app/commands/decidim/gallery_methods.rb +1 -1
  7. data/app/commands/decidim/update_account.rb +1 -0
  8. data/app/commands/decidim/update_password.rb +2 -0
  9. data/app/controllers/decidim/devise/sessions_controller.rb +18 -2
  10. data/app/controllers/decidim/links_controller.rb +8 -11
  11. data/app/helpers/decidim/cells_helper.rb +1 -0
  12. data/app/helpers/decidim/external_domain_helper.rb +14 -3
  13. data/app/helpers/decidim/sanitize_helper.rb +3 -2
  14. data/app/models/decidim/scope_type.rb +24 -0
  15. data/app/packs/src/decidim/direct_uploads/upload_modal.js +0 -1
  16. data/app/packs/src/decidim/editor/clipboard_override.js +6 -2
  17. data/app/packs/src/decidim/editor.js +63 -33
  18. data/app/packs/stylesheets/decidim/modules/_buttons.scss +10 -6
  19. data/app/packs/stylesheets/decidim/modules/_cards.scss +1 -1
  20. data/app/packs/stylesheets/decidim/modules/_comments.scss +24 -0
  21. data/app/packs/stylesheets/decidim/modules/_input-gallery.scss +2 -1
  22. data/app/packs/stylesheets/decidim/modules/_upload_modal.scss +0 -4
  23. data/app/packs/stylesheets/decidim/vizzs/_linechart.scss +2 -2
  24. data/app/packs/stylesheets/decidim/vizzs/_rowchart.scss +2 -2
  25. data/app/presenters/decidim/notification_presenter.rb +1 -1
  26. data/app/presenters/decidim/notification_to_mailer_presenter.rb +1 -0
  27. data/app/presenters/decidim/user_group_presenter.rb +1 -1
  28. data/app/presenters/decidim/user_presenter.rb +1 -1
  29. data/app/scrubbers/decidim/admin_input_scrubber.rb +3 -1
  30. data/app/scrubbers/decidim/user_input_scrubber.rb +30 -1
  31. data/app/services/decidim/traceability.rb +1 -0
  32. data/app/validators/uploader_image_dimensions_validator.rb +22 -2
  33. data/app/views/decidim/links/_invalid_url_modal.html.erb +17 -0
  34. data/app/views/decidim/links/_modal.html.erb +1 -1
  35. data/app/views/decidim/links/invalid_url.js.erb +24 -0
  36. data/app/views/decidim/links/new.html.erb +1 -1
  37. data/app/views/decidim/messaging/conversations/_conversation.html.erb +1 -5
  38. data/config/locales/ar.yml +566 -3
  39. data/config/locales/bg.yml +1 -4
  40. data/config/locales/ca.yml +21 -17
  41. data/config/locales/cs.yml +22 -30
  42. data/config/locales/da.yml +4 -0
  43. data/config/locales/de.yml +4 -22
  44. data/config/locales/el.yml +2 -4
  45. data/config/locales/en.yml +16 -13
  46. data/config/locales/eo.yml +2 -1
  47. data/config/locales/es-MX.yml +20 -16
  48. data/config/locales/es-PY.yml +20 -16
  49. data/config/locales/es.yml +21 -17
  50. data/config/locales/et.yml +4 -0
  51. data/config/locales/eu.yml +149 -58
  52. data/config/locales/fa-IR.yml +1 -0
  53. data/config/locales/fi-plain.yml +1 -18
  54. data/config/locales/fi.yml +19 -15
  55. data/config/locales/fr-CA.yml +23 -16
  56. data/config/locales/fr.yml +21 -14
  57. data/config/locales/ga-IE.yml +1 -0
  58. data/config/locales/gl.yml +0 -21
  59. data/config/locales/gn-PY.yml +4 -0
  60. data/config/locales/hr.yml +4 -0
  61. data/config/locales/hu.yml +64 -23
  62. data/config/locales/id-ID.yml +2 -4
  63. data/config/locales/is-IS.yml +2 -1
  64. data/config/locales/it.yml +1 -5
  65. data/config/locales/ja.yml +10 -21
  66. data/config/locales/ka-GE.yml +4 -0
  67. data/config/locales/kaa.yml +1 -0
  68. data/config/locales/lb.yml +0 -4
  69. data/config/locales/lt.yml +0 -34
  70. data/config/locales/lv.yml +0 -3
  71. data/config/locales/nl.yml +1 -23
  72. data/config/locales/no.yml +1 -23
  73. data/config/locales/oc-FR.yml +3 -0
  74. data/config/locales/pl.yml +0 -34
  75. data/config/locales/pt-BR.yml +2 -6
  76. data/config/locales/pt.yml +0 -4
  77. data/config/locales/ro-RO.yml +36 -4
  78. data/config/locales/ru.yml +1 -3
  79. data/config/locales/sk.yml +3 -5
  80. data/config/locales/sl.yml +1 -0
  81. data/config/locales/sr-CS.yml +2 -0
  82. data/config/locales/sv.yml +1 -23
  83. data/config/locales/tr-TR.yml +3 -7
  84. data/config/locales/uk.yml +1 -3
  85. data/config/locales/zh-CN.yml +0 -4
  86. data/config/locales/zh-TW.yml +1872 -0
  87. data/lib/decidim/asset_router/pipeline.rb +2 -0
  88. data/lib/decidim/core/test/shared_examples/comments_examples.rb +36 -0
  89. data/lib/decidim/core/test/shared_examples/digest_mail_examples.rb +33 -0
  90. data/lib/decidim/core/test/shared_examples/editor_shared_examples.rb +5 -4
  91. data/lib/decidim/core/test/shared_examples/rich_text_editor_examples.rb +7 -3
  92. data/lib/decidim/core/test.rb +1 -0
  93. data/lib/decidim/core/version.rb +1 -1
  94. data/lib/decidim/form_builder.rb +4 -3
  95. data/lib/decidim/publicable.rb +4 -0
  96. metadata +12 -7
@@ -28,6 +28,8 @@ module Decidim
28
28
  # resolved, the asset path.
29
29
  def url(**options)
30
30
  path = ActionController::Base.helpers.asset_pack_path(asset, **options)
31
+ return path if path.match?(%r{\A(https?:)?//})
32
+
31
33
  "#{asset_host}#{path}"
32
34
  end
33
35
 
@@ -416,6 +416,42 @@ shared_examples "comments" do
416
416
  )
417
417
  end
418
418
 
419
+ context "when user can hide replies on a thread" do
420
+ let(:thread) { comments.first }
421
+ let(:new_reply_body) { "Hey, I just jumped inside the thread!" }
422
+ let!(:new_reply) { create(:comment, commentable: thread, root_commentable: commentable, body: new_reply_body) }
423
+
424
+ it "displays the hide button" do
425
+ visit current_path
426
+ within "#comment_#{thread.id}" do
427
+ expect(page).to have_content("Hide replies")
428
+ expect(page).to have_content(new_reply_body)
429
+ end
430
+ end
431
+
432
+ it "displays the show button" do
433
+ visit current_path
434
+ within "#comment_#{thread.id}" do
435
+ click_button "Hide replies"
436
+ expect(page).to have_content("Show reply")
437
+ expect(page).not_to have_content(new_reply_body)
438
+ end
439
+ end
440
+
441
+ context "when are more replies" do
442
+ let!(:new_replies) { create_list(:comment, 2, commentable: thread, root_commentable: commentable, body: new_reply_body) }
443
+
444
+ it "displays the show button" do
445
+ visit current_path
446
+ within "#comment_#{thread.id}" do
447
+ click_button "Hide replies"
448
+ expect(page).to have_content("Show 3 replies")
449
+ expect(page).not_to have_content(new_reply_body)
450
+ end
451
+ end
452
+ end
453
+ end
454
+
419
455
  context "when inside a thread reply form" do
420
456
  let(:thread) { comments.first }
421
457
  let(:new_reply_body) { "Hey, I just jumped inside the thread!" }
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ shared_context "when sends the notification digest" do
4
+ context "when daily notification mail" do
5
+ let(:user) { create(:user, :admin, organization: organization, notifications_sending_frequency: "daily") }
6
+
7
+ it_behaves_like "notification digest mail"
8
+ end
9
+
10
+ context "when weekly notification mail" do
11
+ let(:user) { create(:user, :admin, organization: organization, notifications_sending_frequency: "weekly") }
12
+
13
+ it_behaves_like "notification digest mail"
14
+ end
15
+ end
16
+
17
+ shared_examples_for "notification digest mail" do
18
+ context "when a notificable event takes place" do
19
+ let!(:organization) { create(:organization) }
20
+ let!(:participatory_space) { create(:participatory_process, organization: organization) }
21
+
22
+ it "sends a notification to the user's email" do
23
+ perform_enqueued_jobs do
24
+ expect(command.call).to broadcast(:ok)
25
+ Decidim::Notification.last.update(created_at: 1.day.ago)
26
+ Decidim::EmailNotificationsDigestGeneratorJob.perform_now(user.id, user.notifications_sending_frequency)
27
+ end
28
+
29
+ expect(last_email_body.length).to be_positive
30
+ expect(last_email_body).not_to include("translation missing")
31
+ end
32
+ end
33
+ end
@@ -1,8 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- shared_examples_for "has embedded video in description" do |description_attribute_name|
3
+ shared_examples_for "has embedded video in description" do |description_attribute_name, count: 1|
4
4
  let(description_attribute_name) { { en: %(Description <iframe class="ql-video" allowfullscreen="true" src="#{iframe_src}" frameborder="0"></iframe>) } }
5
5
  let(:iframe_src) { "http://www.example.org" }
6
+ let!(:cookie_warning) { "You need to enable all cookies in order to see this content" }
6
7
 
7
8
  context "when cookies are rejected" do
8
9
  before do
@@ -11,7 +12,7 @@ shared_examples_for "has embedded video in description" do |description_attribut
11
12
  end
12
13
 
13
14
  it "disables iframe" do
14
- expect(page).to have_content("You need to enable all cookies in order to see this content")
15
+ expect(page).to have_content(cookie_warning)
15
16
  expect(page).not_to have_selector("iframe")
16
17
  end
17
18
  end
@@ -23,8 +24,8 @@ shared_examples_for "has embedded video in description" do |description_attribut
23
24
  end
24
25
 
25
26
  it "shows iframe" do
26
- expect(page).not_to have_content("You need to enable all cookies in order to see this content")
27
- expect(page).to have_selector("iframe", count: 1)
27
+ expect(page).not_to have_content(cookie_warning)
28
+ expect(page).to have_selector("iframe", count: count)
28
29
  end
29
30
  end
30
31
  end
@@ -1,13 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- shared_examples "having a rich text editor" do |css, toolbar|
4
- it "has a form with a rich text editor" do
5
- within "form.#{css}" do
3
+ shared_examples "having a rich text editor for field" do |selector, toolbar|
4
+ it "has a rich text editor" do
5
+ within selector do
6
6
  expect(page).to have_selector("div.editor-container[data-toolbar='#{toolbar}']", visible: :all)
7
7
  end
8
8
  end
9
9
  end
10
10
 
11
+ shared_examples "having a rich text editor" do |css, toolbar|
12
+ it_behaves_like "having a rich text editor for field", "form.#{css}", toolbar
13
+ end
14
+
11
15
  shared_context "with rich text editor content" do
12
16
  let(:content) { "<p>#{safe_tags}</p>#{script}" }
13
17
  let(:safe_tags) { em + u + strong }
@@ -75,3 +75,4 @@ require "decidim/core/test/shared_examples/conversations_examples"
75
75
  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
+ require "decidim/core/test/shared_examples/digest_mail_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.2"
7
+ "0.27.3"
8
8
  end
9
9
  end
10
10
  end
@@ -444,7 +444,7 @@ module Decidim
444
444
  # * resouce_name: Name of the resource (e.g. user)
445
445
  # * resource_class: Attribute's resource class (e.g. Decidim::User)
446
446
  # * resouce_class: Class of the resource (e.g. user)
447
- # * optional: Whether the file can be optional or not.
447
+ # * required: Whether the file is required or not (false by default).
448
448
  # * titled: Whether the file can have title or not.
449
449
  # * show_current: Whether the current file is displayed next to the button.
450
450
  # * help: Array of help messages which are displayed inside of the upload modal.
@@ -464,7 +464,7 @@ module Decidim
464
464
  attribute: attribute,
465
465
  resource_name: @object_name,
466
466
  resource_class: options[:resource_class]&.to_s || resource_class(attribute),
467
- optional: true,
467
+ required: false,
468
468
  titled: false,
469
469
  show_current: true,
470
470
  max_file_size: max_file_size,
@@ -712,6 +712,8 @@ module Decidim
712
712
  safe_join([yield, text.html_safe])
713
713
  elsif block_given?
714
714
  safe_join([text.html_safe, yield])
715
+ else
716
+ text
715
717
  end
716
718
 
717
719
  label(attribute, text, options || {})
@@ -928,7 +930,6 @@ module Decidim
928
930
  return {} unless options[:editor_images]
929
931
 
930
932
  {
931
- editor_images: true,
932
933
  upload_images_path: Decidim::Core::Engine.routes.url_helpers.editor_images_path,
933
934
  drag_and_drop_help_text: I18n.t("drag_and_drop_help", scope: "decidim.editor_images")
934
935
  }
@@ -45,5 +45,9 @@ module Decidim
45
45
  def unpublish!
46
46
  update!(published_at: nil)
47
47
  end
48
+
49
+ def previously_published?
50
+ respond_to?(:versions) && versions.where(event: "update").where("object ->> 'published_at' IS NOT NULL").any?
51
+ end
48
52
  end
49
53
  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.27.2
4
+ version: 0.27.3
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-02-13 00:00:00.000000000 Z
13
+ date: 2023-05-11 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: active_link_to
@@ -740,28 +740,28 @@ dependencies:
740
740
  requirements:
741
741
  - - '='
742
742
  - !ruby/object:Gem::Version
743
- version: 0.27.2
743
+ version: 0.27.3
744
744
  type: :runtime
745
745
  prerelease: false
746
746
  version_requirements: !ruby/object:Gem::Requirement
747
747
  requirements:
748
748
  - - '='
749
749
  - !ruby/object:Gem::Version
750
- version: 0.27.2
750
+ version: 0.27.3
751
751
  - !ruby/object:Gem::Dependency
752
752
  name: decidim-dev
753
753
  requirement: !ruby/object:Gem::Requirement
754
754
  requirements:
755
755
  - - '='
756
756
  - !ruby/object:Gem::Version
757
- version: 0.27.2
757
+ version: 0.27.3
758
758
  type: :development
759
759
  prerelease: false
760
760
  version_requirements: !ruby/object:Gem::Requirement
761
761
  requirements:
762
762
  - - '='
763
763
  - !ruby/object:Gem::Version
764
- version: 0.27.2
764
+ version: 0.27.3
765
765
  description: Adds core features so other engines can hook into the framework.
766
766
  email:
767
767
  - josepjaume@gmail.com
@@ -1853,8 +1853,10 @@ files:
1853
1853
  - app/views/decidim/last_activities/_activities.html.erb
1854
1854
  - app/views/decidim/last_activities/index.html.erb
1855
1855
  - app/views/decidim/last_activities/index.js.erb
1856
+ - app/views/decidim/links/_invalid_url_modal.html.erb
1856
1857
  - app/views/decidim/links/_modal.html.erb
1857
1858
  - app/views/decidim/links/_warning.html.erb
1859
+ - app/views/decidim/links/invalid_url.js.erb
1858
1860
  - app/views/decidim/links/new.html.erb
1859
1861
  - app/views/decidim/links/new.js.erb
1860
1862
  - app/views/decidim/manifests/show.json.erb
@@ -2025,6 +2027,7 @@ files:
2025
2027
  - config/locales/et-EE.yml
2026
2028
  - config/locales/et.yml
2027
2029
  - config/locales/eu.yml
2030
+ - config/locales/fa-IR.yml
2028
2031
  - config/locales/fi-pl.yml
2029
2032
  - config/locales/fi-plain.yml
2030
2033
  - config/locales/fi.yml
@@ -2043,6 +2046,7 @@ files:
2043
2046
  - config/locales/it.yml
2044
2047
  - config/locales/ja.yml
2045
2048
  - config/locales/ka-GE.yml
2049
+ - config/locales/kaa.yml
2046
2050
  - config/locales/ko-KR.yml
2047
2051
  - config/locales/ko.yml
2048
2052
  - config/locales/lb-LU.yml
@@ -2452,6 +2456,7 @@ files:
2452
2456
  - lib/decidim/core/test/shared_examples/controller_render_views.rb
2453
2457
  - lib/decidim/core/test/shared_examples/conversations_examples.rb
2454
2458
  - lib/decidim/core/test/shared_examples/counts_commentators_as_newsletter_participants.rb
2459
+ - lib/decidim/core/test/shared_examples/digest_mail_examples.rb
2455
2460
  - lib/decidim/core/test/shared_examples/edit_link_shared_examples.rb
2456
2461
  - lib/decidim/core/test/shared_examples/editor_shared_examples.rb
2457
2462
  - lib/decidim/core/test/shared_examples/embed_resource_examples.rb
@@ -2699,7 +2704,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
2699
2704
  - !ruby/object:Gem::Version
2700
2705
  version: '0'
2701
2706
  requirements: []
2702
- rubygems_version: 3.3.7
2707
+ rubygems_version: 3.2.22
2703
2708
  signing_key:
2704
2709
  specification_version: 4
2705
2710
  summary: The core of the Decidim framework.