Send email to users related with an investment when valuation comment is created

This commit is contained in:
lalo
2019-03-27 13:40:46 +01:00
parent 28815cb290
commit 8061bfa5e8
29 changed files with 74 additions and 49 deletions

View File

@@ -14,6 +14,7 @@ class CommentsController < ApplicationController
if @comment.save
CommentNotifier.new(comment: @comment).process
add_notification @comment
EvaluationCommentNotifier.new(comment: @comment).process if send_evaluation_notification?
else
render :new
end
@@ -107,4 +108,7 @@ class CommentsController < ApplicationController
end
end
def send_evaluation_notification?
@comment.valuation && Setting["feature.valuation_comment_notification"]
end
end

View File

@@ -9,7 +9,7 @@ module MailerHelper
end
def valuation_comments_url(commentable)
admin_budget_budget_investment_url( commentable.budget, commentable, anchor: "comments")
admin_budget_budget_investment_url(commentable.budget, commentable, anchor: "comments")
end
def valuation_comments_link(commentable)

View File

@@ -0,0 +1,16 @@
class EvaluationCommentNotifier
def initialize(args = {})
@comment = args.fetch(:comment)
end
def process
send_evaluation_comment_email
end
private
def send_evaluation_comment_email
EvaluationCommentEmail.new(@comment).to.each do |to|
Mailer.evaluation_comment(@comment, to).deliver_later
end
end
end

View File

@@ -58,6 +58,7 @@ class Setting < ApplicationRecord
"feature.allow_attached_documents": true,
"feature.allow_images": true,
"feature.help_page": true,
"feature.valuation_comment_notification": true,
"homepage.widgets.feeds.debates": true,
"homepage.widgets.feeds.processes": true,
"homepage.widgets.feeds.proposals": true,

View File

@@ -3,7 +3,7 @@ ar:
no_reply: "تم إرسال هذه الرسالة من عنوان بريد إلكتروني لا يقبل الردود."
comment:
hi: مرحبا
new_comment_by_html: هناك تعليق جديد من <b>%{commenter}</b>
new_comment_by_html: هناك تعليق جديد من <strong>%{commenter}</strong>
subject: تم التعليق على %{commentable}
title: تعليق جديد
config:
@@ -16,7 +16,7 @@ ar:
title: أكد حسابك باستخدام الرابط التالي
reply:
hi: مرحبا
new_reply_by_html: وهناك رد جديد من <b>%{commenter}</b> على التعليق الخاص بك
new_reply_by_html: وهناك رد جديد من <strong>%{commenter}</strong> على التعليق الخاص بك
subject: يوجد رد على تعليقك
title: اجابة جديدة على تعليقك
unfeasible_spending_proposal:

View File

@@ -3,7 +3,7 @@ ast:
no_reply: "Este mensaje se ha enviado desde una dirección de correo electrónico que no admite respuestas."
comment:
hi: Hola
new_comment_by_html: Hay un nuevo comentario de <b>%{commenter}</b> en
new_comment_by_html: Hay un nuevo comentario de <strong>%{commenter}</strong> en
subject: Alguien ha comentado en tu %{commentable}
title: Nuevo comentario
config:
@@ -16,7 +16,7 @@ ast:
title: Verifica tu cuenta con el siguiente enlace
reply:
hi: Hola
new_reply_by_html: Hay una nueva respuesta de <b>%{commenter}</b> a tu comentario en
new_reply_by_html: Hay una nueva respuesta de <strong>%{commenter}</strong> a tu comentario en
subject: Alguien ha respondido a tu comentario
title: Nueva respuesta a tu comentario
unfeasible_spending_proposal:

View File

@@ -3,7 +3,7 @@ ca:
no_reply: "Aquest missatge s'ha enviat des d'una adreça de correu electrònic que no admet respostes."
comment:
hi: Hola
new_comment_by_html: Hi ha un nou comentari de <b>%{commenter}</b> en
new_comment_by_html: Hi ha un nou comentari de <strong>%{commenter}</strong> en
subject: Algú ha comentat en el teu %{commentable}
title: Nou comentari
config:
@@ -16,7 +16,7 @@ ca:
title: Verifica el teu compte amb el següent enllaç
reply:
hi: Hola
new_reply_by_html: Hi ha una nova resposta de <b>%{commenter}</b> al teu comentari en
new_reply_by_html: Hi ha una nova resposta de <strong>%{commenter}</strong> al teu comentari en
subject: Algú ha respost al teu comentari
title: Nova resposta al teu comentari
unfeasible_spending_proposal:

View File

@@ -3,7 +3,7 @@ de:
no_reply: "Diese Nachricht wurde von einer E-Mail-Adresse gesendet, die keine Antworten akzeptiert."
comment:
hi: Hallo
new_comment_by_html: Es gibt einen neuen Kommentar von <b>%{commenter}</b>
new_comment_by_html: Es gibt einen neuen Kommentar von <strong>%{commenter}</strong>
subject: Jemand hat Ihre %{commentable} kommentiert.
title: Neuer Kommentar
config:
@@ -16,7 +16,7 @@ de:
title: Bestätigen Sie Ihr Konto über den folgenden Link
reply:
hi: Hallo
new_reply_by_html: Es gibt eine neue Antwort von <b>%{commenter}</b> auf Ihren Kommentar
new_reply_by_html: Es gibt eine neue Antwort von <strong>%{commenter}</strong> auf Ihren Kommentar
subject: Jemand hat auf Ihren Kommentar geantwortet
title: Neue Antwort auf Ihren Kommentar
unfeasible_spending_proposal:

View File

@@ -3,7 +3,7 @@ en:
no_reply: "This message was sent from an email address that does not accept replies."
comment:
hi: Hi
new_comment_by_html: There is a new comment from <b>%{commenter}</b>
new_comment_by_html: There is a new comment from <strong>%{commenter}</strong>
subject: Someone has commented on your %{commentable}
title: New comment
config:
@@ -17,7 +17,7 @@ en:
title: Confirm your account using the following link
reply:
hi: Hi
new_reply_by_html: There is a new response from <b>%{commenter}</b> to your comment on
new_reply_by_html: There is a new response from <strong>%{commenter}</strong> to your comment on
subject: Someone has responded to your comment
title: New response to your comment
proposal_notification_digest:
@@ -74,7 +74,7 @@ en:
subject: "New evaluation comment"
title: New evaluation comment for %{investment}
hi: Hi
new_comment_by_html: There is a new evaluation comment from <b>%{commenter}</b> to the budget investment %{investment}
new_comment_by_html: There is a new evaluation comment from <strong>%{commenter}</strong> to the budget investment %{investment}
commenter_info: "%{commenter}, %{time}:"
new_actions_notification_rake_created:
subject: "More news about your citizen proposal"

View File

@@ -116,6 +116,8 @@ en:
public_stats_description: "Display public stats in the Administration panel"
help_page: "Help page"
help_page_description: 'Displays a Help menu that contains a page with an info section about each enabled feature. Also custom pages and menus can be created in the "Custom pages" and "Custom content blocks" sections'
valuation_comment_notification: "Valuation comment notification"
valuation_comment_notification_description: "Send an email to all associated users except valuation commenter to budget investment when a new valuation comment is created"
map:
latitude: "Latitude"
latitude_description: "Latitude to show the map position"

View File

@@ -3,7 +3,7 @@ es-PE:
no_reply: "Este mensaje se ha enviado desde una dirección de correo electrónico que no admite respuestas."
comment:
hi: Hola
new_comment_by_html: Hay un nuevo comentario de <b>%{commenter}</b> en
new_comment_by_html: Hay un nuevo comentario de <strong>%{commenter}</strong> en
subject: Alguien ha comentado en tu %{commentable}
title: Nuevo comentario
config:
@@ -16,7 +16,7 @@ es-PE:
title: Verifica tu cuenta con el siguiente enlace
reply:
hi: Hola
new_reply_by_html: Hay una nueva respuesta de <b>%{commenter}</b> a tu comentario en
new_reply_by_html: Hay una nueva respuesta de <strong>%{commenter}</strong> a tu comentario en
subject: Alguien ha respondido a tu comentario
title: Nueva respuesta a tu comentario
unfeasible_spending_proposal:

View File

@@ -3,7 +3,7 @@ es:
no_reply: "Este mensaje se ha enviado desde una dirección de correo electrónico que no admite respuestas."
comment:
hi: Hola
new_comment_by_html: Hay un nuevo comentario de <b>%{commenter}</b> en
new_comment_by_html: Hay un nuevo comentario de <strong>%{commenter}</strong> en
subject: Alguien ha comentado en tu %{commentable}
title: Nuevo comentario
config:
@@ -17,7 +17,7 @@ es:
title: Verifica tu cuenta con el siguiente enlace
reply:
hi: Hola
new_reply_by_html: Hay una nueva respuesta de <b>%{commenter}</b> a tu comentario en
new_reply_by_html: Hay una nueva respuesta de <strong>%{commenter}</strong> a tu comentario en
subject: Alguien ha respondido a tu comentario
title: Nueva respuesta a tu comentario
proposal_notification_digest:
@@ -74,7 +74,7 @@ es:
subject: "Nuevo comentario de evaluación"
title: Nuevo comentario de evaluación para %{investment}
hi: Hola
new_comment_by_html: Hay un nuevo comentario de evaluación de <b>%{commenter}</b> en el presupuesto participativo %{investment}
new_comment_by_html: Hay un nuevo comentario de evaluación de <strong>%{commenter}</strong> en el presupuesto participativo %{investment}
commenter_info: "%{commenter}, %{time}"
new_actions_notification_rake_created:
subject: "Más novedades de tu propuesta ciudadana"

View File

@@ -116,6 +116,8 @@ es:
public_stats_description: "Muestra las estadísticas públicas en el panel de Administración"
help_page: "Página de ayuda"
help_page_description: 'Muestra un menú Ayuda que contiene una página con una sección de información sobre cada funcionalidad habilitada. También se pueden crear páginas y menús personalizados en las secciones "Personalizar páginas" y "Personalizar bloques"'
valuation_comment_notification: "Notificar comentarios de evaluación"
valuation_comment_notification_description: "Envía un email a todos los usuarios menos al que haya comentado asociados a un presupuesto participativo cuando se cree un nuevo comentario de evaluación"
map:
latitude: "Latitud"
latitude_description: "Latitud para mostrar la posición del mapa"

View File

@@ -3,7 +3,7 @@ fr:
no_reply: "Ce message a été envoyé d'une adresse qui n'accepte pas les réponses."
comment:
hi: Bonjour
new_comment_by_html: Il y a un nouveau commentaire de <b>%{commenter}</b>
new_comment_by_html: Il y a un nouveau commentaire de <strong>%{commenter}</strong>
subject: Quelqu'un a commenté votre %{commentable}
title: Nouveau commentaire
config:
@@ -17,7 +17,7 @@ fr:
title: Confirmer votre compte en utilisant le lien suivant
reply:
hi: Bonjour
new_reply_by_html: Il y a une nouvelle réponse de <b>%{commenter}</b> à votre commentaire sur
new_reply_by_html: Il y a une nouvelle réponse de <strong>%{commenter}</strong> à votre commentaire sur
subject: Quelqu'un a répondu à votre commentaire
title: Nouvelle réponse à votre commentaire
unfeasible_spending_proposal:

View File

@@ -3,7 +3,7 @@ gl:
no_reply: "Esta mensaxe enviouse desde un enderezo de correo electrónico que non admite respostas."
comment:
hi: Ola
new_comment_by_html: Hai un novo comentario de <b>%{commenter}</b> en
new_comment_by_html: Hai un novo comentario de <strong>%{commenter}</strong> en
subject: Alguén comentou no teu %{commentable}
title: Novo comentario
config:
@@ -17,7 +17,7 @@ gl:
title: Verifica a túa conta co seguinte enlace
reply:
hi: Ola
new_reply_by_html: Hai unha nova resposta de <b>%{commenter}</b> ao tu comentario en
new_reply_by_html: Hai unha nova resposta de <strong>%{commenter}</strong> ao tu comentario en
subject: Alguén respondeu ao teu comentario
title: Nova resposta ao teu comentario
unfeasible_spending_proposal:

View File

