decidim-comments 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/decidim/comments/bundle.js +11 -11
  3. data/app/assets/javascripts/decidim/comments/bundle.js.map +1 -1
  4. data/app/commands/decidim/comments/create_comment.rb +2 -2
  5. data/app/frontend/comments/add_comment_form.component.tsx +1 -0
  6. data/app/frontend/comments/comment.component.test.tsx +12 -1
  7. data/app/frontend/comments/comment.component.tsx +42 -4
  8. data/app/frontend/comments/comment_thread.component.test.tsx +11 -0
  9. data/app/frontend/comments/comment_thread.component.tsx +5 -1
  10. data/app/frontend/fragments/comment_data.fragment.graphql +3 -0
  11. data/app/frontend/support/generate_comments_data.ts +3 -0
  12. data/app/frontend/support/schema.ts +18 -12
  13. data/app/mailers/decidim/comments/comment_notification_mailer.rb +6 -4
  14. data/app/models/decidim/comments/comment.rb +6 -4
  15. data/app/models/decidim/comments/comment_vote.rb +1 -2
  16. data/app/models/decidim/comments/seed.rb +5 -2
  17. data/app/resolvers/decidim/comments/vote_comment_resolver.rb +3 -0
  18. data/app/types/decidim/comments/commentable_interface.rb +3 -3
  19. data/app/views/decidim/comments/comment_notification_mailer/comment_created.html.erb +1 -1
  20. data/app/views/decidim/comments/comment_notification_mailer/reply_created.html.erb +1 -1
  21. data/config/locales/ca.yml +5 -0
  22. data/config/locales/en.yml +5 -0
  23. data/config/locales/es.yml +5 -0
  24. data/config/locales/it.yml +65 -0
  25. data/db/migrate/20161130143508_create_comments.rb +2 -0
  26. data/db/migrate/20161214082645_add_depth_to_comments.rb +2 -0
  27. data/db/migrate/20161216102820_add_alignment_to_comments.rb +2 -0
  28. data/db/migrate/20161219150806_create_comment_votes.rb +3 -1
  29. data/db/migrate/20170123102043_add_user_group_id_to_comments.rb +2 -0
  30. data/db/migrate/20170504085413_add_root_commentable_to_comments.rb +2 -0
  31. data/db/migrate/20170510091348_update_root_commentable_for_comments.rb +3 -2
  32. data/db/migrate/20170510091409_set_root_commentable_null_constraints.rb +2 -0
  33. data/lib/decidim/comments/comment_serializer.rb +1 -1
  34. data/lib/decidim/comments/commentable.rb +4 -4
  35. metadata +9 -8
@@ -13,15 +13,15 @@ module Decidim
13
13
  property :commentable_type
14
14
  end
15
15
 
16
- field :acceptsNewComments, !types.Boolean, "Wether the object can have new comments or not" do
16
+ field :acceptsNewComments, !types.Boolean, "Whether the object can have new comments or not" do
17
17
  property :accepts_new_comments?
18
18
  end
19
19
 
20
- field :commentsHaveAlignment, !types.Boolean, "Wether the object comments have alignment or not" do
20
+ field :commentsHaveAlignment, !types.Boolean, "Whether the object comments have alignment or not" do
21
21
  property :comments_have_alignment?
22
22
  end
23
23
 
24
- field :commentsHaveVotes, !types.Boolean, "Wether the object comments have votes or not" do
24
+ field :commentsHaveVotes, !types.Boolean, "Whether the object comments have votes or not" do
25
25
  property :comments_have_votes?
26
26
  end
27
27
 
@@ -4,7 +4,7 @@
4
4
  <%=
5
5
  t(".new_comment_html", {
6
6
  commenter: @comment.author.name,
7
- commentable_link: link_to(commentable_title, decidim_resource_url(@commentable))
7
+ commentable_link: link_to(commentable_title, @locator.url(anchor: "comment_#{@comment.id}"))
8
8
  })
9
9
  %>
10
10
  </p>
@@ -4,7 +4,7 @@
4
4
  <%=
