decidim-comments 0.10.1 → 0.11.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/decidim/comments/bundle.js +1 -1
- data/app/assets/javascripts/decidim/comments/bundle.js.map +1 -1
- data/app/commands/decidim/comments/create_comment.rb +6 -31
- data/app/events/decidim/comments/comment_by_followed_user_event.rb +29 -0
- data/app/events/decidim/comments/comment_created_event.rb +1 -9
- data/app/events/decidim/comments/reply_created_event.rb +29 -0
- data/app/events/decidim/comments/user_mentioned_event.rb +1 -9
- data/app/frontend/support/graphql_transformer.js +5 -5
- data/app/models/decidim/comments/abilities/participatory_process_admin_ability.rb +1 -1
- data/app/models/decidim/comments/abilities/participatory_process_moderator_ability.rb +1 -1
- data/app/models/decidim/comments/comment.rb +10 -3
- data/app/services/decidim/comments/comment_creation.rb +33 -0
- data/app/services/decidim/comments/new_comment_notification_creator.rb +97 -0
- data/config/locales/ca.yml +15 -13
- data/config/locales/en.yml +15 -13
- data/config/locales/es.yml +15 -13
- data/config/locales/eu.yml +15 -13
- data/config/locales/fi.yml +15 -13
- data/config/locales/fr.yml +15 -13
- data/config/locales/gl.yml +15 -13
- data/config/locales/it.yml +15 -13
- data/config/locales/nl.yml +21 -19
- data/config/locales/pl.yml +15 -13
- data/config/locales/pt-BR.yml +15 -13
- data/config/locales/pt.yml +15 -13
- data/config/locales/ru.yml +0 -2
- data/config/locales/sv.yml +15 -13
- data/config/locales/uk.yml +0 -10
- data/lib/decidim/comments.rb +1 -1
- data/lib/decidim/comments/api/comment_type.rb +2 -7
- data/lib/decidim/comments/engine.rb +3 -3
- data/lib/decidim/comments/export.rb +6 -6
- data/lib/decidim/comments/test.rb +3 -0
- data/lib/decidim/comments/test/shared_examples/create_comment_context.rb +31 -0
- data/lib/decidim/comments/version.rb +1 -1
- metadata +16 -10
data/config/locales/uk.yml
CHANGED
@@ -50,20 +50,10 @@ uk:
|
|
50
50
|
blocked_comments_warning: Коментарі зараз вимкнені, але ви можете прочитати попередні.
|
51
51
|
loading: Завантаження коментарів...
|
52
52
|
title: "%{count} коментарів"
|
53
|
-
featured_comment:
|
54
|
-
title: Рекомендований коментар
|
55
53
|
events:
|
56
54
|
comments:
|
57
|
-
comment_created:
|
58
|
-
comment:
|
59
|
-
email_intro: '"%{resource_title}" прокоментували. Ви можете прочитати коментар на цій сторінці:'
|
60
|
-
reply:
|
61
|
-
email_intro: '"%{resource_title}" прокоментували'
|
62
|
-
email_subject: Надійшла нова відповідь на ваш коментар від %{author_name} на <a href="%{resource_url}">%{resource_title}</a>
|
63
|
-
notification_title: Надійшла нова відповідь на ваш коментар від <a href="%{author_path}">%{author_name} %{author_nickname}</a> на <a href="%{resource_path}">%{resource_title}</a>
|
64
55
|
user_mentioned:
|
65
56
|
email_intro: Вас згадали
|
66
|
-
email_outro: Ви отримали це сповіщення, оскільки вас згадали в "%{resource_title}".
|
67
57
|
email_subject: Вас згадали у %{resource_title}
|
68
58
|
notification_title: <a href="%{author_path}">%{author_name} %{author_nickname}</a> згадав вас у <a href="%{resource_path}">%{resource_title}</a>
|
69
59
|
errors:
|
data/lib/decidim/comments.rb
CHANGED
@@ -5,7 +5,7 @@ require "decidim/comments/engine"
|
|
5
5
|
require "decidim/comments/admin_engine"
|
6
6
|
|
7
7
|
module Decidim
|
8
|
-
# This module contains all the logic related to the comments
|
8
|
+
# This module contains all the logic related to the comments component.
|
9
9
|
# It exposes a single entry point as a rails helper method to render
|
10
10
|
# a React component which handle all the comments render and logic.
|
11
11
|
module Comments
|
@@ -8,7 +8,8 @@ module Decidim
|
|
8
8
|
description "A comment"
|
9
9
|
|
10
10
|
interfaces [
|
11
|
-
Decidim::Comments::CommentableInterface
|
11
|
+
Decidim::Comments::CommentableInterface,
|
12
|
+
Decidim::Core::AuthorableInterface
|
12
13
|
]
|
13
14
|
|
14
15
|
field :id, !types.ID, "The Comment's unique ID"
|
@@ -31,12 +32,6 @@ module Decidim
|
|
31
32
|
|
32
33
|
field :formattedCreatedAt, !types.String, "The creation date of the comment in relative format", property: :friendly_created_at
|
33
34
|
|
34
|
-
field :author, !Decidim::Core::AuthorInterface, "The comment's author" do
|
35
|
-
resolve lambda { |obj, _args, _ctx|
|
36
|
-
obj.user_group || obj.author
|
37
|
-
}
|
38
|
-
end
|
39
|
-
|
40
35
|
field :alignment, types.Int, "The comment's alignment. Can be 0 (neutral), 1 (in favor) or -1 (against)'"
|
41
36
|
|
42
37
|
field :upVotes, !types.Int, "The number of comment's upVotes" do
|
@@ -36,9 +36,9 @@ module Decidim
|
|
36
36
|
end
|
37
37
|
|
38
38
|
initializer "decidim.stats" do
|
39
|
-
Decidim.stats.register :comments_count, priority: StatsRegistry::MEDIUM_PRIORITY do |
|
40
|
-
Decidim.
|
41
|
-
|
39
|
+
Decidim.stats.register :comments_count, priority: StatsRegistry::MEDIUM_PRIORITY do |components, start_at, end_at|
|
40
|
+
Decidim.component_manifests.sum do |component|
|
41
|
+
component.stats.filter(tag: :comments).with_context(components, start_at, end_at).map { |_name, value| value }.sum
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
@@ -3,16 +3,16 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Comments
|
5
5
|
module Export
|
6
|
-
# Public: Given a resource class and a
|
7
|
-
# resource in that
|
6
|
+
# Public: Given a resource class and a component, returns the comments for that
|
7
|
+
# resource in that component.
|
8
8
|
#
|
9
9
|
# resource_class - The resource's Class
|
10
|
-
#
|
10
|
+
# component - The component where the resource is scoped to.
|
11
11
|
#
|
12
|
-
# Returns an Arel::Relation with all the comments for that
|
13
|
-
def comments_for_resource(resource_class,
|
12
|
+
# Returns an Arel::Relation with all the comments for that component and resource.
|
13
|
+
def comments_for_resource(resource_class, component)
|
14
14
|
Comment
|
15
|
-
.where(decidim_root_commentable_id: resource_class.where(
|
15
|
+
.where(decidim_root_commentable_id: resource_class.where(component: component))
|
16
16
|
.where(decidim_root_commentable_type: resource_class.to_s)
|
17
17
|
end
|
18
18
|
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
RSpec.shared_context "when creating a comment" do
|
4
|
+
let(:organization) { create(:organization) }
|
5
|
+
let(:participatory_process) { create(:participatory_process, organization: organization) }
|
6
|
+
let(:component) { create(:component, participatory_space: participatory_process) }
|
7
|
+
let(:user) { create(:user, organization: organization) }
|
8
|
+
let(:author) { create(:user, organization: organization) }
|
9
|
+
let(:dummy_resource) { create :dummy_resource, component: component }
|
10
|
+
let(:commentable) { dummy_resource }
|
11
|
+
let(:body) { ::Faker::Lorem.paragraph }
|
12
|
+
let(:alignment) { 1 }
|
13
|
+
let(:user_group_id) { nil }
|
14
|
+
let(:form_params) do
|
15
|
+
{
|
16
|
+
"comment" => {
|
17
|
+
"body" => body,
|
18
|
+
"alignment" => alignment,
|
19
|
+
"user_group_id" => user_group_id
|
20
|
+
}
|
21
|
+
}
|
22
|
+
end
|
23
|
+
let(:form) do
|
24
|
+
Decidim::Comments::CommentForm.from_params(
|
25
|
+
form_params
|
26
|
+
).with_context(
|
27
|
+
current_organization: organization
|
28
|
+
)
|
29
|
+
end
|
30
|
+
let(:command) { described_class.new(form, author, commentable) }
|
31
|
+
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.11.0.pre1
|
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: 2018-04-
|
13
|
+
date: 2018-04-26 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.11.0.pre1
|
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.11.0.pre1
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: jquery-rails
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
@@ -46,28 +46,28 @@ dependencies:
|
|
46
46
|
requirements:
|
47
47
|
- - '='
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: 0.
|
49
|
+
version: 0.11.0.pre1
|
50
50
|
type: :development
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
54
|
- - '='
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version: 0.
|
56
|
+
version: 0.11.0.pre1
|
57
57
|
- !ruby/object:Gem::Dependency
|
58
58
|
name: decidim-dev
|
59
59
|
requirement: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
61
|
- - '='
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version: 0.
|
63
|
+
version: 0.11.0.pre1
|
64
64
|
type: :development
|
65
65
|
prerelease: false
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
68
|
- - '='
|
69
69
|
- !ruby/object:Gem::Version
|
70
|
-
version: 0.
|
70
|
+
version: 0.11.0.pre1
|
71
71
|
description: Pluggable comments system for some components.
|
72
72
|
email:
|
73
73
|
- josepjaume@gmail.com
|
@@ -85,7 +85,9 @@ files:
|
|
85
85
|
- app/assets/javascripts/decidim/comments/comments.js.erb
|
86
86
|
- app/commands/decidim/comments/create_comment.rb
|
87
87
|
- app/commands/decidim/comments/vote_comment.rb
|
88
|
+
- app/events/decidim/comments/comment_by_followed_user_event.rb
|
88
89
|
- app/events/decidim/comments/comment_created_event.rb
|
90
|
+
- app/events/decidim/comments/reply_created_event.rb
|
89
91
|
- app/events/decidim/comments/user_mentioned_event.rb
|
90
92
|
- app/forms/decidim/comments/comment_form.rb
|
91
93
|
- app/frontend/application/apollo_client.ts
|
@@ -141,6 +143,8 @@ files:
|
|
141
143
|
- app/models/decidim/comments/seed.rb
|
142
144
|
- app/queries/decidim/comments/sorted_comments.rb
|
143
145
|
- app/resolvers/decidim/comments/vote_comment_resolver.rb
|
146
|
+
- app/services/decidim/comments/comment_creation.rb
|
147
|
+
- app/services/decidim/comments/new_comment_notification_creator.rb
|
144
148
|
- app/types/decidim/comments/commentable_interface.rb
|
145
149
|
- app/types/decidim/comments/commentable_mutation_type.rb
|
146
150
|
- app/types/decidim/comments/commentable_type.rb
|
@@ -181,7 +185,9 @@ files:
|
|
181
185
|
- lib/decidim/comments/export.rb
|
182
186
|
- lib/decidim/comments/mutation_extensions.rb
|
183
187
|
- lib/decidim/comments/query_extensions.rb
|
188
|
+
- lib/decidim/comments/test.rb
|
184
189
|
- lib/decidim/comments/test/factories.rb
|
190
|
+
- lib/decidim/comments/test/shared_examples/create_comment_context.rb
|
185
191
|
- lib/decidim/comments/version.rb
|
186
192
|
homepage: https://github.com/decidim/decidim
|
187
193
|
licenses:
|
@@ -198,9 +204,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
198
204
|
version: '2.3'
|
199
205
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
200
206
|
requirements:
|
201
|
-
- - "
|
207
|
+
- - ">"
|
202
208
|
- !ruby/object:Gem::Version
|
203
|
-
version:
|
209
|
+
version: 1.3.1
|
204
210
|
requirements: []
|
205
211
|
rubyforge_project:
|
206
212
|
rubygems_version: 2.7.3
|