added post author to the subject of the also commented email as well as the notification
This commit is contained in:
parent
97e00f9ee3
commit
e106ec6a79
2 changed files with 14 additions and 11 deletions
|
|
@ -1,37 +1,40 @@
|
||||||
module NotificationsHelper
|
module NotificationsHelper
|
||||||
def object_link(note)
|
def object_link(note)
|
||||||
target_type = note.action
|
target_type = note.action
|
||||||
translation = t("notifications.#{target_type}")
|
|
||||||
case target_type
|
case target_type
|
||||||
when 'mentioned'
|
when 'mentioned'
|
||||||
post = Mention.find(note.target_id).post
|
post = Mention.find(note.target_id).post
|
||||||
if post
|
if post
|
||||||
"#{translation} #{link_to t('notifications.post'), object_path(post)}".html_safe
|
"#{translation(target_type)} #{link_to t('notifications.post'), object_path(post)}".html_safe
|
||||||
else
|
else
|
||||||
"#{translation} #{t('notifications.deleted')} #{t('notifications.post')}"
|
"#{translation(target_type)} #{t('notifications.deleted')} #{t('notifications.post')}"
|
||||||
end
|
end
|
||||||
when 'request_accepted'
|
when 'request_accepted'
|
||||||
translation
|
translation(target_type)
|
||||||
when 'new_request'
|
when 'new_request'
|
||||||
translation
|
translation(target_type)
|
||||||
when 'comment_on_post'
|
when 'comment_on_post'
|
||||||
post = Post.where(:id => note.target_id).first
|
post = Post.where(:id => note.target_id).first
|
||||||
if post
|
if post
|
||||||
"#{translation} #{link_to t('notifications.post'), object_path(post)}".html_safe
|
"#{translation(target_type)} #{link_to t('notifications.post'), object_path(post)}".html_safe
|
||||||
else
|
else
|
||||||
"#{translation} #{t('notifications.deleted')} #{t('notifications.post')}"
|
"#{translation(target_type)} #{t('notifications.deleted')} #{t('notifications.post')}"
|
||||||
end
|
end
|
||||||
when 'also_commented'
|
when 'also_commented'
|
||||||
post = Post.where(:id => note.target_id).first
|
post = Post.where(:id => note.target_id).first
|
||||||
if post
|
if post
|
||||||
"#{translation} #{link_to t('notifications.post'), object_path(post)}".html_safe
|
"#{translation(target_type, post.person.name)} #{link_to t('notifications.post'), object_path(post)}".html_safe
|
||||||
else
|
else
|
||||||
"#{translation} #{t('notifications.deleted')} #{t('notifications.post')}"
|
"#{translation(target_type, post.person.name)} #{t('notifications.deleted')} #{t('notifications.post')}"
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def translation(target_type, post_author = nil)
|
||||||
|
t("notifications.#{target_type}", :post_author => post_author)
|
||||||
|
end
|
||||||
|
|
||||||
def new_notification_text(count)
|
def new_notification_text(count)
|
||||||
if count > 0
|
if count > 0
|
||||||
t('new_notifications', :count => count)
|
t('new_notifications', :count => count)
|
||||||
|
|
|
||||||
|
|
@ -223,7 +223,7 @@ en:
|
||||||
request_accepted: "accepted your share request."
|
request_accepted: "accepted your share request."
|
||||||
new_request: "offered to share with you."
|
new_request: "offered to share with you."
|
||||||
comment_on_post: "commented on your"
|
comment_on_post: "commented on your"
|
||||||
also_commented: "also commented on your contact's"
|
also_commented: "also commented on %{post_author}'s"
|
||||||
mentioned: "has mentioned you in their"
|
mentioned: "has mentioned you in their"
|
||||||
post: "post"
|
post: "post"
|
||||||
deleted: "deleted"
|
deleted: "deleted"
|
||||||
|
|
@ -479,7 +479,7 @@ en:
|
||||||
commented: "has commented on your post:"
|
commented: "has commented on your post:"
|
||||||
sign_in: "Sign in to view it."
|
sign_in: "Sign in to view it."
|
||||||
also_commented:
|
also_commented:
|
||||||
subject: "%{name} has also commented on your contact's post."
|
subject: "%{name} has also commented on your %{post_author}'s post."
|
||||||
commented: "has also commented on %{post_author}'s post:"
|
commented: "has also commented on %{post_author}'s post:"
|
||||||
sign_in: "Sign in to view it."
|
sign_in: "Sign in to view it."
|
||||||
mentioned:
|
mentioned:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue