decidim-core 0.28.0.rc4 → 0.28.0.rc5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3bbd75ffde3e5d911a23282dd17dbf7d7c89892afe0559dd88d427e864ae2f14
4
- data.tar.gz: 7e794b245545ba6ab7f46f7c22d271d723bcd398c2f0149c37ecba577add235c
3
+ metadata.gz: 37cc684e07696370976c603c95bf458a7e14bceacce01065075d41ee7ca4c78a
4
+ data.tar.gz: 5ceaf46c0590d312dc3aca2845e6fe5e52ef72fd7de7bd23d9ad682d989d1f9c
5
5
  SHA512:
6
- metadata.gz: f28d4b6445a5492d52528e6add707d7fb57cabddc4132bfac229a04c6fa231f9867642b974996605850b5992a1ea652dcb87855524167d4f2673af6df26a7074
7
- data.tar.gz: e00c4df62dcaf1595cbc02e4d82bac24410dcbd86b81b6f6fb55d5827d96bb8197c919240608a6ea8284ad2929b637ee6d772278456438255bdec20f292c072c
6
+ metadata.gz: 7157ee30b55025f8eea0f6c18cae1463598ffa781a27f112b954d32104e93d50483de4798007f062f271c1a473986160904e19e13b9c403ec62561b5a6efc73b
7
+ data.tar.gz: 4691aeec84e9ef8ae1d91b24bc19c6b2573972ca73d87aba9e874daa5fbfb8342118516fb887274eb46d3fb0589ef61cb879df0f48a3791536a9af4b43eeae6e
@@ -106,7 +106,7 @@ module Decidim
106
106
  end
107
107
 
108
108
  def message(value)
109
- return content_tag(:span, value, class: "flash__message") unless value.is_a?(Hash)
109
+ return content_tag(:span, value, class: "flash__message flex items-center") unless value.is_a?(Hash)
110
110
 
111
111
  content_tag(:span, class: "flash__message") do
112
112
  concat value[:title]