@@ -3,7 +3,7 @@ he:
no_reply: "נא לא לענות לכתובת דואר זו."
comment:
hi: שלום
new_comment_by_html: ישנה הערה חדשה מ <b>%{commenter}</b>
new_comment_by_html: ישנה הערה חדשה מ <strong>%{commenter}</strong>
subject: ישנה הערה חדשה %{commentable}
title: הערה חדשה
config:
@@ -17,7 +17,7 @@ he:
title: אשר את חשבונך באמצעות הקישור הבא
reply:
hi: שלום
new_reply_by_html: ישנה התייחסות חדשה מ <b>%{commenter}</b> לתגובתך בנושא
new_reply_by_html: ישנה התייחסות חדשה מ <strong>%{commenter}</strong> לתגובתך בנושא
subject: מישהו הגיב להערה שלך
title: התקבלה תגובה חדשה להערה שלך
unfeasible_spending_proposal:

View File

@@ -3,7 +3,7 @@ id:
no_reply: "Pesan ini dikirim dari alamat email yang tidak menerima balasan."
comment:
hi: Hai
new_comment_by_html: Ada komentar baru dari <b>%{commenter}</b>
new_comment_by_html: Ada komentar baru dari <strong>%{commenter}</strong>
subject: Seseorang telah berkomentar tentang anda %{commentable}
title: Komentar baru
config:
@@ -16,7 +16,7 @@ id:
title: Konfirmasikan akun anda menggunakan tautan berikut
reply:
hi: Hai
new_reply_by_html: Ada respon baru dari <b>%{commenter}</b> untuk komentar anda
new_reply_by_html: Ada respon baru dari <strong>%{commenter}</strong> untuk komentar anda
subject: Seseorang telah menanggapi komentar anda
title: Tanggapan baru atas komentar anda
unfeasible_spending_proposal:

View File

@@ -3,7 +3,7 @@ it:
no_reply: "Questo messaggio è stato inviato da un indirizzo di posta elettronica che non accetta risposte."
comment:
hi: Salve
new_comment_by_html: C'è un nuovo commento da <b>%{commenter}</b>
new_comment_by_html: C'è un nuovo commento da <strong>%{commenter}</strong>
subject: Qualcuno ha commentato sul tuo %{commentable}
title: Nuovo commento
config:
@@ -17,7 +17,7 @@ it:
title: Conferma il tuo account utilizzando il seguente link
reply:
hi: Ciao
new_reply_by_html: C'è una nuova risposta da <b>%{commenter}</b> per il tuo commento su
new_reply_by_html: C'è una nuova risposta da <strong>%{commenter}</strong> per il tuo commento su
subject: Qualcuno ha risposto al tuo commento
title: Nuova risposta al tuo commento
unfeasible_spending_proposal:

View File

@@ -3,7 +3,7 @@ nl:
no_reply: "This message was sent from an email address that does not accept replies."
comment:
hi: Hi
new_comment_by_html: There is a new comment from <b>%{commenter}</b>
new_comment_by_html: There is a new comment from <strong>%{commenter}</strong>
subject: Someone has commented on your %{commentable}
title: New comment
config:
@@ -17,7 +17,7 @@ nl:
title: Confirm your account using the following link
reply:
hi: Hoi
new_reply_by_html: There is a new response from <b>%{commenter}</b> to your comment on
new_reply_by_html: There is a new response from <strong>%{commenter}</strong> to your comment on
subject: Someone has responded to your comment
title: New response to your comment
unfeasible_spending_proposal:

View File

@@ -3,7 +3,7 @@ pl:
no_reply: "Ta wiadomość została wysłana z adresu e-mail, który nie akceptuje odpowiedzi."
comment:
hi: Cześć
new_comment_by_html: Nowy komentarz od <b>%{commenter}</b>
new_comment_by_html: Nowy komentarz od <strong>%{commenter}</strong>
subject: Ktoś skomentował Twój %{commentable}
title: Nowy komentarz
config:
@@ -17,7 +17,7 @@ pl:
title: Potwierdź swoje konto za pomocą następującego linku
reply:
hi: Cześć
new_reply_by_html: Nowa odpowiedź od <b>%{commenter}</b> na Twój komentarz odnośnie
new_reply_by_html: Nowa odpowiedź od <strong>%{commenter}</strong> na Twój komentarz odnośnie
subject: Ktoś odpowiedział na Twój komentarz
title: Nowa odpowiedź na Twój komentarz
unfeasible_spending_proposal:

