decidim-comments 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +1 -0
  3. data/app/assets/javascripts/decidim/comments/bundle.js +501 -4
  4. data/app/assets/javascripts/decidim/comments/bundle.js.map +1 -1
  5. data/app/commands/decidim/comments/create_comment.rb +1 -0
  6. data/app/commands/decidim/comments/vote_comment.rb +1 -0
  7. data/app/forms/decidim/comments/comment_form.rb +1 -0
  8. data/app/frontend/comments/comment_order_selector.component.tsx +0 -1
  9. data/app/frontend/comments/down_vote_button.component.test.tsx +2 -2
  10. data/app/frontend/comments/down_vote_button.component.tsx +2 -2
  11. data/app/frontend/comments/up_vote_button.component.test.tsx +2 -2
  12. data/app/frontend/comments/up_vote_button.component.tsx +2 -2
  13. data/app/frontend/fragments/comment_thread.fragment.graphql +0 -3
  14. data/app/frontend/support/schema.ts +51 -16
  15. data/app/mailers/decidim/comments/comment_notification_mailer.rb +1 -0
  16. data/app/models/decidim/comments/abilities/admin_user.rb +1 -0
  17. data/app/models/decidim/comments/abilities/process_admin_user.rb +1 -0
  18. data/app/models/decidim/comments/application_record.rb +1 -0
  19. data/app/models/decidim/comments/comment.rb +3 -2
  20. data/app/models/decidim/comments/comment_vote.rb +3 -2
  21. data/app/models/decidim/comments/seed.rb +1 -0
  22. data/app/queries/decidim/comments/sorted_comments.rb +1 -0
  23. data/app/resolvers/decidim/comments/vote_comment_resolver.rb +1 -0
  24. data/app/types/decidim/comments/commentable_interface.rb +1 -0
  25. data/app/types/decidim/comments/commentable_mutation_type.rb +1 -0
  26. data/app/types/decidim/comments/commentable_type.rb +1 -0
  27. data/config/i18n-tasks.yml +2 -3
  28. data/lib/decidim/comments.rb +3 -0
  29. data/lib/decidim/comments/admin.rb +1 -0
  30. data/lib/decidim/comments/admin_engine.rb +1 -0
  31. data/lib/decidim/comments/api/add_comment_type.rb +1 -0
  32. data/lib/decidim/comments/api/comment_mutation_type.rb +1 -0
  33. data/lib/decidim/comments/api/comment_type.rb +1 -0
  34. data/lib/decidim/comments/comment_serializer.rb +37 -0
  35. data/lib/decidim/comments/comments_helper.rb +1 -0
  36. data/lib/decidim/comments/engine.rb +1 -0
  37. data/lib/decidim/comments/export.rb +22 -0
  38. data/lib/decidim/comments/mutation_extensions.rb +1 -0
  39. data/lib/decidim/comments/query_extensions.rb +1 -0
  40. data/lib/decidim/comments/test/factories.rb +1 -0
  41. metadata +8 -6
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Decidim
3
4
  module Comments
4
5
  # A helper to expose the comments component for a commentable
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require "rails"
3
4
  require "active_support/all"
4
5
 
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Comments
5
+ module Export
6
+ # Public: Given a resource class and a feature, returns the comments for that
7
+ # resource in that feature.
8
+ #
9
+ # resource_class - The resource's Class
10
+ # feature - The feature where the resource is scoped to.
11
+ #
12
+ # Returns an Arel::Relation with all the comments for that feature and resource.
13
+ def comments_for_resource(resource_class, feature)
14
+ Comment
15
+ .where(decidim_root_commentable_id: resource_class.where(feature: feature))
16
+ .where(decidim_root_commentable_type: resource_class.to_s)
17
+ end
18
+
19
+ module_function :comments_for_resource
20
+ end
21
+ end
22
+ end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Decidim
3
4
  module Comments
4
5
  # This module's job is to extend the API with custom fields related to
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Decidim
3
4
  module Comments
4
5
  # This module's job is to extend the API with custom fields related to
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require "decidim/core/test/factories"
3
4
  require "decidim/admin/test/factories"
4
5
 
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.1.0
4
+ version: 0.2.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: 2017-05-18 00:00:00.000000000 Z
13
+ date: 2017-06-02 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.1.0
21
+ version: 0.2.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.1.0
28
+ version: 0.2.0
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: rails
31
31
  requirement: !ruby/object:Gem::Requirement
@@ -60,14 +60,14 @@ dependencies:
60
60
  requirements:
61
61
  - - '='
62
62
  - !ruby/object:Gem::Version
63
- version: 0.1.0
63
+ version: 0.2.0
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.1.0
70
+ version: 0.2.0
71
71
  description: Pluggable comments system for some components.
72
72
  email:
73
73
  - josepjaume@gmail.com
@@ -165,9 +165,11 @@ files:
165
165
  - lib/decidim/comments/api/add_comment_type.rb
166
166
  - lib/decidim/comments/api/comment_mutation_type.rb
167
167
  - lib/decidim/comments/api/comment_type.rb
168
+ - lib/decidim/comments/comment_serializer.rb
168
169
  - lib/decidim/comments/commentable.rb
169
170
  - lib/decidim/comments/comments_helper.rb
170
171
  - lib/decidim/comments/engine.rb
172
+ - lib/decidim/comments/export.rb
171
173
  - lib/decidim/comments/mutation_extensions.rb
172
174
  - lib/decidim/comments/query_extensions.rb
173
175
  - lib/decidim/comments/test/factories.rb