mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Private message emails now include the history
This commit is contained in:
parent
915a02938e
commit
fe3a69c271
@ -28,22 +28,6 @@ class UserNotifications < ActionMailer::Base
|
|||||||
build_email(user.email, template: "user_notifications.forgot_password", email_token: opts[:email_token])
|
build_email(user.email, template: "user_notifications.forgot_password", email_token: opts[:email_token])
|
||||||
end
|
end
|
||||||
|
|
||||||
def private_message(user, opts={})
|
|
||||||
post = opts[:post]
|
|
||||||
build_email user.email,
|
|
||||||
template: "user_notifications.private_message",
|
|
||||||
message: post.raw,
|
|
||||||
url: post.url,
|
|
||||||
subject_prefix: "[#{I18n.t('private_message_abbrev')}] #{post.post_number != 1 ? 're: ' : ''}",
|
|
||||||
topic_title: post.topic.title,
|
|
||||||
private_message_from: post.user.name,
|
|
||||||
from_alias: I18n.t(:via, username: post.user.name, site_name: SiteSetting.title),
|
|
||||||
add_unsubscribe_link: true,
|
|
||||||
allow_reply_by_email: true,
|
|
||||||
post_id: post.id,
|
|
||||||
topic_id: post.topic_id
|
|
||||||
end
|
|
||||||
|
|
||||||
def digest(user, opts={})
|
def digest(user, opts={})
|
||||||
@user = user
|
@user = user
|
||||||
@base_url = Discourse.base_url
|
@base_url = Discourse.base_url
|
||||||
@ -92,6 +76,15 @@ class UserNotifications < ActionMailer::Base
|
|||||||
notification_email(user, opts)
|
notification_email(user, opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def user_private_message(user, opts)
|
||||||
|
opts[:allow_reply_by_email] = true
|
||||||
|
|
||||||
|
# We use the 'user_posted' event when you are emailed a post in a PM.
|
||||||
|
opts[:notification_type] = 'posted'
|
||||||
|
|
||||||
|
notification_email(user, opts)
|
||||||
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def email_post_markdown(post)
|
def email_post_markdown(post)
|
||||||
@ -112,7 +105,7 @@ class UserNotifications < ActionMailer::Base
|
|||||||
return unless @post = opts[:post]
|
return unless @post = opts[:post]
|
||||||
|
|
||||||
username = @notification.data_hash[:display_username]
|
username = @notification.data_hash[:display_username]
|
||||||
notification_type = Notification.types[@notification.notification_type].to_s
|
notification_type = opts[:notification_type] || Notification.types[@notification.notification_type].to_s
|
||||||
|
|
||||||
context = ""
|
context = ""
|
||||||
context_posts = Post.where(topic_id: @post.topic_id)
|
context_posts = Post.where(topic_id: @post.topic_id)
|
||||||
@ -133,6 +126,9 @@ class UserNotifications < ActionMailer::Base
|
|||||||
locals: { context_posts: context_posts, post: @post }
|
locals: { context_posts: context_posts, post: @post }
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if @post.topic.private_message?
|
||||||
|
opts[:subject_prefix] = "[#{I18n.t('private_message_abbrev')}] "
|
||||||
|
end
|
||||||
|
|
||||||
email_opts = {
|
email_opts = {
|
||||||
topic_title: @notification.data_hash[:topic_title],
|
topic_title: @notification.data_hash[:topic_title],
|
||||||
@ -146,7 +142,8 @@ class UserNotifications < ActionMailer::Base
|
|||||||
allow_reply_by_email: opts[:allow_reply_by_email],
|
allow_reply_by_email: opts[:allow_reply_by_email],
|
||||||
template: "user_notifications.user_#{notification_type}",
|
template: "user_notifications.user_#{notification_type}",
|
||||||
html_override: html,
|
html_override: html,
|
||||||
style: :notification
|
style: :notification,
|
||||||
|
subject_prefix: opts[:subject_prefix] || ''
|
||||||
}
|
}
|
||||||
|
|
||||||
# If we have a display name, change the from address
|
# If we have a display name, change the from address
|
||||||
|
@ -16,6 +16,7 @@ class UserEmailObserver < ActiveRecord::Observer
|
|||||||
|
|
||||||
# Delegate to email_user_{{NOTIFICATION_TYPE}} if exists
|
# Delegate to email_user_{{NOTIFICATION_TYPE}} if exists
|
||||||
email_method = :"email_user_#{notification_type.to_s}"
|
email_method = :"email_user_#{notification_type.to_s}"
|
||||||
|
|
||||||
send(email_method, notification) if respond_to?(email_method)
|
send(email_method, notification) if respond_to?(email_method)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -57,6 +58,15 @@ class UserEmailObserver < ActiveRecord::Observer
|
|||||||
notification_id: notification.id)
|
notification_id: notification.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def email_user_private_message(notification)
|
||||||
|
return unless (notification.user.email_direct? && notification.user.email_private_messages?)
|
||||||
|
Jobs.enqueue_in(SiteSetting.email_time_window_mins.minutes,
|
||||||
|
:user_email,
|
||||||
|
type: :user_private_message,
|
||||||
|
user_id: notification.user_id,
|
||||||
|
notification_id: notification.id)
|
||||||
|
end
|
||||||
|
|
||||||
def email_user_invited_to_private_message(notification)
|
def email_user_invited_to_private_message(notification)
|
||||||
return unless notification.user.email_direct?
|
return unless notification.user.email_direct?
|
||||||
Jobs.enqueue_in(SiteSetting.email_time_window_mins.minutes,
|
Jobs.enqueue_in(SiteSetting.email_time_window_mins.minutes,
|
||||||
|
@ -1016,7 +1016,7 @@ cs:
|
|||||||
Prosím navšivte tento odkaz, chcete-li odpovědět: %{base_url}%{url}
|
Prosím navšivte tento odkaz, chcete-li odpovědět: %{base_url}%{url}
|
||||||
|
|
||||||
user_posted:
|
user_posted:
|
||||||
subject_template: "[%{site_name}] %{username} přispěl do tématu '%{topic_title}'"
|
subject_template: "[%{site_name}] %{subject_prefix}%{username} přispěl do tématu '%{topic_title}'"
|
||||||
text_body_template: |
|
text_body_template: |
|
||||||
%{username} přispěl do tématu '%{topic_title}' na %{site_name}:
|
%{username} přispěl do tématu '%{topic_title}' na %{site_name}:
|
||||||
|
|
||||||
@ -1036,17 +1036,6 @@ cs:
|
|||||||
from: "souhrn z %{site_name}"
|
from: "souhrn z %{site_name}"
|
||||||
read_more: "Číst dále"
|
read_more: "Číst dále"
|
||||||
|
|
||||||
private_message:
|
|
||||||
subject_template: "[%{site_name}] %{subject_prefix}%{topic_title}"
|
|
||||||
text_body_template: |
|
|
||||||
%{from} vám právě zaslal soukromou zprávu
|
|
||||||
|
|
||||||
---
|
|
||||||
%{message}
|
|
||||||
|
|
||||||
---
|
|
||||||
Prosím navšivte tento odkaz, chcete-li odpovědět: %{base_url}%{url}
|
|
||||||
|
|
||||||
forgot_password:
|
forgot_password:
|
||||||
subject_template: "[%{site_name}] Obnovení hesla"
|
subject_template: "[%{site_name}] Obnovení hesla"
|
||||||
text_body_template: |
|
text_body_template: |
|
||||||
|
@ -714,7 +714,7 @@ da:
|
|||||||
Klik her for at svare: %{base_url}%{url}
|
Klik her for at svare: %{base_url}%{url}
|
||||||
|
|
||||||
user_posted:
|
user_posted:
|
||||||
subject_template: "[%{site_name}] %{username} skrev et indlæg i emnet '%{topic_title}'"
|
subject_template: "[%{site_name}] %{subject_prefix}%{username} skrev et indlæg i emnet '%{topic_title}'"
|
||||||
text_body_template: |
|
text_body_template: |
|
||||||
%{username} skrev et indlæg i emnet '%{topic_title}' på %{site_name}:
|
%{username} skrev et indlæg i emnet '%{topic_title}' på %{site_name}:
|
||||||
|
|
||||||
@ -733,17 +733,6 @@ da:
|
|||||||
click_here: "klik her"
|
click_here: "klik her"
|
||||||
from: "%{site_name} opsummering"
|
from: "%{site_name} opsummering"
|
||||||
|
|
||||||
private_message:
|
|
||||||
subject_template: "[%{site_name}] %{subject_prefix}%{topic_title}"
|
|
||||||
text_body_template: |
|
|
||||||
%{private_message_from} har sendt dig en privat besked
|
|
||||||
|
|
||||||
---
|
|
||||||
%{message}
|
|
||||||
|
|
||||||
---
|
|
||||||
Klik her for at svare: %{base_url}%{url}
|
|
||||||
|
|
||||||
forgot_password:
|
forgot_password:
|
||||||
subject_template: "[%{site_name}] Nulstil kodeord"
|
subject_template: "[%{site_name}] Nulstil kodeord"
|
||||||
text_body_template: |
|
text_body_template: |
|
||||||
|
@ -903,7 +903,7 @@ de:
|
|||||||
Um zu antworten, besuche den folgenden Link: %{base_url}%{url}
|
Um zu antworten, besuche den folgenden Link: %{base_url}%{url}
|
||||||
|
|
||||||
user_posted:
|
user_posted:
|
||||||
subject_template: "[%{site_name}] %{username} hat auf '%{topic_title}' geantwortet"
|
subject_template: "[%{site_name}] %{subject_prefix}%{username} hat auf '%{topic_title}' geantwortet"
|
||||||
text_body_template: |
|
text_body_template: |
|
||||||
%{username} hat in '%{topic_title}' auf %{site_name} geantwortet:
|
%{username} hat in '%{topic_title}' auf %{site_name} geantwortet:
|
||||||
|
|
||||||
@ -923,17 +923,6 @@ de:
|
|||||||
from: "%{site_name} Übersicht"
|
from: "%{site_name} Übersicht"
|
||||||
read_more: "Weiterlesen"
|
read_more: "Weiterlesen"
|
||||||
|
|
||||||
private_message:
|
|
||||||
subject_template: "[%{site_name}] %{subject_prefix}%{topic_title}"
|
|
||||||
text_body_template: |
|
|
||||||
%{private_message_from} hat Die eine private Nachricht geschickt:
|
|
||||||
|
|
||||||
---
|
|
||||||
%{message}
|
|
||||||
|
|
||||||
---
|
|
||||||
Um zu antworten, besuche den folgenden Link: %{base_url}%{url}
|
|
||||||
|
|
||||||
forgot_password:
|
forgot_password:
|
||||||
subject_template: "[%{site_name}] Passwort zurückgesetzt"
|
subject_template: "[%{site_name}] Passwort zurückgesetzt"
|
||||||
text_body_template: |
|
text_body_template: |
|
||||||
|
@ -985,7 +985,7 @@ en:
|
|||||||
%{respond_instructions}
|
%{respond_instructions}
|
||||||
|
|
||||||
user_posted:
|
user_posted:
|
||||||
subject_template: "[%{site_name}] new post in '%{topic_title}'"
|
subject_template: "[%{site_name}] %{subject_prefix}new post in '%{topic_title}'"
|
||||||
text_body_template: |
|
text_body_template: |
|
||||||
%{message}
|
%{message}
|
||||||
|
|
||||||
@ -1004,16 +1004,6 @@ en:
|
|||||||
from: "%{site_name} digest"
|
from: "%{site_name} digest"
|
||||||
read_more: "Read More"
|
read_more: "Read More"
|
||||||
|
|
||||||
private_message:
|
|
||||||
subject_template: "[%{site_name}] %{subject_prefix}%{topic_title}"
|
|
||||||
text_body_template: |
|
|
||||||
%{private_message_from} just sent you a private message
|
|
||||||
|
|
||||||
%{message}
|
|
||||||
|
|
||||||
---
|
|
||||||
%{respond_instructions}
|
|
||||||
|
|
||||||
forgot_password:
|
forgot_password:
|
||||||
subject_template: "[%{site_name}] Password reset"
|
subject_template: "[%{site_name}] Password reset"
|
||||||
text_body_template: |
|
text_body_template: |
|
||||||
|
@ -694,7 +694,7 @@ es:
|
|||||||
Por favor visita este link para contestar: %{base_url}%{url}
|
Por favor visita este link para contestar: %{base_url}%{url}
|
||||||
|
|
||||||
user_posted:
|
user_posted:
|
||||||
subject_template: "[%{site_name}] %{username} posteó en '%{topic_title}'"
|
subject_template: "[%{site_name}] %{subject_prefix}%{username} posteó en '%{topic_title}'"
|
||||||
text_body_template: |
|
text_body_template: |
|
||||||
%{username} posteó en '%{topic_title}' en %{site_name}:
|
%{username} posteó en '%{topic_title}' en %{site_name}:
|
||||||
|
|
||||||
@ -713,17 +713,6 @@ es:
|
|||||||
click_here: "click aquí"
|
click_here: "click aquí"
|
||||||
from: "%{site_name} digest"
|
from: "%{site_name} digest"
|
||||||
|
|
||||||
private_message:
|
|
||||||
subject_template: "[%{site_name}] %{subject_prefix}%{topic_title}"
|
|
||||||
text_body_template: |
|
|
||||||
%{private_message_from} te acaba de mandar un mensaje privado
|
|
||||||
|
|
||||||
---
|
|
||||||
%{message}
|
|
||||||
|
|
||||||
---
|
|
||||||
Por favor visita este link para contestar: %{base_url}%{url}
|
|
||||||
|
|
||||||
forgot_password:
|
forgot_password:
|
||||||
subject_template: "[%{site_name}] Resetear el password"
|
subject_template: "[%{site_name}] Resetear el password"
|
||||||
text_body_template: |
|
text_body_template: |
|
||||||
|
@ -883,7 +883,7 @@ fr:
|
|||||||
Merci de suivre ce lien pour répondre : %{base_url}%{url}
|
Merci de suivre ce lien pour répondre : %{base_url}%{url}
|
||||||
|
|
||||||
user_posted:
|
user_posted:
|
||||||
subject_template: "[%{site_name}] nouveau message dans '%{topic_title}'"
|
subject_template: "[%{site_name}] %{subject_prefix}nouveau message dans '%{topic_title}'"
|
||||||
text_body_template: |
|
text_body_template: |
|
||||||
%{username} à répondu à '%{topic_title}' sur %{site_name}:
|
%{username} à répondu à '%{topic_title}' sur %{site_name}:
|
||||||
|
|
||||||
@ -902,17 +902,6 @@ fr:
|
|||||||
click_here: "cliquez ici"
|
click_here: "cliquez ici"
|
||||||
from: "Résumé de %{site_name}"
|
from: "Résumé de %{site_name}"
|
||||||
|
|
||||||
private_message:
|
|
||||||
subject_template: "[%{site_name}] %{subject_prefix}%{topic_title}"
|
|
||||||
text_body_template: |
|
|
||||||
%{from} vous a envoyé un message privé
|
|
||||||
|
|
||||||
---
|
|
||||||
%{message}
|
|
||||||
|
|
||||||
---
|
|
||||||
Merci de suivre ce lien pour répondre : %{base_url}%{url}
|
|
||||||
|
|
||||||
forgot_password:
|
forgot_password:
|
||||||
subject_template: "[%{site_name}] Réinitialisation du mot de passe"
|
subject_template: "[%{site_name}] Réinitialisation du mot de passe"
|
||||||
text_body_template: |
|
text_body_template: |
|
||||||
|
@ -711,7 +711,7 @@ id:
|
|||||||
Please visit this link to respond: %{base_url}%{url}
|
Please visit this link to respond: %{base_url}%{url}
|
||||||
|
|
||||||
user_posted:
|
user_posted:
|
||||||
subject_template: "[%{site_name}] %{username} posted in '%{topic_title}'"
|
subject_template: "[%{site_name}] %{subject_prefix}%{username} posted in '%{topic_title}'"
|
||||||
text_body_template: |
|
text_body_template: |
|
||||||
%{username} posted in '%{topic_title}' on %{site_name}:
|
%{username} posted in '%{topic_title}' on %{site_name}:
|
||||||
|
|
||||||
@ -730,17 +730,6 @@ id:
|
|||||||
click_here: "click here"
|
click_here: "click here"
|
||||||
from: "%{site_name} digest"
|
from: "%{site_name} digest"
|
||||||
|
|
||||||
private_message:
|
|
||||||
subject_template: "[%{site_name}] %{subject_prefix}%{topic_title}"
|
|
||||||
text_body_template: |
|
|
||||||
%{private_message_from} just sent you a private message
|
|
||||||
|
|
||||||
---
|
|
||||||
%{message}
|
|
||||||
|
|
||||||
---
|
|
||||||
Please visit this link to respond: %{base_url}%{url}
|
|
||||||
|
|
||||||
forgot_password:
|
forgot_password:
|
||||||
subject_template: "[%{site_name}] Password reset"
|
subject_template: "[%{site_name}] Password reset"
|
||||||
text_body_template: |
|
text_body_template: |
|
||||||
|
@ -840,7 +840,7 @@ it:
|
|||||||
Perfavore visita questo link per rispondere: %{base_url}%{url}
|
Perfavore visita questo link per rispondere: %{base_url}%{url}
|
||||||
|
|
||||||
user_posted:
|
user_posted:
|
||||||
subject_template: "[%{site_name}] %{username} ha postato in '%{topic_title}'"
|
subject_template: "[%{site_name}] %{subject_prefix}%{username} ha postato in '%{topic_title}'"
|
||||||
text_body_template: |
|
text_body_template: |
|
||||||
%{username} ha postato in '%{topic_title}' su %{site_name}:
|
%{username} ha postato in '%{topic_title}' su %{site_name}:
|
||||||
|
|
||||||
@ -859,17 +859,6 @@ it:
|
|||||||
click_here: "clicca qui"
|
click_here: "clicca qui"
|
||||||
from: "%{site_name} riepilogo"
|
from: "%{site_name} riepilogo"
|
||||||
|
|
||||||
private_message:
|
|
||||||
subject_template: "[%{site_name}] %{subject_prefix}%{topic_title}"
|
|
||||||
text_body_template: |
|
|
||||||
%{private_message_from} ti ha appena inviato un messaggio privato
|
|
||||||
|
|
||||||
---
|
|
||||||
%{message}
|
|
||||||
|
|
||||||
---
|
|
||||||
Perfavore visita questo link per rispondere: %{base_url}%{url}
|
|
||||||
|
|
||||||
forgot_password:
|
forgot_password:
|
||||||
subject_template: "[%{site_name}] Reset Password"
|
subject_template: "[%{site_name}] Reset Password"
|
||||||
text_body_template: |
|
text_body_template: |
|
||||||
|
@ -856,7 +856,7 @@ ko:
|
|||||||
Please visit this link to respond: %{base_url}%{url}
|
Please visit this link to respond: %{base_url}%{url}
|
||||||
|
|
||||||
user_posted:
|
user_posted:
|
||||||
subject_template: "[%{site_name}] %{username} posted in '%{topic_title}'"
|
subject_template: "[%{site_name}] %{subject_prefix}%{username} posted in '%{topic_title}'"
|
||||||
text_body_template: |
|
text_body_template: |
|
||||||
%{username} posted in '%{topic_title}' on %{site_name}:
|
%{username} posted in '%{topic_title}' on %{site_name}:
|
||||||
|
|
||||||
@ -875,17 +875,6 @@ ko:
|
|||||||
click_here: "click here"
|
click_here: "click here"
|
||||||
from: "%{site_name} digest"
|
from: "%{site_name} digest"
|
||||||
|
|
||||||
private_message:
|
|
||||||
subject_template: "[%{site_name}] %{subject_prefix}%{topic_title}"
|
|
||||||
text_body_template: |
|
|
||||||
%{private_message_from} just sent you a private message
|
|
||||||
|
|
||||||
---
|
|
||||||
%{message}
|
|
||||||
|
|
||||||
---
|
|
||||||
Please visit this link to respond: %{base_url}%{url}
|
|
||||||
|
|
||||||
forgot_password:
|
forgot_password:
|
||||||
subject_template: "[%{site_name}] Password reset"
|
subject_template: "[%{site_name}] Password reset"
|
||||||
text_body_template: |
|
text_body_template: |
|
||||||
|
@ -974,7 +974,7 @@ nl:
|
|||||||
%{respond_instructions}
|
%{respond_instructions}
|
||||||
|
|
||||||
user_posted:
|
user_posted:
|
||||||
subject_template: "[%{site_name}] %{username} nieuw bericht in '%{topic_title}'"
|
subject_template: "[%{site_name}] %{subject_prefix}%{username} nieuw bericht in '%{topic_title}'"
|
||||||
text_body_template: |
|
text_body_template: |
|
||||||
%{username} schreef een bericht in '%{topic_title}' op %{site_name}:
|
%{username} schreef een bericht in '%{topic_title}' op %{site_name}:
|
||||||
|
|
||||||
@ -994,17 +994,6 @@ nl:
|
|||||||
click_here: klik hier
|
click_here: klik hier
|
||||||
from: "%{site_name} Digest"
|
from: "%{site_name} Digest"
|
||||||
|
|
||||||
private_message:
|
|
||||||
subject_template: "[%{site_name}] %{subject_prefix}%{topic_title}"
|
|
||||||
text_body_template: |
|
|
||||||
%{from} heeft je net een privé-bericht gestuurd
|
|
||||||
|
|
||||||
---
|
|
||||||
%{message}
|
|
||||||
|
|
||||||
---
|
|
||||||
%{respond_instructions}
|
|
||||||
|
|
||||||
forgot_password:
|
forgot_password:
|
||||||
subject_template: "[%{site_name}] Wachtwoord herstellen"
|
subject_template: "[%{site_name}] Wachtwoord herstellen"
|
||||||
text_body_template: |
|
text_body_template: |
|
||||||
|
@ -1144,7 +1144,7 @@ pseudo:
|
|||||||
%{respond_instructions}
|
%{respond_instructions}
|
||||||
]]
|
]]
|
||||||
user_posted:
|
user_posted:
|
||||||
subject_template: '[[ [%{site_name}] %{username} ƿóšťéď íɳ ''%{topic_title}''
|
subject_template: '[[ [%{site_name}] %{subject_prefix}%{username} ƿóšťéď íɳ ''%{topic_title}''
|
||||||
]]'
|
]]'
|
||||||
text_body_template: |-
|
text_body_template: |-
|
||||||
[[ %{username} ƿóšťéď íɳ '%{topic_title}' óɳ %{site_name}:
|
[[ %{username} ƿóšťéď íɳ '%{topic_title}' óɳ %{site_name}:
|
||||||
@ -1167,17 +1167,7 @@ pseudo:
|
|||||||
click_here: '[[ čłíčǩ ĥéřé ]]'
|
click_here: '[[ čłíčǩ ĥéřé ]]'
|
||||||
from: '[[ %{site_name} ďíǧéšť ]]'
|
from: '[[ %{site_name} ďíǧéšť ]]'
|
||||||
read_more: '[[ Řéáď Ϻóřé ]]'
|
read_more: '[[ Řéáď Ϻóřé ]]'
|
||||||
private_message:
|
|
||||||
subject_template: '[[ [%{site_name}] %{subject_prefix}%{topic_title} ]]'
|
|
||||||
text_body_template: |-
|
|
||||||
[[ %{private_message_from} ʲůšť šéɳť ýóů á ƿříνáťé ɱéššáǧé
|
|
||||||
|
|
||||||
---
|
|
||||||
%{message}
|
|
||||||
|
|
||||||
---
|
|
||||||
%{respond_instructions}
|
|
||||||
]]
|
|
||||||
forgot_password:
|
forgot_password:
|
||||||
subject_template: '[[ [%{site_name}] Рáššŵóřď řéšéť ]]'
|
subject_template: '[[ [%{site_name}] Рáššŵóřď řéšéť ]]'
|
||||||
text_body_template: |-
|
text_body_template: |-
|
||||||
|
@ -622,7 +622,7 @@ pt:
|
|||||||
Por-favor visita este link para responder: %{base_url}%{url}
|
Por-favor visita este link para responder: %{base_url}%{url}
|
||||||
|
|
||||||
user_mentioned:
|
user_mentioned:
|
||||||
subject_template: "[%{site_name}] %{username} mencionou-te em '%{topic_title}'"
|
subject_template: "[%{site_name}] %{subject_prefix}%{username} mencionou-te em '%{topic_title}'"
|
||||||
text_body_template: |
|
text_body_template: |
|
||||||
%{username} mencionou-te em '%{topic_title}' em %{site_name}:
|
%{username} mencionou-te em '%{topic_title}' em %{site_name}:
|
||||||
|
|
||||||
@ -640,17 +640,6 @@ pt:
|
|||||||
new_topics: "Tópicos novos:"
|
new_topics: "Tópicos novos:"
|
||||||
unsubscribe: "Este email sumário é enviado como uma notificação de cortesia de %{site_link} quando não te vemos há de 7 dias.\nCaso quiseres desliga-lo ou alterar as configurações de email, %{unsubscribe_link}."
|
unsubscribe: "Este email sumário é enviado como uma notificação de cortesia de %{site_link} quando não te vemos há de 7 dias.\nCaso quiseres desliga-lo ou alterar as configurações de email, %{unsubscribe_link}."
|
||||||
|
|
||||||
private_message:
|
|
||||||
subject_template: "[%{site_name}] %{subject_prefix}%{topic_title}"
|
|
||||||
text_body_template: |
|
|
||||||
%{from} acabou de te enviar uma mensagem privada
|
|
||||||
|
|
||||||
---
|
|
||||||
%{message}
|
|
||||||
|
|
||||||
---
|
|
||||||
Por-favor vista este link para responder: %{base_url}%{url}
|
|
||||||
|
|
||||||
forgot_password:
|
forgot_password:
|
||||||
subject_template: "[%{site_name}] Repor password"
|
subject_template: "[%{site_name}] Repor password"
|
||||||
text_body_template: |
|
text_body_template: |
|
||||||
|
@ -865,7 +865,7 @@ pt_BR:
|
|||||||
---
|
---
|
||||||
%{respond_instructions}
|
%{respond_instructions}
|
||||||
user_posted:
|
user_posted:
|
||||||
subject_template: "[%{site_name}] nova postagem no tópico '%{topic_title}'"
|
subject_template: "[%{site_name}] %{subject_prefix}nova postagem no tópico '%{topic_title}'"
|
||||||
text_body_template: |
|
text_body_template: |
|
||||||
%{username} postou no tópico '%{topic_title}' de %{site_name}:
|
%{username} postou no tópico '%{topic_title}' de %{site_name}:
|
||||||
|
|
||||||
@ -883,16 +883,7 @@ pt_BR:
|
|||||||
click_here: "clique aqui"
|
click_here: "clique aqui"
|
||||||
from: "resumo de %{site_name}"
|
from: "resumo de %{site_name}"
|
||||||
read_more: "Leia Mais"
|
read_more: "Leia Mais"
|
||||||
private_message:
|
|
||||||
subject_template: "[%{site_name}] %{subject_prefix}%{topic_title}"
|
|
||||||
text_body_template: |
|
|
||||||
%{private_message_from} enviou uma mensagem particular para você
|
|
||||||
|
|
||||||
---
|
|
||||||
%{message}
|
|
||||||
|
|
||||||
---
|
|
||||||
%{respond_instructions}
|
|
||||||
forgot_password:
|
forgot_password:
|
||||||
subject_template: "[%{site_name}] Redefinição de senha"
|
subject_template: "[%{site_name}] Redefinição de senha"
|
||||||
text_body_template: |
|
text_body_template: |
|
||||||
|
@ -984,7 +984,7 @@ ru:
|
|||||||
%{respond_instructions}
|
%{respond_instructions}
|
||||||
|
|
||||||
user_posted:
|
user_posted:
|
||||||
subject_template: "[%{site_name}] новое сообщение в теме '%{topic_title}'"
|
subject_template: "[%{site_name}] %{subject_prefix}новое сообщение в теме '%{topic_title}'"
|
||||||
text_body_template: |
|
text_body_template: |
|
||||||
%{message}
|
%{message}
|
||||||
|
|
||||||
@ -1005,15 +1005,6 @@ ru:
|
|||||||
click_here: нажмите здесь
|
click_here: нажмите здесь
|
||||||
from: 'Cводка новостей сайта %{site_name}'
|
from: 'Cводка новостей сайта %{site_name}'
|
||||||
read_more: Читать еще
|
read_more: Читать еще
|
||||||
private_message:
|
|
||||||
subject_template: '[%{site_name}] %{subject_prefix}%{topic_title}'
|
|
||||||
text_body_template: |
|
|
||||||
%{private_message_from} отправил(а) вам личное сообщение
|
|
||||||
|
|
||||||
%{message}
|
|
||||||
|
|
||||||
---
|
|
||||||
%{respond_instructions}
|
|
||||||
|
|
||||||
forgot_password:
|
forgot_password:
|
||||||
subject_template: '[%{site_name}] Сброс пароля'
|
subject_template: '[%{site_name}] Сброс пароля'
|
||||||
|
@ -769,7 +769,7 @@ sv:
|
|||||||
Please visit this link to respond: %{base_url}%{url}
|
Please visit this link to respond: %{base_url}%{url}
|
||||||
|
|
||||||
user_posted:
|
user_posted:
|
||||||
subject_template: "[%{site_name}] %{username} posted in '%{topic_title}'"
|
subject_template: "[%{site_name}] %{subject_prefix}%{username} posted in '%{topic_title}'"
|
||||||
text_body_template: |
|
text_body_template: |
|
||||||
%{username} posted in '%{topic_title}' on %{site_name}:
|
%{username} posted in '%{topic_title}' on %{site_name}:
|
||||||
|
|
||||||
@ -788,17 +788,6 @@ sv:
|
|||||||
click_here: "click here"
|
click_here: "click here"
|
||||||
from: "%{site_name} digest"
|
from: "%{site_name} digest"
|
||||||
|
|
||||||
private_message:
|
|
||||||
subject_template: "[%{site_name}] %{subject_prefix}%{topic_title}"
|
|
||||||
text_body_template: |
|
|
||||||
%{private_message_from} just sent you a private message
|
|
||||||
|
|
||||||
---
|
|
||||||
%{message}
|
|
||||||
|
|
||||||
---
|
|
||||||
Please visit this link to respond: %{base_url}%{url}
|
|
||||||
|
|
||||||
forgot_password:
|
forgot_password:
|
||||||
subject_template: "[%{site_name}] Password reset"
|
subject_template: "[%{site_name}] Password reset"
|
||||||
text_body_template: |
|
text_body_template: |
|
||||||
|
@ -857,7 +857,7 @@ zh_CN:
|
|||||||
请访问 %{base_url}%{url} 来回复。
|
请访问 %{base_url}%{url} 来回复。
|
||||||
|
|
||||||
user_posted:
|
user_posted:
|
||||||
subject_template: "[%{site_name}] %{username} 在 '%{topic_title}' 主题发表了帖子"
|
subject_template: "[%{site_name}] %{subject_prefix}%{username} 在 '%{topic_title}' 主题发表了帖子"
|
||||||
text_body_template: |
|
text_body_template: |
|
||||||
%{username} 在 %{site_name} 的 '%{topic_title}' 主题中发表了帖子:
|
%{username} 在 %{site_name} 的 '%{topic_title}' 主题中发表了帖子:
|
||||||
|
|
||||||
@ -876,17 +876,6 @@ zh_CN:
|
|||||||
click_here: "点击此处"
|
click_here: "点击此处"
|
||||||
from: "%{site_name} 摘要"
|
from: "%{site_name} 摘要"
|
||||||
|
|
||||||
private_message:
|
|
||||||
subject_template: "[%{site_name}] %{subject_prefix}%{topic_title}"
|
|
||||||
text_body_template: |
|
|
||||||
%{private_message_from} 刚刚发送了一条私信给你
|
|
||||||
|
|
||||||
---
|
|
||||||
%{message}
|
|
||||||
|
|
||||||
---
|
|
||||||
请访问 %{base_url}%{url} 来回复。
|
|
||||||
|
|
||||||
forgot_password:
|
forgot_password:
|
||||||
subject_template: "[%{site_name}] 密码重置"
|
subject_template: "[%{site_name}] 密码重置"
|
||||||
text_body_template: |
|
text_body_template: |
|
||||||
|
@ -840,7 +840,7 @@ zh_TW:
|
|||||||
請訪問 %{base_url}%{url} 來回複。
|
請訪問 %{base_url}%{url} 來回複。
|
||||||
|
|
||||||
user_posted:
|
user_posted:
|
||||||
subject_template: "[%{site_name}] %{username} 在 '%{topic_title}' 主題發表了帖子"
|
subject_template: "[%{site_name}] %{subject_prefix}%{username} 在 '%{topic_title}' 主題發表了帖子"
|
||||||
text_body_template: |
|
text_body_template: |
|
||||||
%{username} 在 %{site_name} 的 '%{topic_title}' 主題中發表了帖子:
|
%{username} 在 %{site_name} 的 '%{topic_title}' 主題中發表了帖子:
|
||||||
|
|
||||||
@ -859,17 +859,6 @@ zh_TW:
|
|||||||
click_here: "點擊此處"
|
click_here: "點擊此處"
|
||||||
from: "%{site_name} 摘要"
|
from: "%{site_name} 摘要"
|
||||||
|
|
||||||
private_message:
|
|
||||||
subject_template: "[%{site_name}] %{subject_prefix}%{topic_title}"
|
|
||||||
text_body_template: |
|
|
||||||
%{private_message_from} 剛剛發送了一條私信給你
|
|
||||||
|
|
||||||
---
|
|
||||||
%{message}
|
|
||||||
|
|
||||||
---
|
|
||||||
請訪問 %{base_url}%{url} 來回複。
|
|
||||||
|
|
||||||
forgot_password:
|
forgot_password:
|
||||||
subject_template: "[%{site_name}] 密碼重置"
|
subject_template: "[%{site_name}] 密碼重置"
|
||||||
text_body_template: |
|
text_body_template: |
|
||||||
|
@ -64,7 +64,7 @@ class PostCreator
|
|||||||
save_post
|
save_post
|
||||||
extract_links
|
extract_links
|
||||||
store_unique_post_key
|
store_unique_post_key
|
||||||
send_notifications_for_private_message
|
consider_clearing_flags
|
||||||
track_topic
|
track_topic
|
||||||
update_topic_stats
|
update_topic_stats
|
||||||
update_user_counts
|
update_user_counts
|
||||||
@ -216,19 +216,9 @@ class PostCreator
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def send_notifications_for_private_message
|
def consider_clearing_flags
|
||||||
# send a mail to notify users in case of a private message
|
if @topic.private_message? && @post.post_number > 1 && @topic.user_id != @post.user_id
|
||||||
if @topic.private_message?
|
clear_possible_flags(@topic)
|
||||||
@topic.allowed_users.where(["users.email_private_messages = true and users.id != ?", @user.id]).each do |u|
|
|
||||||
Jobs.enqueue_in(SiteSetting.email_time_window_mins.minutes,
|
|
||||||
:user_email,
|
|
||||||
type: :private_message,
|
|
||||||
user_id: u.id,
|
|
||||||
post_id: @post.id
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
clear_possible_flags(@topic) if @post.post_number > 1 && @topic.user_id != @post.user_id
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -303,29 +303,6 @@ describe Topic do
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context "other user" do
|
|
||||||
|
|
||||||
before do
|
|
||||||
# let! is weird, this test need a refactor
|
|
||||||
t = topic
|
|
||||||
end
|
|
||||||
|
|
||||||
let(:creator) { PostCreator.new(topic.user, raw: Fabricate.build(:post).raw, topic_id: topic.id )}
|
|
||||||
|
|
||||||
it "sends the other user an email when there's a new post" do
|
|
||||||
UserNotifications.expects(:private_message).with(coding_horror, has_key(:post))
|
|
||||||
creator.create
|
|
||||||
end
|
|
||||||
|
|
||||||
it "doesn't send the user an email when they have them disabled" do
|
|
||||||
coding_horror.update_column(:email_private_messages, false)
|
|
||||||
UserNotifications.expects(:private_message).with(coding_horror, has_key(:post)).never
|
|
||||||
creator.create
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user