View File

@@ -3,7 +3,7 @@ pt-BR:
no_reply: "Esta mensagem foi enviada de um endereço de e-mail que não aceita respostas."
comment:
hi: Oi
new_comment_by_html: Há um novo comentário de <b>%{commenter}</b>
new_comment_by_html: Há um novo comentário de <strong>%{commenter}</strong>
subject: Alguém comentou sobre seu %{commentable}
title: Novo comentário
config:
@@ -17,7 +17,7 @@ pt-BR:
title: Confirme sua conta usando o seguinte link
reply:
hi: Oi
new_reply_by_html: Há uma nova resposta de <b>%{commenter}</b> ao seu comentário sobre
new_reply_by_html: Há uma nova resposta de <strong>%{commenter}</strong> ao seu comentário sobre
subject: Alguém respondeu ao seu comentário
title: Nova resposta ao seu comentário
unfeasible_spending_proposal:

View File

@@ -3,7 +3,7 @@ ru:
no_reply: "Это сообщение было отправлено с email адреса, который не принимает ответы."
comment:
hi: Здравствуйте
new_comment_by_html: Появился новый комментарий от <b>%{commenter}</b>
new_comment_by_html: Появился новый комментарий от <strong>%{commenter}</strong>
subject: Кто-то прокомментировал ваш %{commentable}
title: Новый комментарий
config:
@@ -17,7 +17,7 @@ ru:
title: Подтвердить ваш аккаунт при помощи следующей ссылки
reply:
hi: Здравствуйте
new_reply_by_html: Появился новый ответ от <b>%{commenter}</b> на ваш комментарий на
new_reply_by_html: Появился новый ответ от <strong>%{commenter}</strong> на ваш комментарий на
subject: Кто-то ответил на ваш комментарий
title: Новый ответ на ваш комментарий
unfeasible_spending_proposal:

View File

@@ -3,7 +3,7 @@ sl:
no_reply: "To sporočilo je bilo poslano z e-naslova, ki ne sprejema odgovorov."
comment:
hi: Hej
new_comment_by_html: Imaš nov komentar uporabnika/-ce <b>%{commenter}</b>
new_comment_by_html: Imaš nov komentar uporabnika/-ce <strong>%{commenter}</strong>
subject: Nekdo je komentiral na tvoj %{commentable}
title: Nov komentar
config:
@@ -17,7 +17,7 @@ sl:
title: Potrdi svoj račun z uporabo naslednje povezave
reply:
hi: Hej
new_reply_by_html: Imaš nov odgovor uporabnika/-ce <b>%{commenter}</b> na tvoj komentar o
new_reply_by_html: Imaš nov odgovor uporabnika/-ce <strong>%{commenter}</strong> na tvoj komentar o
subject: Nekdo se je odzval na tvoj komentar
title: Nov odgovor na tvoj komentar
unfeasible_spending_proposal:

View File

@@ -3,7 +3,7 @@ so:
no_reply: "Farriintan waxaa loo direy cinwaanka emailka ah ee aan aqbalin jawaab-celinta."
comment:
hi: Haye
new_comment_by_html: Waxa jira faalo cusub<b>%{commenter}</b>
new_comment_by_html: Waxa jira faalo cusub<strong>%{commenter}</strong>
subject: Qof ayaa ka falooday%{commentable}
title: Faalo cusub
config:
@@ -17,7 +17,7 @@ so:
title: Xaqiiji xisaabtaada adigoo isticmaalaya xiriirka soo socda
reply:
hi: Haye
new_reply_by_html: Waxaa jira jawaab cusub oo ka socota <b>%{commenter}</b> si aad faallo uga bixiso
new_reply_by_html: Waxaa jira jawaab cusub oo ka socota <strong>%{commenter}</strong> si aad faallo uga bixiso
subject: Qof ayaa kajawaabay faladadii
title: Jawaabta cusub ee faalladaada
unfeasible_spending_proposal:

View File

