decidim-debates 0.25.0.rc1 → 0.25.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 97828fac1d6b2d8cd43062632817987a4fc5391df31e8a1bdcd69836fcd428fa
4
- data.tar.gz: 68783612163514c85d2aa437ea1b459c1dd00aaa12fe231173cf4c43175a674c
3
+ metadata.gz: 82cb7a6fc595965aebb6b4cce2034cf8fe6fdc5f3df354e096a1d499144801bf
4
+ data.tar.gz: 93b13e03a11fa50e576781ca8fba491d460fc48299e11c8fc8c9f1f1080972d0
5
5
  SHA512:
6
- metadata.gz: 017cb858eb199b43f9fb10008aa1cd92220fc95390d84c751072a1a87fd619364d7c460ad2754ff2b274dc46f5d56eaaf233ba11ea9d9f7df3cd1a26a03fd3e8
7
- data.tar.gz: 20f8b2818ad13a1d1496c8a4e57e45206a8ea7c11e8a35e468f7d3d23a6dab6702a98f498db190409ba377a2a60a942032a85616a58a174c76fbde62452f9d7d
6
+ metadata.gz: 43af1a218cd7f16db62aa73f84d7e4e5ee32c97737ec5e5ee90b065de2ddac0aff845134e226709427fca4369fa1013723404968b2b20c7af9f5a31d65ab79db
7
+ data.tar.gz: 7512eabfc220d3eaba29b4cd1ec6f56d5622410aacf9db8785605ff812bf19ebba4f3bcf18dee8b308095a71bee14c2149cde3bff42235cb05bf995a699fbca7
@@ -5,11 +5,9 @@ module Decidim
5
5
  #
6
6
  # Decorator for debates
7
7
  #
8
- class DebatePresenter < SimpleDelegator
8
+ class DebatePresenter < Decidim::ResourcePresenter
9
9
  include Decidim::TranslationsHelper
10
10
  include Decidim::ResourceHelper
11
- include Decidim::SanitizeHelper
12
- include Decidim::TranslatableAttributes
13
11
  include ActionView::Helpers::DateHelper
14
12
 
15
13
  def debate
@@ -26,13 +24,10 @@ module Decidim
26
24
  end
27
25
  end
28
26
 
29
- def title(links: false, all_locales: false)
27
+ def title(links: false, all_locales: false, html_escape: false)
30
28
  return unless debate
31
29
 
32
- handle_locales(debate.title, all_locales) do |content|
33
- renderer = Decidim::ContentRenderers::HashtagRenderer.new(decidim_html_escape(content))
34
- renderer.render(links: links).html_safe
35
- end
30
+ super debate.title, links, html_escape, all_locales
36
31
  end
37
32
 
38
33
  def description(strip_tags: false, links: false, all_locales: false)
@@ -47,20 +42,6 @@ module Decidim
47
42
  end
48
43
  end
49
44
 
50
- def handle_locales(content, all_locales, &block)
51
- if all_locales
52
- content.each_with_object({}) do |(key, value), parsed_content|
53
- parsed_content[key] = if key == "machine_translations"
54
- handle_locales(value, all_locales, &block)
55
- else
56
- block.call(value)
57
- end
58
- end
59
- else
60
- yield(translated_attribute(content))
61
- end
62
- end
63
-
64
45
  def last_comment_at
65
46
  return unless debate.last_comment_at
66
47
 
@@ -25,7 +25,7 @@
25
25
  <% debates.each do |debate| %>
26
26
  <tr data-id="<%= debate.id %>">
27
27
  <td>
28
- <%= link_to present(debate).title, resource_locator(debate).path, target: :blank %><br>
28
+ <%= link_to present(debate).title(html_escape: true), resource_locator(debate).path, target: :blank %><br>
29
29
  </td>
30
30
  <td>
31
31
  <% if debate.start_time %>
@@ -1,6 +1,6 @@
1
1
  <% add_decidim_meta_tags({
2
2
  description: translated_attribute(debate.description),
3
- title: present(debate).title,
3
+ title: present(debate).title(html_escape: true ),
4
4
  url: debate_url(debate.id)
5
5
  }) %>