5
5
  t(".new_reply_html", {
6
6
  commenter: @reply.author.name,
7
- commentable_link: link_to(commentable_title, decidim_resource_url(@commentable))
7
+ commentable_link: link_to(commentable_title, @locator.url(anchor: "comment_#{@reply.id}"))
8
8
  })
9
9
  %>
10
10
  </p>
@@ -19,6 +19,9 @@ ca:
19
19
  subject: Tens un nou comentari
20
20
  reply_created:
21
21
  subject: Tens una nova resposta del teu comentari
22
+ votes:
23
+ create:
24
+ error: Hi ha hagut errors en votar el comentari.
22
25
  components:
23
26
  add_comment_form:
24
27
  account_message: "<a href=\"%{sign_in_url}\">Entra amb el teu compte</a> o <a href=\"%{sign_up_url}\">registra't</a> per a deixar un comentari.\n"
@@ -37,6 +40,7 @@ ca:
37
40
  alignment:
38
41
  against: En contra
39
42
  in_favor: A favor
43
+ deleted_user: Usuari eliminat
40
44
  reply: Respondre
41
45
  report:
42
46
  action: Denuncia
@@ -49,6 +53,7 @@ ca:
49
53
  offensive: Conté racisme, sexisme, insults, atacs personals, amenaces de mort, peticions de suïcidi o qualsevol forma de discurs d'odi.
50
54
  spam: Conté "clickbait", publicitat o estafes.
51
55
  title: Denuncia un problema
56
+ verified_user_group: Organització verificada
52
57
  comment_order_selector:
53
58
  order:
54
59
  best_rated: Més ben valorats
@@ -20,6 +20,9 @@ en:
20
20
  subject: You have a new comment
21
21
  reply_created:
22
22
  subject: You have a new reply of your comment
23
+ votes:
24
+ create:
25
+ error: There's been errors when voting the comment.
23
26
  components:
24
27
  add_comment_form:
25
28
  account_message: '<a href="%{sign_in_url}">Sign in with your account</a> or <a href="%{sign_up_url}">sign up</a> to add your comment. '
@@ -38,6 +41,7 @@ en:
38
41
  alignment:
39
42
  against: Against
40
43
  in_favor: In favor
44
+ deleted_user: Deleted user
41
45
  reply: Reply
42
46
  report:
43
47
  action: Report
@@ -50,6 +54,7 @@ en:
50
54
  offensive: Contains racism, sexism, slurs, personal attacks, death threats, suicide requests or any form of hate speech.
51
55
  spam: Contains clickbait, advertising, scams or script bots.
52
56
  title: Report a problem
57
+ verified_user_group: Verified organization
53
58
  comment_order_selector:
54
59
  order:
55
60
  best_rated: Best rated
@@ -19,6 +19,9 @@ es:
19
19
  subject: Tienes un nuevo comentario
20
20
  reply_created:
21
21
  subject: Uno de tus comentarios ha recibido respuesta
22
+ votes:
23
+ create:
24
+ error: Ha habido errores al votar el comentario.
22
25
  components:
23
26
  add_comment_form:
24
27
  account_message: "<a href=\"%{sign_in_url}\">Entra con tu cuenta</a> o <a href=\"%{sign_up_url}\">regístrate</a> para dejar tu comentario.\n"
@@ -37,6 +40,7 @@ es:
37
40
  alignment:
38
41
  against: En contra
39
42
  in_favor: A favor
43
+ deleted_user: Usuario eliminado
40
44
  reply: Respuesta
41
45
  report:
42
46
  action: Denunciar
@@ -49,6 +53,7 @@ es:
49
53
  offensive: Contiene racismo, sexismo, insultos, ataques personales, amenazas de muerte, solicitudes de suicidio o cualquier forma de discurso de odio.
50
54
  spam: Contiene clickbait, publicidad o estafas.
51
55
  title: Denunciar un problema
56
+ verified_user_group: Organización verificada
52
57
  comment_order_selector:
53
58
  order:
54
59
  best_rated: Mejor valoración