@@ -3,7 +3,7 @@ sq:
no_reply: "Ky mesazh u dërgua nga një adresë e-mail që nuk pranon përgjigje."
comment:
hi: Përshëndetje!
new_comment_by_html: Ka një koment të ri nga<b>%{commenter}</b>
new_comment_by_html: Ka një koment të ri nga<strong>%{commenter}</strong>
subject: Dikush ka komentuar mbi %{commentable} tuaj
title: Komenti i ri
config:
@@ -17,7 +17,7 @@ sq:
title: Konfirmo llogarinë tënd duke përdorur lidhjen e mëposhtme
reply:
hi: Hi
new_reply_by_html: Ka një përgjigje të re nga <b>%{commenter}</b> në komentin tuaj
new_reply_by_html: Ka një përgjigje të re nga <strong>%{commenter}</strong> në komentin tuaj
subject: Dikush i është përgjigjur komentit tuaj
title: Përgjigje e re tek komentit tuaj
unfeasible_spending_proposal:

View File

@@ -3,7 +3,7 @@ sv:
no_reply: "Det går inte att svara till den här e-postadressen."
comment:
hi: Hej
new_comment_by_html: Det finns en ny kommentar från <b>%{commenter}</b>
new_comment_by_html: Det finns en ny kommentar från <strong>%{commenter}</strong>
subject: Någon har kommenterat på ditt %{commentable}
title: Ny kommentar
config:
@@ -17,7 +17,7 @@ sv:
title: Bekräfta kontot via länken nedan
reply:
hi: Hej
new_reply_by_html: Det finns ett nytt svar från <b>%{commenter}</b> till din kommentar på
new_reply_by_html: Det finns ett nytt svar från <strong>%{commenter}</strong> till din kommentar på
subject: Någon har svarat på din kommentar
title: Nytt svar på din kommentar
unfeasible_spending_proposal:

View File

@@ -3,7 +3,7 @@ val:
no_reply: "Aquest missatge s'ha enviat des d'una direcció de correu electrònic que no admet respostes."
comment:
hi: Hola
new_comment_by_html: Hi ha un nou comentari de <b>%{commenter}</b> en
new_comment_by_html: Hi ha un nou comentari de <strong>%{commenter}</strong> en
subject: Algú ha comentat en el teu %{commentable}
title: Nou comentari
config:
@@ -17,7 +17,7 @@ val:
title: Verifica el teu compte amb el següent enllaç
reply:
hi: Hola
new_reply_by_html: Hi ha noves respostes de <b>%{commenter}</b> al teu comentari en
new_reply_by_html: Hi ha noves respostes de <strong>%{commenter}</strong> al teu comentari en
subject: Algú ha contestat el teu comentari
title: Nova resposta al teu comentari
unfeasible_spending_proposal:

View File

@@ -3,7 +3,7 @@ zh-CN:
no_reply: "此消息是从一个不接受回复的电子邮件地址发送的。"
comment:
hi: 您好
new_comment_by_html: 来自<b>%{commenter}</b>的新评论
new_comment_by_html: 来自<strong>%{commenter}</strong>的新评论
subject: 有人对您的%{commentable} 做了评论
title: 新评论
config:
@@ -17,7 +17,7 @@ zh-CN:
title: 使用以下链接来确认您的账户
reply:
hi: 您好
new_reply_by_html: <b>%{commenter}</b> 对您评论有新回复
new_reply_by_html: <strong>%{commenter}</strong> 对您评论有新回复
subject: 有人回复了您的评论
title: 对您评论的新回复
unfeasible_spending_proposal:

View File

@@ -3,7 +3,7 @@ zh-TW:
no_reply: "此郵件是從一個不接受回覆的電郵地址發送的。"
comment:
hi: 您好
new_comment_by_html: <b>%{commenter}</b>發表了新評論
new_comment_by_html: <strong>%{commenter}</strong>發表了新評論
subject: 有人評論了您的%{commentable}
title: 新評論
config:
@@ -17,7 +17,7 @@ zh-TW:
title: 使用以下鏈接確認您的帳戶
reply:
hi: 您好
new_reply_by_html: <b>%{commenter}</b>對您的評論有新的回覆
new_reply_by_html: <strong>%{commenter}</strong>對您的評論有新的回覆
subject: 有人回覆了您的評論
title: 對您的評論的新回覆
unfeasible_spending_proposal: