decidim-comments 0.20.1 → 0.21.0
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 +4 -4
- data/app/assets/javascripts/decidim/comments/bundle.js +7 -7
- data/app/assets/javascripts/decidim/comments/bundle.js.map +1 -1
- data/app/frontend/comments/comment.component.tsx +109 -17
- data/app/frontend/comments/comments.component.tsx +65 -8
- data/app/frontend/entry.ts +19 -0
- data/app/frontend/entry_test.ts +2 -0
- data/app/frontend/queries/comments.query.graphql +2 -2
- data/app/frontend/support/schema.ts +745 -744
- data/app/models/decidim/comments/comment.rb +28 -3
- data/app/queries/decidim/comments/sorted_comments.rb +8 -2
- data/app/scrubbers/decidim/comments/user_input_scrubber.rb +20 -0
- data/app/types/decidim/comments/commentable_interface.rb +2 -1
- data/config/locales/ar.yml +6 -0
- data/config/locales/ca.yml +6 -0
- data/config/locales/cs.yml +6 -0
- data/config/locales/el.yml +1 -0
- data/config/locales/en.yml +6 -0
- data/config/locales/es-MX.yml +6 -0
- data/config/locales/es-PY.yml +6 -0
- data/config/locales/es.yml +6 -0
- data/config/locales/fi-plain.yml +6 -0
- data/config/locales/fi.yml +6 -0
- data/config/locales/hu.yml +6 -0
- data/config/locales/it.yml +3 -0
- data/config/locales/nl.yml +4 -0
- data/config/locales/no.yml +6 -0
- data/lib/decidim/comments.rb +1 -0
- data/lib/decidim/comments/markdown.rb +55 -0
- data/lib/decidim/comments/version.rb +1 -1
- metadata +25 -8
data/lib/decidim/comments.rb
CHANGED
@@ -17,6 +17,7 @@ module Decidim
|
|
17
17
|
autoload :CommentSerializer, "decidim/comments/comment_serializer"
|
18
18
|
autoload :CommentVoteSerializer, "decidim/comments/comment_vote_serializer"
|
19
19
|
autoload :Export, "decidim/comments/export"
|
20
|
+
autoload :Markdown, "decidim/comments/markdown"
|
20
21
|
|
21
22
|
def self.data_portable_entities
|
22
23
|
["Decidim::Comments::Comment", "Decidim::Comments::CommentVote"]
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "redcarpet"
|
4
|
+
|
5
|
+
module Decidim
|
6
|
+
module Comments
|
7
|
+
# This class parses a string from plain text (markdown) and
|
8
|
+
# renders it as HTML.
|
9
|
+
class Markdown < ::Redcarpet::Render::Base
|
10
|
+
delegate :render, to: :markdown
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def markdown
|
15
|
+
@markdown ||= ::Redcarpet::Markdown.new(renderer)
|
16
|
+
end
|
17
|
+
|
18
|
+
def renderer
|
19
|
+
@renderer ||= Decidim::Comments::MarkdownRender.new
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
# Custom markdown renderer for Comments
|
24
|
+
class MarkdownRender < ::Redcarpet::Render::Safe
|
25
|
+
def initialize(extensions = {})
|
26
|
+
super({
|
27
|
+
autolink: true,
|
28
|
+
escape_html: false,
|
29
|
+
filter_html: true,
|
30
|
+
hard_wrap: true,
|
31
|
+
lax_spacing: false,
|
32
|
+
no_images: true,
|
33
|
+
no_styles: true
|
34
|
+
}.merge(extensions))
|
35
|
+
end
|
36
|
+
|
37
|
+
# renders quotes with a custom css class
|
38
|
+
def block_quote(quote)
|
39
|
+
%(<blockquote class="comment__quote">#{quote}</blockquote>)
|
40
|
+
end
|
41
|
+
|
42
|
+
# removes header tags in comments
|
43
|
+
def header(title, _level)
|
44
|
+
title
|
45
|
+
end
|
46
|
+
|
47
|
+
# prevents empty <p/> in comments
|
48
|
+
def paragraph(text)
|
49
|
+
return if text.blank?
|
50
|
+
|
51
|
+
"<p>#{text}</p>"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decidim-comments
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.21.0
|
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: 2020-
|
13
|
+
date: 2020-04-08 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: decidim-core
|
@@ -18,14 +18,14 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.
|
21
|
+
version: 0.21.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - '='
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: 0.
|
28
|
+
version: 0.21.0
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: jquery-rails
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
@@ -40,34 +40,48 @@ dependencies:
|
|
40
40
|
- - "~>"
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: '4.3'
|
43
|
+
- !ruby/object:Gem::Dependency
|
44
|
+
name: redcarpet
|
45
|
+
requirement: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '3.4'
|
50
|
+
type: :runtime
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - "~>"
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '3.4'
|
43
57
|
- !ruby/object:Gem::Dependency
|
44
58
|
name: decidim-admin
|
45
59
|
requirement: !ruby/object:Gem::Requirement
|
46
60
|
requirements:
|
47
61
|
- - '='
|
48
62
|
- !ruby/object:Gem::Version
|
49
|
-
version: 0.
|
63
|
+
version: 0.21.0
|
50
64
|
type: :development
|
51
65
|
prerelease: false
|
52
66
|
version_requirements: !ruby/object:Gem::Requirement
|
53
67
|
requirements:
|
54
68
|
- - '='
|
55
69
|
- !ruby/object:Gem::Version
|
56
|
-
version: 0.
|
70
|
+
version: 0.21.0
|
57
71
|
- !ruby/object:Gem::Dependency
|
58
72
|
name: decidim-dev
|
59
73
|
requirement: !ruby/object:Gem::Requirement
|
60
74
|
requirements:
|
61
75
|
- - '='
|
62
76
|
- !ruby/object:Gem::Version
|
63
|
-
version: 0.
|
77
|
+
version: 0.21.0
|
64
78
|
type: :development
|
65
79
|
prerelease: false
|
66
80
|
version_requirements: !ruby/object:Gem::Requirement
|
67
81
|
requirements:
|
68
82
|
- - '='
|
69
83
|
- !ruby/object:Gem::Version
|
70
|
-
version: 0.
|
84
|
+
version: 0.21.0
|
71
85
|
description: Pluggable comments system for some components.
|
72
86
|
email:
|
73
87
|
- josepjaume@gmail.com
|
@@ -143,6 +157,7 @@ files:
|
|
143
157
|
- app/queries/decidim/comments/metrics/comments_metric_manage.rb
|
144
158
|
- app/queries/decidim/comments/sorted_comments.rb
|
145
159
|
- app/resolvers/decidim/comments/vote_comment_resolver.rb
|
160
|
+
- app/scrubbers/decidim/comments/user_input_scrubber.rb
|
146
161
|
- app/services/decidim/comments/comment_creation.rb
|
147
162
|
- app/services/decidim/comments/new_comment_notification_creator.rb
|
148
163
|
- app/types/decidim/comments/commentable_interface.rb
|
@@ -155,6 +170,7 @@ files:
|
|
155
170
|
- config/locales/cs.yml
|
156
171
|
- config/locales/de.yml
|
157
172
|
- config/locales/el-GR.yml
|
173
|
+
- config/locales/el.yml
|
158
174
|
- config/locales/en.yml
|
159
175
|
- config/locales/eo-UY.yml
|
160
176
|
- config/locales/es-MX.yml
|
@@ -203,6 +219,7 @@ files:
|
|
203
219
|
- lib/decidim/comments/comments_helper.rb
|
204
220
|
- lib/decidim/comments/engine.rb
|
205
221
|
- lib/decidim/comments/export.rb
|
222
|
+
- lib/decidim/comments/markdown.rb
|
206
223
|
- lib/decidim/comments/mutation_extensions.rb
|
207
224
|
- lib/decidim/comments/query_extensions.rb
|
208
225
|
- lib/decidim/comments/test.rb
|