decidim-comments 0.23.1 → 0.24.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/decidim/comments/bundle.js.map +1 -1
  3. data/app/assets/javascripts/decidim/comments/comments.component.js.es6 +292 -0
  4. data/app/assets/javascripts/decidim/comments/comments.component.test.js +581 -0
  5. data/app/assets/javascripts/decidim/comments/comments.js.erb +1 -1
  6. data/app/cells/decidim/comments/comment/actions.erb +7 -0
  7. data/app/cells/decidim/comments/comment/alignment_badge.erb +4 -0
  8. data/app/cells/decidim/comments/comment/author.erb +1 -0
  9. data/app/cells/decidim/comments/comment/show.erb +40 -0
  10. data/app/cells/decidim/comments/comment/utilities.erb +13 -0
  11. data/app/cells/decidim/comments/comment/votes.erb +25 -0
  12. data/app/cells/decidim/comments/comment_card_cell.rb +22 -0
  13. data/app/cells/decidim/comments/comment_cell.rb +142 -8
  14. data/app/cells/decidim/comments/comment_form/comment_as.erb +10 -0
  15. data/app/cells/decidim/comments/comment_form/show.erb +24 -0
  16. data/app/cells/decidim/comments/comment_form_cell.rb +94 -0
  17. data/app/cells/decidim/comments/comment_m/top.erb +1 -1
  18. data/app/cells/decidim/comments/comment_thread/show.erb +6 -0
  19. data/app/cells/decidim/comments/comment_thread/title.erb +3 -0
  20. data/app/cells/decidim/comments/comment_thread_cell.rb +30 -0
  21. data/app/cells/decidim/comments/comments/add_comment.erb +30 -0
  22. data/app/cells/decidim/comments/comments/blocked_comments_warning.erb +3 -0
  23. data/app/cells/decidim/comments/comments/order_control.erb +37 -0
  24. data/app/cells/decidim/comments/comments/show.erb +32 -0
  25. data/app/cells/decidim/comments/comments/single_comment_warning.erb +9 -0
  26. data/app/cells/decidim/comments/comments/user_comments_blocked_warning.erb +3 -0
  27. data/app/cells/decidim/comments/comments_cell.rb +134 -0
  28. data/app/commands/decidim/comments/vote_comment.rb +34 -10
  29. data/app/controllers/decidim/comments/application_controller.rb +16 -0
  30. data/app/controllers/decidim/comments/comments_controller.rb +122 -0
  31. data/app/controllers/decidim/comments/votes_controller.rb +41 -0
  32. data/app/events/decidim/comments/comment_created_event.rb +1 -1
  33. data/app/events/decidim/comments/comment_downvoted_event.rb +8 -0
  34. data/app/events/decidim/comments/comment_event.rb +0 -15
  35. data/app/events/decidim/comments/comment_upvoted_event.rb +8 -0
  36. data/app/events/decidim/comments/comment_voted_event.rb +26 -0
  37. data/app/forms/decidim/comments/comment_form.rb +6 -2
  38. data/app/models/decidim/comments/comment.rb +33 -11
  39. data/app/models/decidim/comments/seed.rb +1 -1
  40. data/app/permissions/decidim/comments/permissions.rb +59 -0
  41. data/app/queries/decidim/comments/metrics/comment_participants_metric_measure.rb +2 -2
  42. data/app/queries/decidim/comments/metrics/comments_metric_manage.rb +5 -6
  43. data/app/queries/decidim/comments/sorted_comments.rb +18 -14
  44. data/app/views/decidim/comments/comments/_comment.html.erb +5 -0
  45. data/app/views/decidim/comments/comments/_comments.html.erb +1 -0
  46. data/app/views/decidim/comments/comments/create.js.erb +16 -0
  47. data/app/views/decidim/comments/comments/error.js.erb +1 -0
  48. data/app/views/decidim/comments/comments/index.js.erb +24 -0
  49. data/app/views/decidim/comments/comments/reload.js.erb +21 -0
  50. data/app/views/decidim/comments/votes/create.js.erb +23 -0
  51. data/app/views/decidim/comments/votes/error.js.erb +1 -0
  52. data/config/locales/ar.yml +0 -2
  53. data/config/locales/ca.yml +17 -2
  54. data/config/locales/cs.yml +20 -3
  55. data/config/locales/de.yml +46 -30
  56. data/config/locales/el.yml +0 -2
  57. data/config/locales/en.yml +17 -2
  58. data/config/locales/es-MX.yml +17 -2
  59. data/config/locales/es-PY.yml +17 -2
  60. data/config/locales/es.yml +17 -2
  61. data/config/locales/eu.yml +0 -2
  62. data/config/locales/fi-plain.yml +17 -2
  63. data/config/locales/fi.yml +17 -2
  64. data/config/locales/fr-CA.yml +17 -2
  65. data/config/locales/fr.yml +17 -2
  66. data/config/locales/gl.yml +20 -2
  67. data/config/locales/hu.yml +0 -2
  68. data/config/locales/id-ID.yml +0 -2
  69. data/config/locales/is-IS.yml +0 -1
  70. data/config/locales/it.yml +5 -2
  71. data/config/locales/ja.yml +14 -10
  72. data/config/locales/lv.yml +0 -2
  73. data/config/locales/nl.yml +7 -9
  74. data/config/locales/no.yml +0 -2
  75. data/config/locales/pl.yml +22 -4
  76. data/config/locales/pt-BR.yml +0 -2
  77. data/config/locales/pt.yml +0 -2
  78. data/config/locales/ro-RO.yml +0 -2
  79. data/config/locales/ru.yml +0 -2
  80. data/config/locales/si-LK.yml +1 -0
  81. data/config/locales/sk.yml +0 -2
  82. data/config/locales/sv.yml +7 -2
  83. data/config/locales/sw-KE.yml +1 -0
  84. data/config/locales/tr-TR.yml +60 -35
  85. data/config/locales/uk.yml +0 -1
  86. data/config/locales/zh-CN.yml +0 -2
  87. data/lib/decidim/api/add_comment_type.rb +13 -0
  88. data/lib/decidim/api/comment_mutation_type.rb +22 -0
  89. data/lib/decidim/api/comment_type.rb +89 -0
  90. data/lib/decidim/api/commentable_interface.rb +50 -0
  91. data/lib/decidim/api/commentable_mutation_type.rb +30 -0
  92. data/{app/types/decidim/comments → lib/decidim/api}/commentable_type.rb +2 -5
  93. data/lib/decidim/comments.rb +1 -3
  94. data/lib/decidim/comments/api.rb +12 -0
  95. data/lib/decidim/comments/comments_helper.rb +10 -52
  96. data/lib/decidim/comments/engine.rb +9 -7
  97. data/lib/decidim/comments/mutation_extensions.rb +22 -22
  98. data/lib/decidim/comments/query_extensions.rb +12 -14
  99. data/lib/decidim/comments/test.rb +1 -0
  100. data/lib/decidim/comments/test/shared_examples/comment_voted_event.rb +65 -0
  101. data/lib/decidim/comments/version.rb +1 -1
  102. metadata +72 -69
  103. data/app/assets/javascripts/decidim/comments/bundle.js +0 -268
  104. data/app/frontend/application/apollo_client.ts +0 -12
  105. data/app/frontend/application/application.component.test.tsx +0 -23
  106. data/app/frontend/application/application.component.tsx +0 -35
  107. data/app/frontend/application/icon.component.test.tsx +0 -38
  108. data/app/frontend/application/icon.component.tsx +0 -46
  109. data/app/frontend/comments/add_comment_form.component.test.tsx +0 -265
  110. data/app/frontend/comments/add_comment_form.component.tsx +0 -482
  111. data/app/frontend/comments/comment.component.test.tsx +0 -490
  112. data/app/frontend/comments/comment.component.tsx +0 -677
  113. data/app/frontend/comments/comment_order_selector.component.test.tsx +0 -29
  114. data/app/frontend/comments/comment_order_selector.component.tsx +0 -106
  115. data/app/frontend/comments/comment_thread.component.test.tsx +0 -82
  116. data/app/frontend/comments/comment_thread.component.tsx +0 -81
  117. data/app/frontend/comments/comments.component.test.tsx +0 -150
  118. data/app/frontend/comments/comments.component.tsx +0 -289
  119. data/app/frontend/comments/down_vote_button.component.test.tsx +0 -59
  120. data/app/frontend/comments/down_vote_button.component.tsx +0 -133
  121. data/app/frontend/comments/up_vote_button.component.test.tsx +0 -59
  122. data/app/frontend/comments/up_vote_button.component.tsx +0 -133
  123. data/app/frontend/comments/vote_button.component.tsx +0 -50
  124. data/app/frontend/comments/vote_button_component.test.tsx +0 -64
  125. data/app/frontend/entry.ts +0 -38
  126. data/app/frontend/entry_test.ts +0 -6
  127. data/app/frontend/fragments/add_comment_form_commentable.fragment.graphql +0 -4
  128. data/app/frontend/fragments/add_comment_form_session.fragment.graphql +0 -6
  129. data/app/frontend/fragments/comment.fragment.graphql +0 -14
  130. data/app/frontend/fragments/comment_data.fragment.graphql +0 -27
  131. data/app/frontend/fragments/comment_thread.fragment.graphql +0 -6
  132. data/app/frontend/fragments/down_vote_button.fragment.graphql +0 -6
  133. data/app/frontend/fragments/up_vote_button.fragment.graphql +0 -6
  134. data/app/frontend/mutations/add_comment.mutation.graphql +0 -9
  135. data/app/frontend/mutations/down_vote.mutation.graphql +0 -9
  136. data/app/frontend/mutations/up_vote.mutation.graphql +0 -9
  137. data/app/frontend/queries/comments.query.graphql +0 -26
  138. data/app/frontend/support/asset_url.ts +0 -11
  139. data/app/frontend/support/generate_comments_data.ts +0 -49
  140. data/app/frontend/support/generate_user_data.ts +0 -14
  141. data/app/frontend/support/generate_user_group_data.ts +0 -14
  142. data/app/frontend/support/graphql_transformer.js +0 -32
  143. data/app/frontend/support/load_translations.ts +0 -48
  144. data/app/frontend/support/require_all.ts +0 -10
  145. data/app/frontend/support/resolve_graphql_query.ts +0 -37
  146. data/app/frontend/support/schema.ts +0 -2026
  147. data/app/types/decidim/comments/commentable_interface.rb +0 -61
  148. data/app/types/decidim/comments/commentable_mutation_type.rb +0 -33
  149. data/lib/decidim/comments/api/add_comment_type.rb +0 -13
  150. data/lib/decidim/comments/api/comment_mutation_type.rb +0 -20
  151. data/lib/decidim/comments/api/comment_type.rb +0 -89
@@ -16,7 +16,6 @@ pt:
16
16
  other: Votos
17
17
  decidim:
18
18
  comments:
19
- comments: Comentários
20
19
  last_activity:
21
20
  new_comment_at_html: "<span>Novo comentário em %{link}</span>"
22
21
  votes:
@@ -67,7 +66,6 @@ pt:
67
66
  blocked_comments_for_user_warning: Você não pode comentar neste momento, mas pode ler os anteriores.
68
67
  blocked_comments_warning: Os comentários estão desativados neste momento, mas você pode ler os anteriores.
69
68
  loading: Carregando comentários ...
70
- title: "%{count} comentários"
71
69
  events:
72
70
  comments:
73
71
  comment_by_followed_user:
@@ -16,7 +16,6 @@ pt:
16
16
  other: Votos
17
17
  decidim:
18
18
  comments:
19
- comments: Comentários
20
19
  comments_count: Contagem de comentários
21
20
  last_activity:
22
21
  new_comment_at_html: "<span>Novo comentário em %{link}</span>"
@@ -75,7 +74,6 @@ pt:
75
74
  loading: A carregar comentários ...
76
75
  single_comment_warning: Pode consultar os restantes comentários <a href="%{url}">aqui</a>.
77
76
  single_comment_warning_title: Está a ver um único comentário