6
6
 
@@ -22,7 +22,7 @@ edit_link(
22
22
  </div>
23
23
 
24
24
  <h2 class="heading3">
25
- <%== present(debate).title(links: true) %>
25
+ <%== present(debate).title(links: true, html_escape: true) %>
26
26
  </h2>
27
27
 
28
28
  <% debate_presenter = Decidim::Debates::DebatePresenter.new(debate) %>
@@ -6,7 +6,17 @@ end
6
6
 
7
7
  FactoryBot.define do
8
8
  factory :debate, class: "Decidim::Debates::Debate" do
9
- title { generate_localized_debate_title }
9
+ transient do
10
+ skip_injection { false }
11
+ end
12
+
13
+ title do
14
+ if skip_injection
15
+ Decidim::Faker::Localized.localized { generate(:title) }
16
+ else
17
+ Decidim::Faker::Localized.localized { "<script>alert(\"TITLE\");</script> #{generate(:title)}" }
18
+ end
19
+ end
10
20
  description { Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_debate_title } }
11
21
  information_updates { Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_debate_title } }
12
22
  instructions { Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_debate_title } }
@@ -4,7 +4,7 @@ module Decidim
4
4
  # This holds the decidim-debates version.
5
5
  module Debates
6
6
  def self.version
7
- "0.25.0.rc1"
7
+ "0.25.0.rc2"
8
8
  end
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-debates
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.25.0.rc1
4
+ version: 0.25.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josep Jaume Rey Peroy
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2021-07-28 00:00:00.000000000 Z
14
+ date: 2021-09-13 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: decidim-comments
@@ -19,56 +19,56 @@ dependencies:
19
19
  requirements:
20
20
  - - '='
21
21
  - !ruby/object:Gem::Version
22
- version: 0.25.0.rc1
22
+ version: 0.25.0.rc2
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - '='
28
28
  - !ruby/object:Gem::Version
29
- version: 0.25.0.rc1
29
+ version: 0.25.0.rc2
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: decidim-core
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  requirements:
34
34
  - - '='
35
35
  - !ruby/object:Gem::Version
36
- version: 0.25.0.rc1
36
+ version: 0.25.0.rc2
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
41
  - - '='
42
42
  - !ruby/object:Gem::Version
43
- version: 0.25.0.rc1
43
+ version: 0.25.0.rc2
44
44
  - !ruby/object:Gem::Dependency
45
45
  name: decidim-admin
46
46
  requirement: !ruby/object:Gem::Requirement
47
47
  requirements:
48
48
  - - '='
49
49
  - !ruby/object:Gem::Version
50
- version: 0.25.0.rc1
50
+ version: 0.25.0.rc2
51
51
  type: :development
52
52
  prerelease: false
53
53
  version_requirements: !ruby/object:Gem::Requirement
54
54
  requirements:
55
55
  - - '='
56
56
  - !ruby/object:Gem::Version
57
- version: 0.25.0.rc1
57
+ version: 0.25.0.rc2
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: decidim-dev
60
60
  requirement: !ruby/object:Gem::Requirement
61
61
  requirements:
62
62
  - - '='
63
63
  - !ruby/object:Gem::Version
64
- version: 0.25.0.rc1
64
+ version: 0.25.0.rc2
65
65
  type: :development
66
66
  prerelease: false
67
67
  version_requirements: !ruby/object:Gem::Requirement
68
68
  requirements:
69
69
  - - '='
70
70
  - !ruby/object:Gem::Version
71
- version: 0.25.0.rc1
71
+ version: 0.25.0.rc2
72
72
  description: A debates component for decidim's participatory spaces.
73
73
  email:
74
74
  - josepjaume@gmail.com
@@ -274,7 +274,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
274
274
  - !ruby/object:Gem::Version
275
275
  version: 1.3.1
276
276
  requirements: []
277
- rubygems_version: 3.1.4
277
+ rubygems_version: 3.1.2
278
278
  signing_key:
279
279
  specification_version: 4
280
280
  summary: Decidim debates module