@@ -0,0 +1,65 @@
1
+ it:
2
+ activerecord:
3
+ errors:
4
+ messages:
5
+ cannot_have_comments: non si possono fare commenti
6
+ decidim:
7
+ comments:
8
+ comment_notification_mailer:
9
+ comment_created:
10
+ new_comment_html: C'è un nuovo commento da parte di <b>%{commenter}</b> al link <b>%{commentable_link}</b>
11
+ hello: Ciao %{name},
12
+ manage_email_subscriptions_html: Puoi bloccare la ricezione di questo tipo di email variando le impostazioni su %{link}.
13
+ notifications_settings_link: pagina per le impostazioni delle notifiche
14
+ reply_created:
15
+ new_reply_html: C'è una nuova risposta al tuo commento da parte di <b>%{commenter}</b> in <b>%{commentable_link}</b>
16
+ mailer:
17
+ comment_notification:
18
+ comment_created:
19
+ subject: C'è un nuovo commento
20
+ reply_created:
21
+ subject: Hai ricevuto una nuova risposta ad un tuo commento
22
+ components:
23
+ add_comment_form:
24
+ account_message: '<a href="%{sign_in_url}">Entra col tuo account</a> or <a href="%{sign_up_url}">Registrati</a> per poter commentare. '
25
+ form:
26
+ body:
27
+ label: Commenta
28
+ placeholder: Cosa ne pensi?
29
+ form_error: Il testo è necessario, deve essere obbligatoriamente indicato (max %{length} caratteri).
30
+ submit: Invia
31
+ user_group_id:
32
+ label: Commenta come
33
+ opinion:
34
+ neutral: Neutro
35
+ title: Aggiungi il tuo commento
36
+ comment:
37
+ alignment:
38
+ against: Contro
39
+ in_favor: A favore
40
+ reply: Rispondi
41
+ report:
42
+ already_reported: Questo contenuto è già stato indicato e sarà revisionato da un utente Admnistrator.
43
+ close: Chiudi
44
+ description: Trovi questo contenuto inappropriato?
45
+ details: motivazione
46
+ reasons:
47
+ does_not_belong: Contiene un'attività illegale, istigazioni al suicidio, minacce, informazioni personali o riservate, oppure vi sono dei contenuti che reputi inappropriati per %{organization_name}.
48
+ offensive: Vi sono contenuti razzisti, sessisti, offensivi, attacchi di carattere personale, minacce di morte o altro tipo di minacci, istigazioni al suicidio o altre forme d'odio verbale.
49
+ spam: Contiene pubblicità, truffe, clickbait ("esca da click") o altro contenuto mirato ad attrarre traffico internet.
50
+ title: Segnala un problema
51
+ comment_order_selector:
52
+ order:
53
+ best_rated: Favoriti
54
+ most_discussed: Più discussi
55
+ older: Più vecchi
56
+ recent: Più recenti
57
+ title: 'Ordina per:'
58
+ comment_thread:
59
+ title: Conversazioni con %{authorName}
60
+ comments:
61
+ blocked_comments_warning: I commenti sono disabilitati per questa fase, ma puoi leggere i commenti delle fasi precedenti.
62
+ loading: Sto caricando i commenti ...
63
+ title: "%{count} commenti"
64
+ featured_comment:
65
+ title: Commento in primo piano
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class CreateComments < ActiveRecord::Migration[5.0]
2
4
  def change
3
5
  create_table :decidim_comments_comments do |t|
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class AddDepthToComments < ActiveRecord::Migration[5.0]
2
4
  def change
3
5
  add_column :decidim_comments_comments, :depth, :integer, null: false, default: 0
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class AddAlignmentToComments < ActiveRecord::Migration[5.0]
2
4
  def change
3
5
  add_column :decidim_comments_comments, :alignment, :integer, null: false, default: 0
@@ -1,10 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class CreateCommentVotes < ActiveRecord::Migration[5.0]
2
4
  def change
3
5
  create_table :decidim_comments_comment_votes do |t|
4
6
  t.integer :weight, null: false
5
7
  t.references :decidim_comment, null: false, index: { name: "decidim_comments_comment_vote_comment" }
6
8
  t.references :decidim_author, null: false, index: { name: "decidim_comments_comment_vote_author" }