78
- title: "%{count} comentários"
79
77
  down_vote_button:
80
78
  text: Eu discordo deste comentário
81
79
  up_vote_button:
@@ -18,7 +18,6 @@ ro:
18
18
  other: Voturi
19
19
  decidim:
20
20
  comments:
21
- comments: Comentarii
22
21
  comments_count: Numărul de comentarii
23
22
  last_activity:
24
23
  new_comment_at_html: "<span>Comentariu nou la %{link}</span>"
@@ -77,7 +76,6 @@ ro:
77
76
  loading: Se încarcă comentariile...
78
77
  single_comment_warning: Puteţi verifica restul comentariilor <a href="%{url}">aici</a>.
79
78
  single_comment_warning_title: Vedeți un singur comentariu
80
- title: "%{count} comentarii"
81
79
  down_vote_button:
82
80
  text: Nu sunt de acord cu acest comentariu
83
81
  up_vote_button:
@@ -20,7 +20,6 @@ ru:
20
20
  other: Голосов
21
21
  decidim:
22
22
  comments:
23
- comments: Комментарии
24
23
  last_activity:
25
24
  new_comment_at_html: "<span>Новый комментарий в %{link}</span>"
26
25
  votes:
@@ -71,7 +70,6 @@ ru:
71
70
  blocked_comments_for_user_warning: Сейчас вам недоступно комментирование, но вы можете прочесть предыдущие комментарии.
72
71
  blocked_comments_warning: Комментарии сейчас отключены, но вы можете прочитать предыдущие.
73
72
  loading: Загрузка комментариев ...
74
- title: "%{count} комментариев"
75
73
  events:
76
74
  comments:
77
75
  comment_by_followed_user:
@@ -0,0 +1 @@
1
+ si:
@@ -20,7 +20,6 @@ sk:
20
20
  other: Hlasy
21
21
  decidim:
22
22
  comments:
23
- comments: Komentáre
24
23
  last_activity:
25
24
  new_comment_at_html: "<span>Nový komentár na %{link}</span>"
26
25
  votes:
@@ -77,7 +76,6 @@ sk:
77
76
  loading: Nahrávanie komentárov...
78
77
  single_comment_warning: Zvyšné komentáre zobrazíte <a href="%{url}">tu</a>.
79
78
  single_comment_warning_title: Zobrazujete jeden komentár
80
- title: "%{count} komentárov"
81
79
  events:
82
80
  comments:
83
81
  comment_by_followed_user:
@@ -16,8 +16,11 @@ sv:
16
16
  other: Röster
17
17
  decidim:
18
18
  comments:
19
- comments: Kommentarer
19
+ comments:
20
+ create:
21
+ error: Det gick inte att skapa kommentaren.
20
22
  comments_count: Antal kommentarer
23
+ comments_title: Kommentarer
21
24
  last_activity:
22
25
  new_comment_at_html: "<span>Ny kommentar på %{link}</span>"
23
26
  view: Visa
@@ -76,7 +79,9 @@ sv:
76
79
  loading: Laddar kommentarer...
77
80
  single_comment_warning: Läs återstående <a href="%{url}">kommentarer</a>.
78
81
  single_comment_warning_title: Du visar en enda kommentar
79
- title: "%{count} kommentarer"
82
+ title:
83
+ one: "%{count} kommentarer"
84
+ other: "%{count} kommentarer"
80
85
  down_vote_button:
81
86
  text: Jag håller inte med om denna kommentar
82
87
  up_vote_button:
@@ -0,0 +1 @@
1
+ sw:
@@ -1,49 +1,55 @@
1
1
  tr:
2
2
  activemodel:
3
3
  models:
4
- decidim/comments/comment_by_followed_user_event: Yorum Yap
5
- decidim/comments/comment_created_event: Yorum Yap
4
+ decidim/comments/comment_by_followed_user_event: Yorum
5
+ decidim/comments/comment_created_event: Yorum
6
6
  decidim/comments/reply_created_event: Yorum cevabı
7
- decidim/comments/user_group_mentioned_event: Anma
8
- decidim/comments/user_mentioned_event: Anma
7
+ decidim/comments/user_group_mentioned_event: Bahset
8
+ decidim/comments/user_mentioned_event: Bahset
9
9
  activerecord:
10
10
  models:
11
11
  decidim/comments/comment:
12
- one: Yorum Yap
12
+ one: Yorum
13
13
  other: Yorumlar
14
14
  decidim/comments/comment_vote:
15
- one: Oy
15
+ one: Oy ver
16
16
  other: oy
17
17
  decidim:
18
18
  comments:
19
- comments: Yorumlar
19
+ comments:
20
+ create:
21
+ error: Yorum oluşturulurken bir sorunla karşılaşıldı.
22
+ comments_count: Yorum sayısı
23
+ comments_title: Yorumlar
20
24
  last_activity:
21
- new_comment_at_html: "<span> %{link}</span>yeni yorum"
25
+ new_comment_at_html: "<span> %{link}</span> yeni yorum"
26
+ view: Görünüm
22
27
  votes:
23
28
  create:
24
29
  error: Yorum oylanırken bir sorun oluştu.
25
30
  components:
26
31
  add_comment_form:
27
- account_message: <a href="%{sign_in_url}">Yorumunuzu eklemek için</a> veya <a href="%{sign_up_url}">hesabınızla giriş yapın</a>.
32
+ account_message: Yorumunuzu eklemek için <a href="%{sign_in_url}"> hesabınızla oturum açın </a> veya <a href="%{sign_up_url}"> kaydolun </a>.
28
33
  form:
29
34
  body:
30
- label: Yorum Yap
35
+ label: Yorum
31
36
  placeholder: Bunun hakkında ne düşünüyorsun?
32
- form_error: Metin gereklidir ve %{length} karakterden uzun olamaz.
33
- submit: göndermek
37
+ form_error: Metin zorunludur ve %{length} karakterden uzun olamaz.
38
+ submit: Gönder
34
39
  user_group_id:
35
40
  label: Olarak yorum yap
36
41
  opinion:
37
- neutral: nötr
42
+ neutral: Tarafsız
38
43
  remaining_characters: "%{count} karakter kaldı"
39
44
  remaining_characters_1: "%{count} karakter kaldı"
40
- title: yorumunu ekle
45
+ title: Yorum Ekle
41
46
  comment:
42
47
  alignment:
43
48
  against: Karşısında
44
49
  in_favor: Lehine
45
50
  deleted_user: Silinmiş katılımcı
46
- reply: cevap
51
+ hide_replies: Yanıtları gizle
52
+ reply: Cevapla
47
53
  report:
48
54
  action: Rapor
49
55
  already_reported: Bu içerik zaten bildirildi ve bir yönetici tarafından incelenecek.
@@ -51,9 +57,12 @@ tr:
51
57
  description: Bu içerik uygunsuz mu?
52
58
  details: Ek Yorumlar
53
59
  reasons:
54
- does_not_belong: Yasadışı faaliyet, intihar tehditleri, kişisel bilgiler veya %{organization_name}ait olmadığını düşündüğünüz başka bir şey içerir.
60
+ does_not_belong: Yasadışı faaliyet, intihar tehditleri, kişisel bilgiler veya %{organization_name} kuruluşuna ait olmadığını düşündüğünüz başka bir şey içeriyor.
55
61
  offensive: Irkçılık, cinsiyetçilik, hakaretler, kişisel saldırılar, ölüm tehditleri, intihar talepleri veya herhangi bir nefret söylemi içerir.
56
62
  spam: Clickbait, reklam, dolandırıcılık veya script botları içerir.
63
+ title: Uygunsuz içerik bildir
64
+ show_replies: '%{replies_count} yanıtı göster'
65
+ single_comment_link_title: Tek yorumun bağlantısını al
57
66
  comment_order_selector:
58
67
  order:
59
68
  best_rated: En çok oy alan
@@ -66,33 +75,49 @@ tr:
66
75
  comments:
67
76
  blocked_comments_for_user_warning: Şu anda yorum yapamıyorsunuz, ancak öncekileri okuyabilirsiniz.
68
77
  blocked_comments_warning: Yorumlar şu anda devre dışı, ancak öncekileri okuyabilirsiniz.
78
+ comment_details_title: Yorum ayrıntıları
69
79
  loading: Yorumlar yükleniyor ...
70
- title: "%{count} yorum"
80
+ single_comment_warning: Yorumların geri kalanını <a href="%{url}"> buradan </a> kontrol edebilirsiniz.
81
+ single_comment_warning_title: Tek bir yorum görüyorsunuz
82
+ title:
83
+ one: "%{count} yorum"
84
+ other: "%{count} yorum"
85
+ down_vote_button:
86
+ text: Bu yoruma katılmıyorum
87
+ up_vote_button:
88
+ text: Bu yoruma katılıyorum
71
89
  events:
72
90
  comments:
73
91
  comment_by_followed_user:
74
- email_intro: "%{author_name} , %{resource_title}yorum yaptı. Bu sayfada okuyabilirsiniz:"
75
- email_outro: '%{author_name}takip ettiğiniz için bu bildirimi aldınız. Bu kullanıcıyı profil sayfasından takip edebilirsiniz.'
76
- email_subject: '%{author_name} %{resource_title}tarafından yeni bir yorum var'
77
- notification_title: <a href="%{author_path}">%{author_name} %{author_nickname}</a> tarafından <a href="%{resource_path}">%{resource_title}</a>yeni bir yorum var.
92
+ email_intro: "%{author_name} grubu %{resource_title} alanında bir yorum bıraktı. Bu sayfada okuyabilirsiniz:"
93
+ email_outro: Bu bildirimi %{author_name} adlı yazarı takip ettiğiniz için aldınız. Bu grubu profil sayfasından takip etmeyi bırakabilirsiniz.
94
+ email_subject: '%{author_name} %{resource_title} alanında yeni bir yorum yaptı'
95
+ notification_title: <a href="%{resource_path}">%{resource_title} </a> içinde <a href="%{author_path}">%{author_name} %{author_nickname} </a> tarafından yeni bir yorum var.
78
96
  comment_by_followed_user_group:
79
- email_subject: '%{author_name} %{resource_title}tarafından yeni bir yorum var'
80
- notification_title: <a href="%{author_path}">%{author_name} %{author_nickname}</a> tarafından <a href="%{resource_path}">%{resource_title}</a>yeni bir yorum var.
97
+ email_intro: '%{author_name} grubu %{resource_title} alanında bir yorum bıraktı. Bu sayfada okuyabilirsiniz:'
98
+ email_outro: Bu bildirimi %{author_name} adlı yazarı takip ettiğiniz için aldınız. Bu grubu profil sayfasından takip etmeyi bırakabilirsiniz.
99
+ email_subject: '%{author_name}, %{resource_title} alanında yeni bir yorum yaptı'
100
+ notification_title: <a href="%{resource_path}">%{resource_title} </a> içinde <a href="%{author_path}">%{author_name} %{author_nickname} </a> tarafından yeni bir yorum var.
81
101
  comment_created:
82
- email_intro: "%{resource_title} yorum yapıldı. Bu sayfadaki yorumu okuyabilirsiniz:"
83
- email_outro: '"%{resource_title}" veya yazarı takip ettiğiniz için bu bildirimi aldınız. Bunu önceki linkten takip edebilirsiniz.'
84
- email_subject: '%{author_name} %{resource_title}yeni bir yorum var'
85
- notification_title: <a href="%{author_path}">%{author_name} %{author_nickname}</a> <a href="%{resource_path}">%{resource_title}</a>yeni bir yorum var
102
+ email_intro: "%{resource_title} alanında yorum yapıldı. Bu sayfadaki yorumu okuyabilirsiniz:"
103
+ email_outro: '"%{resource_title}" alanında veya yazarı takip ettiğiniz için bu bildirimi aldınız. Bunu önceki linkten takip edebilirsiniz.'
104
+ email_subject: '%{author_name}, %{resource_title} alanında yeni bir yorum yaptı'
105
+ notification_title: <a href="%{resource_path}">%{resource_title} </a> içinde <a href="%{author_path}">%{author_name} %{author_nickname} </a> tarafından yeni bir yorum var
86
106
  reply_created:
87
- email_intro: "%{author_name} , yorumunuzu %{resource_title}yanıtladı. Bu sayfada okuyabilirsiniz:"
107
+ email_intro: "%{author_name}, yorumunuzu %{resource_title} alanında yanıtladı. Bu sayfada okuyabilirsiniz:"
88
108
  email_outro: Yorumunuz yanıtlandığı için bu bildirimi aldınız.
89
- email_subject: "%{author_name} Yorumunuzu %{resource_title}yanıtladı."
90
- notification_title: <a href="%{author_path}">%{author_name} %{author_nickname}</a> <a href="%{resource_path}">%{resource_title}</a>yorumunuzu yanıtladı.
109
+ email_subject: "%{author_name}, yorumunuzu %{resource_title} alanında yanıtladı"
110
+ notification_title: <a href="%{author_path}">%{author_name} %{author_nickname}</a> <a href="%{resource_path}">%{resource_title}</a> alanında yorumunuzu yanıtladı
111
+ user_group_mentioned:
112
+ email_intro: Ait olduğunuz bir gruptan bahsedildi
113
+ email_outro: Bu bildirimi, %{resource_title} içinde adı geçen %{group_name} grubunun bir üyesi olduğunuz için aldınız.
114
+ email_subject: '%{resource_title} içinde %{group_name} üyesi olarak bahsedildiniz'
115
+ notification_title: <a href="%{resource_path}">%{resource_title} </a> ’de <a href="%{author_path}">%{author_name} %{author_nickname} </a> tarafından bir <a href="%{group_path}">%{group_name} %{group_nickname} </a> üyesi
91
116
  user_mentioned:
92
- email_intro: Sen bahsettin
93
- email_outro: Bu bildirimi, %{resource_title}belirtildiğiniz için aldınız.
94
- email_subject: '%{resource_title}bahsettiniz'
95
- notification_title: <a href="%{resource_path}">%{resource_title}</a> tarafından <a href="%{author_path}">%{author_name} %{author_nickname}</a>
117
+ email_intro: Sen bahsedildin
118
+ email_outro: Bu bildirimi, sizden %{resource_title} alanında bahsedildiği için aldınız.
119
+ email_subject: '%{resource_title} alanında bahsedildiniz'
120
+ notification_title: <a href="%{resource_path}">%{resource_title} </a> alanında <a href="%{author_path}">%{author_name} %{author_nickname} </a> tarafından bahsedildi
96
121
  metrics:
97
122
  comments:
98
123
  description: Katılımcılar tarafından oluşturulan yorum sayısı
@@ -100,4 +125,4 @@ tr:
100
125
  title: Yorumlar
101
126
  errors:
102
127
  messages:
103
- cannot_have_comments: yorum yapamam
128
+ cannot_have_comments: yorum alamaz
@@ -67,7 +67,6 @@ uk:
67
67
  comments:
68
68
  blocked_comments_warning: Коментарі зараз вимкнені, але ви можете прочитати попередні.
69
69
  loading: Завантаження коментарів...
70
- title: "%{count} коментарів"
71
70
  events:
72
71
  comments:
73
72
  comment_by_followed_user:
@@ -14,7 +14,6 @@ zh-CN:
14
14
  other: 所得票数
15
15
  decidim:
16
16
  comments:
17
- comments: 评论
18
17
  comments_count: 评论计数
19
18
  last_activity:
20
19
  new_comment_at_html: "<span>在 %{link}的新评论</span>"
@@ -74,7 +73,6 @@ zh-CN:
74
73
  loading: 正在加载评论...
75
74
  single_comment_warning: 您可以在这里查看 <a href="%{url}">的其余评论</a>。
76
75
  single_comment_warning_title: 您正在看到一个评论
77
- title: "%{count} 条评论"
78
76
  down_vote_button:
79
77
  text: 我不同意这个评论
80
78
  up_vote_button:
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Comments
5
+ # This type represents a mutation to create new comments.
6
+ class AddCommentType < Decidim::Api::Types::BaseObject
7
+ graphql_name "Add comment"
8
+ description "Add a new comment"
9
+
10
+ field :comment, Decidim::Comments::CommentType, null: true, description: "The new created comment"
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Comments
5
+ class CommentMutationType < Decidim::Api::Types::BaseObject
6
+ graphql_name "CommentMutation"
7
+ description "A comment which includes its available mutations"
8
+
9
+ field :id, GraphQL::Types::ID, "The Comment's unique ID", null: false
10
+
11
+ field :up_vote, Decidim::Comments::CommentType, null: true
12
+ def up_vote(args: {})
13
+ VoteCommentResolver.new(weight: 1).call(object, args, context)
14
+ end
15
+
16
+ field :down_vote, Decidim::Comments::CommentType, null: true
17
+ def down_vote(args: {})
18
+ VoteCommentResolver.new(weight: -1).call(object, args, context)
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,89 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Comments
5
+ # This type represents a comment on a commentable object.
6
+ class CommentType < Decidim::Api::Types::BaseObject
7
+ description "A comment"
8
+
9
+ implements Decidim::Comments::CommentableInterface
10
+ field :author, Decidim::Core::AuthorInterface, "The resource author", null: false
11
+
12
+ field :id, GraphQL::Types::ID, "The Comment's unique ID", null: false
13
+
14
+ field :sgid, GraphQL::Types::String, "The Comment's signed global id", null: false
15
+
16
+ field :body, GraphQL::Types::String, "The comment message", null: false
17
+
18
+ field :formatted_body, GraphQL::Types::String, "The comment message ready to display (it is expected to include HTML)", null: false
19
+
20
+ field :created_at, GraphQL::Types::String, "The creation date of the comment", null: false
21
+
22
+ field :formatted_created_at, GraphQL::Types::String, "The creation date of the comment in relative format", null: false
23
+
24
+ field :alignment, GraphQL::Types::Int, "The comment's alignment. Can be 0 (neutral), 1 (in favor) or -1 (against)'", null: true
25
+
26
+ field :up_votes, GraphQL::Types::Int, "The number of comment's upVotes", null: false
27
+
28
+ field :up_voted, GraphQL::Types::Boolean, "Check if the current user has upvoted the comment", null: false
29
+
30
+ field :down_votes, GraphQL::Types::Int, "The number of comment's downVotes", null: false
31
+
32
+ field :down_voted, GraphQL::Types::Boolean, "Check if the current user has downvoted the comment", null: false
33
+
34
+ field :has_comments, GraphQL::Types::Boolean, "Check if the commentable has comments", method: :has_comments?, null: false
35
+
36
+ field :already_reported, GraphQL::Types::Boolean, "Check if the current user has reported the comment", null: false
37
+
38
+ field :user_allowed_to_comment, GraphQL::Types::Boolean, "Check if the current user can comment", null: false
39
+
40
+ def author
41
+ object.user_group || object.author
42
+ end
43
+
44
+ def sgid
45
+ object.to_sgid.to_s
46
+ end
47
+
48
+ def body
49
+ object.translated_body
50
+ end
51
+
52
+ def created_at
53
+ object.created_at.iso8601
54
+ end
55
+
56
+ def formatted_created_at
57
+ object.friendly_created_at
58
+ end
59
+
60
+ def up_votes
61
+ object.up_votes.size
62
+ end
63
+
64
+ def up_voted
65
+ object.up_voted_by?(context[:current_user])
66
+ end
67
+
68
+ def down_votes
69
+ object.down_votes.size
70
+ end
71
+
72
+ def down_voted
73
+ object.down_voted_by?(context[:current_user])
74
+ end
75
+
76
+ def has_comments?
77
+ object.comment_threads.size.positive?
78
+ end
79
+
80
+ def already_reported
81
+ object.reported_by?(context[:current_user])
82
+ end
83
+
84
+ def user_allowed_to_comment
85
+ object.root_commentable.commentable? && object.root_commentable.user_allowed_to_comment?(context[:current_user])
86
+ end
87
+ end
88
+ end
89
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Comments
5
+ # This interface represents a commentable object.
6
+ module CommentableInterface
7
+ include Decidim::Api::Types::BaseInterface
8
+ description "A commentable interface"
9
+
10
+ field :id, GraphQL::Types::ID, "The commentable's ID", null: false
11
+
12
+ field :type, GraphQL::Types::String, "The commentable's class name. i.e. `Decidim::ParticipatoryProcess`", method: :commentable_type, null: false
13
+
14
+ field :accepts_new_comments, GraphQL::Types::Boolean, "Whether the object can have new comments or not", method: :accepts_new_comments?, null: false
15
+
16
+ field :comments_have_alignment, GraphQL::Types::Boolean, "Whether the object comments have alignment or not", method: :comments_have_alignment?, null: false
17
+
18
+ field :comments_have_votes, GraphQL::Types::Boolean, "Whether the object comments have votes or not", method: :comments_have_votes?, null: false
19
+
20
+ field :comments, [Decidim::Comments::CommentType], null: false do
21
+ argument :order_by, GraphQL::Types::String, "Order the comments", required: false
22
+ argument :single_comment_id, GraphQL::Types::String, "ID of the single comment to look at", required: false
23
+ end
24
+
25
+ field :total_comments_count, GraphQL::Types::Int, description: "The number of comments in all levels this resource holds", null: false
26
+
27
+ def comments(order_by: nil, single_comment_id: nil)
28
+ SortedComments.for(object, order_by: order_by, id: single_comment_id)
29
+ end
30
+
31
+ def total_comments_count
32
+ object.comments_count
33
+ end
34
+
35
+ field :has_comments, GraphQL::Types::Boolean, "Check if the commentable has comments", null: false
36
+
37
+ # rubocop:disable Naming/PredicateName
38
+ def has_comments
39
+ object.comment_threads.size.positive?
40
+ end
41
+ # rubocop:enable Naming/PredicateName
42
+
43
+ field :user_allowed_to_comment, GraphQL::Types::Boolean, "Check if the current user can comment", null: false
44
+
45
+ def user_allowed_to_comment
46
+ object.commentable? && object.user_allowed_to_comment?(context[:current_user])
47
+ end
48
+ end
49
+ end
50
+ end