decidim-comments 0.5.1 → 0.6.0
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 +15 -15
- data/app/assets/javascripts/decidim/comments/bundle.js.map +1 -1
- data/app/commands/decidim/comments/create_comment.rb +13 -11
- data/app/events/decidim/comments/comment_created_event.rb +56 -0
- data/app/frontend/comments/add_comment_form.component.tsx +1 -1
- 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 +6 -13
- data/config/locales/ca.yml +18 -20
- data/config/locales/en.yml +15 -18
- data/config/locales/es.yml +20 -22
- data/config/locales/eu.yml +25 -21
- data/config/locales/fi.yml +22 -18
- data/config/locales/fr.yml +24 -20
- data/config/locales/it.yml +23 -18
- data/config/locales/nl.yml +67 -2
- data/config/locales/pl.yml +64 -0
- data/config/locales/uk.yml +70 -0
- data/lib/decidim/comments/commentable.rb +8 -1
- metadata +10 -12
- data/app/mailers/decidim/comments/comment_notification_mailer.rb +0 -44
- data/app/views/decidim/comments/comment_notification_mailer/comment_created.html.erb +0 -18
- data/app/views/decidim/comments/comment_notification_mailer/reply_created.html.erb +0 -18
- data/config/i18n-tasks.yml +0 -123
@@ -0,0 +1,70 @@
|
|
1
|
+
uk:
|
2
|
+
decidim:
|
3
|
+
comments:
|
4
|
+
events:
|
5
|
+
comment_created:
|
6
|
+
comment:
|
7
|
+
email_intro: '"%{resource_title}" прокоментували'
|
8
|
+
email_outro: Ви отримали це сповіщення, тому що ви стежите за "%{resource_title}". Ви можете припинити стежити за ним, перейшовши за наведеним вище посиланням.
|
9
|
+
email_subject: Надійшов новий коментар від %{author_name} на <a href="%{resource_url}">%{resource_title}</a>
|
10
|
+
notification_title: Надійшов новий коментар від %{author_name} на <a href="%{resource_path}">%{resource_title}</a>
|
11
|
+
reply:
|
12
|
+
email_intro: '"%{resource_title}" прокоментували'
|
13
|
+
email_outro: Ви отримали це сповіщення, тому що ви стежите за "%{resource_title}". Ви можете припинити стежити за ним, перейшовши за наведеним вище посиланням.
|
14
|
+
email_subject: Надійшла нова відповідь на ваш коментар від %{author_name} на <a href="%{resource_url}">%{resource_title}</a>
|
15
|
+
notification_title: Надійшла нова відповідь на ваш коментар від %{author_name} на <a href="%{resource_path}">%{resource_title}</a>
|
16
|
+
votes:
|
17
|
+
create:
|
18
|
+
error: При голосуванні коментаря сталися помилки.
|
19
|
+
components:
|
20
|
+
add_comment_form:
|
21
|
+
account_message: <a href="%{sign_in_url}">Увійдіть за допомогою свого облікового запису</a> або <a href="%{sign_up_url}">зареєструйтесь</a>, щоб додати свій коментар.
|
22
|
+
form:
|
23
|
+
body:
|
24
|
+
label: Коментар
|
25
|
+
placeholder: Що ви думаєте з цього приводу?
|
26
|
+
form_error: Тут обов'язково потрібно ввести текст, але не більше, ніж %{length} символів.
|
27
|
+
submit: Надіслати
|
28
|
+
user_group_id:
|
29
|
+
label: Коментувати як
|
30
|
+
opinion:
|
31
|
+
neutral: Безсторонньо
|
32
|
+
remaining_characters: "Залишилось %{count} символів"
|
33
|
+
remaining_characters_1: "Залишився %{count} символ"
|
34
|
+
title: Додати свій коментар
|
35
|
+
comment:
|
36
|
+
alignment:
|
37
|
+
against: Проти
|
38
|
+
in_favor: За
|
39
|
+
deleted_user: Видалений користувач
|
40
|
+
reply: Відповісти
|
41
|
+
report:
|
42
|
+
action: Доповісти
|
43
|
+
already_reported: Про цей вміст вже повідомлено, і його перегляне адміністратор.
|
44
|
+
close: Закрити
|
45
|
+
description: Чи цей вміст недоречний?
|
46
|
+
details: Додаткові коментарі
|
47
|
+
reasons:
|
48
|
+
does_not_belong: Містить незаконну діяльність, загрози самогубства, особисту інформацію чи ще щось, чого, на вашу думку, не повинно бути в %{organization_name}.
|
49
|
+
offensive: Містить расизм, сексизм, образи, особисті напади, загрози смерті, заяви про самогубство або будь-які ненависницькі висловлювання.
|
50
|
+
spam: Містить клацоловки (маніпулятивно-сенсаційні заголовки), рекламу, афери або дописи ботів.
|
51
|
+
title: Повідомити про проблему
|
52
|
+
verified_user_group: Перевірена організація
|
53
|
+
comment_order_selector:
|
54
|
+
order:
|
55
|
+
best_rated: З найкращим рейтингом
|
56
|
+
most_discussed: Найбільш обговорюване
|
57
|
+
older: Давніші
|
58
|
+
recent: Нещодавнє
|
59
|
+
title: 'Впорядкувати за:'
|
60
|
+
comment_thread:
|
61
|
+
title: Бесіда з %{authorName}
|
62
|
+
comments:
|
63
|
+
blocked_comments_warning: Коментарі на цьому кроці відключені, проте ви можете прочитати коментарі з попередніх кроків.
|
64
|
+
loading: Завантаження коментарів...
|
65
|
+
title: "%{count} коментарів"
|
66
|
+
featured_comment:
|
67
|
+
title: Рекомендований коментар
|
68
|
+
errors:
|
69
|
+
messages:
|
70
|
+
cannot_have_comments: не підлягає коментуванню
|
@@ -7,7 +7,6 @@ module Decidim
|
|
7
7
|
# Shared behaviour for commentable models.
|
8
8
|
module Commentable
|
9
9
|
extend ActiveSupport::Concern
|
10
|
-
include Decidim::Notifiable
|
11
10
|
|
12
11
|
included do
|
13
12
|
has_many :comments, as: :commentable, foreign_key: "decidim_commentable_id", foreign_type: "decidim_commentable_type", class_name: "Decidim::Comments::Comment"
|
@@ -38,6 +37,14 @@ module Decidim
|
|
38
37
|
def commentable_type
|
39
38
|
self.class.name
|
40
39
|
end
|
40
|
+
|
41
|
+
# Public: Defines which users will receive a notification when a comment is created.
|
42
|
+
# This method can be overridden at each resource model to include or exclude
|
43
|
+
# other users, eg. admins.
|
44
|
+
# Returns: a relation of Decidim::User objects.
|
45
|
+
def users_to_notify_on_comment_created
|
46
|
+
Decidim::User.none
|
47
|
+
end
|
41
48
|
end
|
42
49
|
end
|
43
50
|
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.6.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-
|
13
|
+
date: 2017-09-15 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.6.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.6.0
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: rails
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
@@ -60,28 +60,28 @@ dependencies:
|
|
60
60
|
requirements:
|
61
61
|
- - '='
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version: 0.
|
63
|
+
version: 0.6.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.
|
70
|
+
version: 0.6.0
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
72
|
name: decidim-admin
|
73
73
|
requirement: !ruby/object:Gem::Requirement
|
74
74
|
requirements:
|
75
75
|
- - '='
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version: 0.
|
77
|
+
version: 0.6.0
|
78
78
|
type: :development
|
79
79
|
prerelease: false
|
80
80
|
version_requirements: !ruby/object:Gem::Requirement
|
81
81
|
requirements:
|
82
82
|
- - '='
|
83
83
|
- !ruby/object:Gem::Version
|
84
|
-
version: 0.
|
84
|
+
version: 0.6.0
|
85
85
|
description: Pluggable comments system for some components.
|
86
86
|
email:
|
87
87
|
- josepjaume@gmail.com
|
@@ -99,6 +99,7 @@ files:
|
|
99
99
|
- app/assets/javascripts/decidim/comments/comments.js.erb
|
100
100
|
- app/commands/decidim/comments/create_comment.rb
|
101
101
|
- app/commands/decidim/comments/vote_comment.rb
|
102
|
+
- app/events/decidim/comments/comment_created_event.rb
|
102
103
|
- app/forms/decidim/comments/comment_form.rb
|
103
104
|
- app/frontend/application/apollo_client.ts
|
104
105
|
- app/frontend/application/application.component.test.tsx
|
@@ -142,7 +143,6 @@ files:
|
|
142
143
|
- app/frontend/support/require_all.ts
|
143
144
|
- app/frontend/support/resolve_graphql_query.ts
|
144
145
|
- app/frontend/support/schema.ts
|
145
|
-
- app/mailers/decidim/comments/comment_notification_mailer.rb
|
146
146
|
- app/models/decidim/comments/abilities/admin_ability.rb
|
147
147
|
- app/models/decidim/comments/abilities/current_user_ability.rb
|
148
148
|
- app/models/decidim/comments/abilities/participatory_process_admin_ability.rb
|
@@ -156,9 +156,6 @@ files:
|
|
156
156
|
- app/types/decidim/comments/commentable_interface.rb
|
157
157
|
- app/types/decidim/comments/commentable_mutation_type.rb
|
158
158
|
- app/types/decidim/comments/commentable_type.rb
|
159
|
-
- app/views/decidim/comments/comment_notification_mailer/comment_created.html.erb
|
160
|
-
- app/views/decidim/comments/comment_notification_mailer/reply_created.html.erb
|
161
|
-
- config/i18n-tasks.yml
|
162
159
|
- config/locales/ca.yml
|
163
160
|
- config/locales/en.yml
|
164
161
|
- config/locales/es.yml
|
@@ -168,6 +165,7 @@ files:
|
|
168
165
|
- config/locales/it.yml
|
169
166
|
- config/locales/nl.yml
|
170
167
|
- config/locales/pl.yml
|
168
|
+
- config/locales/uk.yml
|
171
169
|
- db/migrate/20161130143508_create_comments.rb
|
172
170
|
- db/migrate/20161214082645_add_depth_to_comments.rb
|
173
171
|
- db/migrate/20161216102820_add_alignment_to_comments.rb
|
@@ -1,44 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
module Comments
|
5
|
-
# A custom mailer for sending notifications to users when
|
6
|
-
# a comment is created.
|
7
|
-
class CommentNotificationMailer < Decidim::ApplicationMailer
|
8
|
-
helper Decidim::ResourceHelper
|
9
|
-
|
10
|
-
helper_method :commentable_title
|
11
|
-
|
12
|
-
def comment_created(user, comment, commentable)
|
13
|
-
with_user(user) do
|
14
|
-
@user = user
|
15
|
-
@comment = comment
|
16
|
-
@commentable = commentable
|
17
|
-
@locator = Decidim::ResourceLocatorPresenter.new(@commentable)
|
18
|
-
@organization = commentable.organization
|
19
|
-
subject = I18n.t("comment_created.subject", scope: "decidim.comments.mailer.comment_notification")
|
20
|
-
mail(to: user.email, subject: subject)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def reply_created(user, reply, comment, commentable)
|
25
|
-
with_user(user) do
|
26
|
-
@user = user
|
27
|
-
@reply = reply
|
28
|
-
@comment = comment
|
29
|
-
@commentable = commentable
|
30
|
-
@locator = Decidim::ResourceLocatorPresenter.new(@commentable)
|
31
|
-
@organization = commentable.organization
|
32
|
-
subject = I18n.t("reply_created.subject", scope: "decidim.comments.mailer.comment_notification")
|
33
|
-
mail(to: user.email, subject: subject)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
private
|
38
|
-
|
39
|
-
def commentable_title
|
40
|
-
@commentable.title.is_a?(Hash) ? @commentable.title[I18n.locale.to_s] : @commentable.title
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
<p><%= t("decidim.comments.comment_notification_mailer.hello", name: @user.name) %></p>
|
2
|
-
|
3
|
-
<p>
|
4
|
-
<%=
|
5
|
-
t(".new_comment_html", {
|
6
|
-
commenter: @comment.author.name,
|
7
|
-
commentable_link: link_to(commentable_title, @locator.url(anchor: "comment_#{@comment.id}"))
|
8
|
-
})
|
9
|
-
%>
|
10
|
-
</p>
|
11
|
-
|
12
|
-
<blockquote>
|
13
|
-
<%= @comment.body %>
|
14
|
-
</blockquote>
|
15
|
-
|
16
|
-
<p>
|
17
|
-
<%= t("decidim.comments.comment_notification_mailer.manage_email_subscriptions_html", link: link_to(t("decidim.comments.comment_notification_mailer.notifications_settings_link"), decidim.notifications_settings_url(host: @organization.host))) %>
|
18
|
-
</p>
|
@@ -1,18 +0,0 @@
|
|
1
|
-
<p><%= t("decidim.comments.comment_notification_mailer.hello", name: @user.name) %></p>
|
2
|
-
|
3
|
-
<p>
|
4
|
-
<%=
|
5
|
-
t(".new_reply_html", {
|
6
|
-
commenter: @reply.author.name,
|
7
|
-
commentable_link: link_to(commentable_title, @locator.url(anchor: "comment_#{@reply.id}"))
|
8
|
-
})
|
9
|
-
%>
|
10
|
-
</p>
|
11
|
-
|
12
|
-
<blockquote>
|
13
|
-
<%= @reply.body %>
|
14
|
-
</blockquote>
|
15
|
-
|
16
|
-
<p>
|
17
|
-
<%= t("decidim.comments.comment_notification_mailer.manage_email_subscriptions_html", link: link_to(t("decidim.comments.comment_notification_mailer.notifications_settings_link"), decidim.notifications_settings_url(host: @organization.host))) %>
|
18
|
-
</p>
|
data/config/i18n-tasks.yml
DELETED
@@ -1,123 +0,0 @@
|
|
1
|
-
# i18n-tasks finds and manages missing and unused translations: https://github.com/glebm/i18n-tasks
|
2
|
-
|
3
|
-
# The "main" locale.
|
4
|
-
base_locale: en
|
5
|
-
|
6
|
-
## Reporting locale, default: en. Available: en, ru.
|
7
|
-
# internal_locale: en
|
8
|
-
|
9
|
-
# Read and write translations.
|
10
|
-
data:
|
11
|
-
## Translations are read from the file system. Supported format: YAML, JSON.
|
12
|
-
## Provide a custom adapter:
|
13
|
-
# adapter: I18n::Tasks::Data::FileSystem
|
14
|
-
|
15
|
-
# Locale files or `File.find` patterns where translations are read from:
|
16
|
-
read:
|
17
|
-
## Default:
|
18
|
-
# - config/locales/%{locale}.yml
|
19
|
-
## More files:
|
20
|
-
# - config/locales/**/*.%{locale}.yml
|
21
|
-
## Another gem (replace %#= with %=):
|
22
|
-
# - "<%#= %x[bundle show vagrant].chomp %>/templates/locales/%{locale}.yml"
|
23
|
-
|
24
|
-
# Locale files to write new keys to, based on a list of key pattern => file rules. Matched from top to bottom:
|
25
|
-
# `i18n-tasks normalize -p` will force move the keys according to these rules
|
26
|
-
write:
|
27
|
-
## For example, write devise and simple form keys to their respective files:
|
28
|
-
# - ['{devise, simple_form}.*', 'config/locales/\1.%{locale}.yml']
|
29
|
-
## Catch-all default:
|
30
|
-
# - config/locales/%{locale}.yml
|
31
|
-
|
32
|
-
## Specify the router (see Readme for details). Valid values: conservative_router, pattern_router, or a custom class.
|
33
|
-
# router: convervative_router
|
34
|
-
|
35
|
-
yaml:
|
36
|
-
write:
|
37
|
-
# do not wrap lines at 80 characters
|
38
|
-
line_width: -1
|
39
|
-
|
40
|
-
## Pretty-print JSON:
|
41
|
-
# json:
|
42
|
-
# write:
|
43
|
-
# indent: ' '
|
44
|
-
# space: ' '
|
45
|
-
# object_nl: "\n"
|
46
|
-
# array_nl: "\n"
|
47
|
-
|
48
|
-
# Find translate calls
|
49
|
-
search:
|
50
|
-
## Paths or `File.find` patterns to search in:
|
51
|
-
# paths:
|
52
|
-
# - app/
|
53
|
-
|
54
|
-
## Root directories for relative keys resolution.
|
55
|
-
# relative_roots:
|
56
|
-
# - app/controllers
|
57
|
-
# - app/helpers
|
58
|
-
# - app/mailers
|
59
|
-
# - app/presenters
|
60
|
-
# - app/views
|
61
|
-
|
62
|
-
## Files or `File.fnmatch` patterns to exclude from search. Some files are always excluded regardless of this setting:
|
63
|
-
## %w(*.jpg *.png *.gif *.svg *.ico *.eot *.otf *.ttf *.woff *.woff2 *.pdf *.css *.sass *.scss *.less *.yml *.json)
|
64
|
-
exclude:
|
65
|
-
- app/assets/images
|
66
|
-
- app/assets/fonts
|
67
|
-
- app/assets/javascripts/decidim/comments/bundle.js
|
68
|
-
- app/assets/javascripts/decidim/comments/bundle.js.map
|
69
|
-
|
70
|
-
## Alternatively, the only files or `File.fnmatch patterns` to search in `paths`:
|
71
|
-
## If specified, this settings takes priority over `exclude`, but `exclude` still applies.
|
72
|
-
# only: ["*.rb", "*.html.slim"]
|
73
|
-
|
74
|
-
## If `strict` is `false`, guess usages such as t("categories.#{category}.title"). The default is `true`.
|
75
|
-
strict: false
|
76
|
-
|
77
|
-
## Multiple scanners can be used. Their results are merged.
|
78
|
-
## The options specified above are passed down to each scanner. Per-scanner options can be specified as well.
|
79
|
-
## See this example of a custom scanner: https://github.com/glebm/i18n-tasks/wiki/A-custom-scanner-example
|
80
|
-
|
81
|
-
## Google Translate
|
82
|
-
# translation:
|
83
|
-
# # Get an API key and set billing info at https://code.google.com/apis/console to use Google Translate
|
84
|
-
# api_key: "AbC-dEf5"
|
85
|
-
|
86
|
-
## Do not consider these keys missing:
|
87
|
-
ignore_missing:
|
88
|
-
- 'components.*'
|
89
|
-
# - 'errors.messages.{accepted,blank,invalid,too_short,too_long}'
|
90
|
-
# - '{devise,simple_form}.*'
|
91
|
-
|
92
|
-
## Consider these keys used:
|
93
|
-
ignore_unused:
|
94
|
-
- 'activerecord.errors.messages.*'
|
95
|
-
- 'decidim.components.*'
|
96
|
-
# - '{devise,kaminari,will_paginate}.*'
|
97
|
-
# - 'simple_form.{yes,no}'
|
98
|
-
# - 'simple_form.{placeholders,hints,labels}.*'
|
99
|
-
# - 'simple_form.{error_notification,required}.:'
|
100
|
-
|
101
|
-
## Exclude these keys from the `i18n-tasks eq-base' report:
|
102
|
-
# ignore_eq_base:
|
103
|
-
# all:
|
104
|
-
# - common.ok
|
105
|
-
# fr,es:
|
106
|
-
# - common.brand
|
107
|
-
|
108
|
-
## Ignore these keys completely:
|
109
|
-
# ignore:
|
110
|
-
# - kaminari.*
|
111
|
-
|
112
|
-
## Sometimes, it isn't possible for i18n-tasks to match the key correctly,
|
113
|
-
## e.g. in case of a relative key defined in a helper method.
|
114
|
-
## In these cases you can use the built-in PatternMapper to map patterns to keys, e.g.:
|
115
|
-
#
|
116
|
-
# <%#= I18n::Tasks.add_scanner 'I18n::Tasks::Scanners::PatternMapper',
|
117
|
-
# only: %w(*.html.haml *.html.slim),
|
118
|
-
# patterns: [['= title\b', '.page_title']] %>
|
119
|
-
#
|
120
|
-
# The PatternMapper can also match key literals via a special %{key} interpolation, e.g.:
|
121
|
-
#
|
122
|
-
# <%#= I18n::Tasks.add_scanner 'I18n::Tasks::Scanners::PatternMapper',
|
123
|
-
# patterns: [['\bSpree\.t[( ]\s*%{key}', 'spree.%{key}']] %>
|