@@ -1,5 +1,5 @@
1
1
  .flash {
2
- @apply flex justify-start items-center gap-4 rounded border-2 border-secondary my-4 p-4 bg-secondary/5;
2
+ @apply flex justify-start gap-4 border-l-4 border-secondary my-4 p-4 bg-secondary/5;
3
3
 
4
4
  &__icon {
5
5
  svg {
@@ -8,14 +8,30 @@
8
8
  }
9
9
 
10
10
  &__title {
11
- @apply font-semibold text-2xl;
11
+ @apply font-semibold text-lg;
12
12
  }
13
13
 
14
14
  &__message {
15
- @apply gap-2 text-black font-semibold text-lg;
15
+ @apply text-black font-semibold text-md;
16
16
 
17
17
  a {
18
- @apply underline;
18
+ @apply underline text-secondary;
19
+
20
+ svg {
21
+ @apply text-secondary;
22
+ }
23
+ }
24
+
25
+ p {
26
+ @apply font-normal text-md leading-6;
27
+ }
28
+
29
+ ul {
30
+ @apply ml-4;
31
+
32
+ li {
33
+ @apply list-disc;
34
+ }
19
35
  }
20
36
 
21
37
  &-body {
@@ -31,10 +47,23 @@
31
47
  }
32
48
  }
33
49
 
50
+ &.primary {
51
+ svg {
52
+ @apply text-secondary;
53
+ }
54
+ }
55
+
56
+ &.secondary,
57
+ &.info {
58
+ .flash__icon {
59
+ @apply text-secondary;
60
+ }
61
+ }
62
+
34
63
  &.success {
35
64
  @apply border-success bg-success/5;
36
65
 
37
- svg {
66
+ .flash__icon {
38
67
  @apply text-success;
39
68
  }
40
69
  }
@@ -42,7 +71,7 @@
42
71
  &.alert {
43
72
  @apply border-alert bg-alert/5;
44
73
 
45
- svg {
74
+ .flash__icon {
46
75
  @apply text-alert;
47
76
  }
48
77
  }
@@ -50,7 +79,7 @@
50
79
  &.warning {
51
80
  @apply border-warning bg-warning/5;
52
81
 
53
- svg {
82
+ .flash__icon {
54
83
  @apply text-warning;
55
84
  }
56
85
  }
@@ -31,7 +31,7 @@
31
31
  }
32
32
 
33
33
  .layout-2col {
34
- @apply md:grid grid-cols-12 container grow;
34
+ @apply md:grid grid-cols-12 container grow min-h-[60vh];
35
35
 
36
36
  &__aside {
37
37
  @apply col-span-4 lg:col-span-3 md:pr-16 py-6 md:py-12 gap-6 md:gap-12 flex flex-col justify-between items-start md:justify-start before:content-[''] before:absolute before:top-0 before:left-0 before:h-full before:w-1/2 before:-z-10 md:before:bg-background;
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Empty line for playing nice with tpope/vim-rails
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Decidim
4
+ # Adapted from https://hashrocket.com/blog/posts/recursive-sql-in-activerecord
4
5
  module ActsAsTree
5
6
  extend ActiveSupport::Concern
6
7
 
@@ -15,10 +16,22 @@ module Decidim
15
16
  @parent_item_foreign_key = name
16
17
  end
17
18
 
19
+ def parent_item_polymorphic_type_key(name = nil)
20
+ return @parent_item_polymorphic_type_key unless name
21
+
22
+ @parent_item_polymorphic_type_key = name
23
+ end
24
+
18
25
  def tree_for(item)
19
26
  where(Arel.sql("#{table_name}.id IN (#{tree_sql_for(item)})")).order("#{table_name}.id")
20
27
  end
21
28
 
29
+ def polymorphic_condition(item)
30
+ return "" if parent_item_polymorphic_type_key.blank?
31
+
32
+ "AND #{table_name}.#{parent_item_polymorphic_type_key} = '#{item.class.name}'"
33
+ end
34
+
22
35
  def tree_sql_for(item)
23
36
  <<-SQL.squish
24
37
  WITH RECURSIVE search_tree(id, path) AS (
@@ -28,7 +41,7 @@ module Decidim
28
41
  UNION ALL
29
42
  SELECT #{table_name}.id, path || #{table_name}.id
30
43
  FROM search_tree
31
- JOIN #{table_name} ON #{table_name}.#{parent_item_foreign_key} = search_tree.id
44
+ JOIN #{table_name} ON #{table_name}.#{parent_item_foreign_key} = search_tree.id #{polymorphic_condition(item)}
32
45
  WHERE NOT #{table_name}.id = ANY(path)
33
46
  )
34
47
  SELECT id FROM search_tree ORDER BY path
@@ -3,6 +3,7 @@
3
3
  require "decidim/faker/localized"
4
4
  require "decidim/faker/internet"
5
5
  require "decidim/dev"
6
+ require "decidim/dev/test/factories"
6
7
 
7
8
  require "decidim/participatory_processes/test/factories"
8
9
  require "decidim/assemblies/test/factories"
@@ -524,54 +525,6 @@ FactoryBot.define do
524
525
  author { create(:user, :confirmed, organization:) }
525
526
  end
526
527
 
527
- factory :dummy_resource, class: "Decidim::DummyResources::DummyResource" do
528
- transient do
529
- users { nil }
530
- # user_groups correspondence to users is by sorting order
531
- user_groups { [] }
532
- end
533
- title { Decidim::Faker::Localized.localized { generate(:name) } }
534
- component { create(:component, manifest_name: "dummy") }
535
- author { create(:user, :confirmed, organization: component.organization) }
536
- scope { create(:scope, organization: component.organization) }
537
-
538
- trait :published do
539
- published_at { Time.current }
540
- end
541
-
542
- trait :with_endorsements do
543
- after :create do |resource|
544
- 5.times.collect do
545
- create(:endorsement, resource:, author: build(:user, organization: resource.component.organization))
546
- end
547
- end
548
- end
549
- end
550
-
551
- factory :nested_dummy_resource, class: "Decidim::DummyResources::NestedDummyResource" do
552
- title { generate(:name) }
553
- dummy_resource { create(:dummy_resource) }
554
- end
555
-
556
- factory :coauthorable_dummy_resource, class: "Decidim::DummyResources::CoauthorableDummyResource" do
557
- title { generate(:name) }
558
- component { create(:component, manifest_name: "dummy") }
559
-
560
- transient do
561
- authors_list { [create(:user, organization: component.organization)] }
562
- end
563
-
564
- after :build do |resource, evaluator|
565
- evaluator.authors_list.each do |coauthor|
566
- resource.coauthorships << if coauthor.is_a?(Decidim::UserGroup)
567
- build(:coauthorship, author: coauthor.users.first, user_group: coauthor, coauthorable: resource, organization: evaluator.component.organization)
568
- else
569
- build(:coauthorship, author: coauthor, coauthorable: resource, organization: evaluator.component.organization)
570
- end
571
- end
572
- end
573
- end
574
-
575
528
  factory :resource_link, class: "Decidim::ResourceLink" do
576
529
  name { generate(:slug) }
577
530
  to { build(:dummy_resource) }
@@ -644,7 +597,7 @@ FactoryBot.define do
644
597
  end
645
598
  resource { build(:dummy_resource) }
646
599
  event_name { resource.class.name.underscore.tr("/", ".") }
647
- event_class { "Decidim::DummyResources::DummyResourceEvent" }
600
+ event_class { "Decidim::Dev::DummyResourceEvent" }
648
601
  extra do
649
602
  {
650
603
  some_extra_data: "1"
@@ -44,6 +44,38 @@ shared_examples "comments" do
44
44
  expect(page).to have_css(".comments > div:nth-child(2)", text: "Most Rated Comment")
45
45
  end
46
46
 
47
+ context "when there are comments and replies" do
48
+ let!(:single_comment) { create(:comment, commentable:) }
49
+ let!(:reply) { create(:comment, commentable: single_comment, root_commentable: commentable) }
50
+
51
+ it "displays the show replies link on comment with reply" do
52
+ visit resource_path
53
+ expect(page).not_to have_content("Comments are disabled at this time")
54
+ expect(page).to have_css(".comment", minimum: 1)
55
+
56
+ within("#accordion-#{single_comment.id}") do
57
+ expect(page).to have_content "Hide replies"
58
+ end
59
+ end
60
+
61
+ context "when there is a comment with the same parent id but different type with replies" do
62
+ let!(:other_component) { create(:component, manifest_name: :dummy, organization:) }
63
+ let!(:other_commentable) { create(:dummy_resource, component: other_component, author: user, id: single_comment.id) }
64
+ let!(:reply) { create(:comment, commentable: other_commentable, root_commentable: other_commentable) }
65
+ let!(:other_reply) { create(:comment, commentable: reply, root_commentable: other_commentable) }
66
+
67
+ it "displays the show replies link on comment with reply" do
68
+ visit resource_path
69
+ expect(page).not_to have_content("Comments are disabled at this time")
70
+ expect(page).to have_css(".comment", minimum: 1)
71
+
72
+ within("#accordion-#{single_comment.id}") do
73
+ expect(page).not_to have_content "Hide replies"
74
+ end
75
+ end
76
+ end
77
+ end
78
+
47
79
  context "when there are deleted comments" do
48
80
  let(:deleted_comment) { comments[0] }
49
81
 
@@ -23,10 +23,10 @@ shared_examples_for "participatory space dropdown metadata cell" do
23
23
 
24
24
  before do
25
25
  allow(Decidim::ActionLog).to receive(:public_resource_types).and_return(
26
- %w(Decidim::DummyResources::DummyResource)
26
+ %w(Decidim::Dev::DummyResource)
27
27
  )
28
28
  allow(Decidim::ActionLog).to receive(:publicable_public_resource_types).and_return(
29
- %w(Decidim::DummyResources::DummyResource)
29
+ %w(Decidim::Dev::DummyResource)
30
30
  )
31
31
  end
32
32
 
@@ -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.28.0.rc4"
7
+ "0.28.0.rc5"
8
8
  end
9
9
  end
10
10
  end
@@ -49,6 +49,8 @@ module Decidim
49
49
 
50
50
  ActiveSupport::Deprecation.warn(message)
51
51
  raise message if Rails.env.development? || Rails.env.test?
52
+
53
+ @icons["other"]
52
54
  end
53
55
  end
54
56
  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.28.0.rc4
4
+ version: 0.28.0.rc5
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-12-11 00:00:00.000000000 Z
13
+ date: 2023-12-18 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: active_link_to
@@ -74,14 +74,20 @@ dependencies:
74
74
  requirements:
75
75
  - - "~>"
76
76
  - !ruby/object:Gem::Version
77
- version: 2.2.1
77
+ version: 2.2.5
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: 2.2.5
78
81
  type: :runtime
79
82
  prerelease: false
80
83
  version_requirements: !ruby/object:Gem::Requirement
81
84
  requirements:
82
85
  - - "~>"
83
86
  - !ruby/object:Gem::Version
84
- version: 2.2.1
87
+ version: 2.2.5
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: 2.2.5
85
91
  - !ruby/object:Gem::Dependency
86
92
  name: cells-erb
87
93
  requirement: !ruby/object:Gem::Requirement
@@ -772,28 +778,28 @@ dependencies:
772
778
  requirements:
773
779
  - - '='
774
780
  - !ruby/object:Gem::Version
775
- version: 0.28.0.rc4
781
+ version: 0.28.0.rc5
776
782
  type: :runtime
777
783
  prerelease: false
778
784
  version_requirements: !ruby/object:Gem::Requirement
779
785
  requirements:
780
786
  - - '='
781
787
  - !ruby/object:Gem::Version
782
- version: 0.28.0.rc4
788
+ version: 0.28.0.rc5
783
789
  - !ruby/object:Gem::Dependency
784
790
  name: decidim-dev
785
791
  requirement: !ruby/object:Gem::Requirement
786
792
  requirements:
787
793
  - - '='
788
794
  - !ruby/object:Gem::Version
789
- version: 0.28.0.rc4
795
+ version: 0.28.0.rc5
790
796
  type: :development
791
797
  prerelease: false
792
798
  version_requirements: !ruby/object:Gem::Requirement
793
799
  requirements:
794
800
  - - '='
795
801
  - !ruby/object:Gem::Version
796
- version: 0.28.0.rc4
802
+ version: 0.28.0.rc5
797
803
  description: Adds core features so other engines can hook into the framework.
798
804
  email:
799
805
  - josepjaume@gmail.com
@@ -2125,6 +2131,7 @@ files:
2125
2131
  - app/views/layouts/decidim/user_profile.html.erb
2126
2132
  - config/assets.rb
2127
2133
  - config/brakeman.ignore
2134
+ - config/environment.rb
2128
2135
  - config/initializers/active_support.rb
2129
2136
  - config/initializers/browser.rb
2130
2137
  - config/initializers/carrierwave.rb
@@ -2879,7 +2886,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
2879
2886
  - !ruby/object:Gem::Version
2880
2887
  version: 1.3.1
2881
2888
  requirements: []
2882
- rubygems_version: 3.4.20
2889
+ rubygems_version: 3.4.22
2883
2890
  signing_key:
2884
2891
  specification_version: 4
2885
2892
  summary: The core of the Decidim framework.