7
-
9
+
8
10
  t.timestamps
9
11
  end
10
12
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class AddUserGroupIdToComments < ActiveRecord::Migration[5.0]
2
4
  def change
3
5
  add_column :decidim_comments_comments, :decidim_user_group_id, :integer, index: true
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class AddRootCommentableToComments < ActiveRecord::Migration[5.0]
2
4
  def change
3
5
  change_table :decidim_comments_comments do |t|
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class UpdateRootCommentableForComments < ActiveRecord::Migration[5.0]
2
4
  def up
3
5
  Decidim::Comments::Comment.where(depth: 0).update_all(
@@ -10,8 +12,7 @@ class UpdateRootCommentableForComments < ActiveRecord::Migration[5.0]
10
12
  end
11
13
  end
12
14
 
13
- def down
14
- end
15
+ def down; end
15
16
 
16
17
  private
17
18
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class SetRootCommentableNullConstraints < ActiveRecord::Migration[5.0]
2
4
  def change
3
5
  change_column_null(:decidim_comments_comments, :decidim_root_commentable_id, false)
@@ -30,7 +30,7 @@ module Decidim
30
30
  private
31
31
 
32
32
  def root_commentable_url
33
- @root_commentable_url ||= decidim_resource_url(resource.root_commentable)
33
+ @root_commentable_url ||= Decidim::ResourceLocatorPresenter.new(resource.root_commentable).url
34
34
  end
35
35
  end
36
36
  end
@@ -11,23 +11,23 @@ module Decidim
11
11
  included do
12
12
  has_many :comments, as: :commentable, foreign_key: "decidim_commentable_id", foreign_type: "decidim_commentable_type", class_name: "Decidim::Comments::Comment"
13
13
 
14
- # Public: Wether the object's comments are visible or not.
14
+ # Public: Whether the object's comments are visible or not.
15
15
  def commentable?
16
16
  true
17
17
  end
18
18
 
19
- # Public: Wether the object can have new comments or not.
19
+ # Public: Whether the object can have new comments or not.
20
20
  def accepts_new_comments?
21
21
  true
22
22
  end
23
23
 
24
- # Public: Wether the object's comments can have alignment or not. It enables the
24
+ # Public: Whether the object's comments can have alignment or not. It enables the
25
25
  # alignment selector in the add new comment form.
26
26
  def comments_have_alignment?
27
27
  false
28
28
  end
29
29
 
30
- # Public: Wether the object's comments can have have votes or not. It enables the
30
+ # Public: Whether the object's comments can have have votes or not. It enables the
31
31
  # upvote and downvote buttons for comments.
32
32
  def comments_have_votes?
33
33
  false
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.2.0
4
+ version: 0.3.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-06-02 00:00:00.000000000 Z
13
+ date: 2017-06-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: decidim-core
@@ -18,28 +18,28 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 0.2.0
21
+ version: 0.3.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.2.0
28
+ version: 0.3.0
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: rails
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
33
  - - "~>"
34
34
  - !ruby/object:Gem::Version
35
- version: 5.0.2
35
+ version: 5.1.1
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - "~>"
41
41
  - !ruby/object:Gem::Version
42
- version: 5.0.2
42
+ version: 5.1.1
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: jquery-rails
45
45
  requirement: !ruby/object:Gem::Requirement
@@ -60,14 +60,14 @@ dependencies:
60
60
  requirements:
61
61
  - - '='
62
62
  - !ruby/object:Gem::Version
63
- version: 0.2.0
63
+ version: 0.3.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.2.0
70
+ version: 0.3.0
71
71
  description: Pluggable comments system for some components.
72
72
  email:
73
73
  - josepjaume@gmail.com
@@ -149,6 +149,7 @@ files:
149
149
  - config/locales/eu.yml
150
150
  - config/locales/fi.yml
151
151
  - config/locales/fr.yml
152
+ - config/locales/it.yml
152
153
  - config/locales/nl.yml
153
154
  - db/migrate/20161130143508_create_comments.rb
154
155
  - db/migrate/20161214082645_add_depth_to_comments.rb