diff --git a/app/helpers/markdownify_helper.rb b/app/helpers/markdownify_helper.rb
index 8131de113..ab8ff40f0 100644
--- a/app/helpers/markdownify_helper.rb
+++ b/app/helpers/markdownify_helper.rb
@@ -15,9 +15,13 @@ module MarkdownifyHelper
message = process_youtube(message, options[:youtube_maps])
message = process_vimeo(message, options[:vimeo_maps])
message = process_emoticons(message) if options[:emoticons]
+ message = process_newlines(message) if options[:newlines]
- message.gsub!(/\n+/, '
') if options[:newlines]
+ message
+ end
+ def process_newlines(message)
+ message.gsub!(/\n+/, '
')
message
end
diff --git a/app/mailers/notifier.rb b/app/mailers/notifier.rb
index c7b10bcf3..99d9e2b1e 100644
--- a/app/mailers/notifier.rb
+++ b/app/mailers/notifier.rb
@@ -1,8 +1,12 @@
class Notifier < ActionMailer::Base
helper :application
+ helper :markdownify
+
default :from => AppConfig[:smtp_sender_address]
- ATTACHMENT = File.read("#{Rails.root}/public/images/logo_caps.png")
+ include ActionView::Helpers::TextHelper
+
+ TRUNCATION_LEN = 70
def self.admin(string, recipients, opts = {})
mails = []
@@ -16,7 +20,6 @@ class Notifier < ActionMailer::Base
def single_admin(string, recipient)
@receiver = recipient
@string = string.html_safe
- attachments.inline['logo_caps.png'] = ATTACHMENT
mail(:to => @receiver.email,
:subject => I18n.t('notifier.single_admin.subject'), :host => AppConfig[:pod_uri].host)
end
@@ -27,8 +30,6 @@ class Notifier < ActionMailer::Base
log_mail(recipient_id, sender_id, 'started_sharing')
- attachments.inline['logo_caps.png'] = ATTACHMENT
-
I18n.with_locale(@receiver.language) do
mail(:to => "\"#{@receiver.name}\" <#{@receiver.email}>",
:subject => I18n.t('notifier.started_sharing.subject', :name => @sender.name), :host => AppConfig[:pod_uri].host)
@@ -42,23 +43,19 @@ class Notifier < ActionMailer::Base
log_mail(recipient_id, sender_id, 'liked')
- attachments.inline['logo_caps.png'] = ATTACHMENT
-
I18n.with_locale(@receiver.language) do
mail(:to => "\"#{@receiver.name}\" <#{@receiver.email}>",
- :subject => I18n.t('notifier.liked.subject', :name => @sender.name), :host => AppConfig[:pod_uri].host)
+ :subject => I18n.t('notifier.liked.liked', :name => @sender.name), :host => AppConfig[:pod_uri].host)
end
end
def mentioned(recipient_id, sender_id, target_id)
@receiver = User.find_by_id(recipient_id)
- @sender = Person.find_by_id(sender_id)
- @post = Mention.find_by_id(target_id).post
+ @sender = Person.find_by_id(sender_id)
+ @post = Mention.find_by_id(target_id).post
log_mail(recipient_id, sender_id, 'mentioned')
- attachments.inline['logo_caps.png'] = ATTACHMENT
-
I18n.with_locale(@receiver.language) do
mail(:to => "\"#{@receiver.name}\" <#{@receiver.email}>",
:subject => I18n.t('notifier.mentioned.subject', :name => @sender.name), :host => AppConfig[:pod_uri].host)
@@ -72,11 +69,10 @@ class Notifier < ActionMailer::Base
log_mail(recipient_id, sender_id, 'comment_on_post')
- attachments.inline['logo_caps.png'] = ATTACHMENT
-
I18n.with_locale(@receiver.language) do
- mail(:to => "\"#{@receiver.name}\" <#{@receiver.email}>",
- :subject => I18n.t('notifier.comment_on_post.subject', :name => @sender.name), :host => AppConfig[:pod_uri].host)
+ mail(:from => "\"#{@sender.name} (Diaspora)\" <#{AppConfig[:smtp_sender_address]}>",
+ :to => "\"#{@receiver.name}\" <#{@receiver.email}>",
+ :subject => "Re: #{truncate(@comment.parent.formatted_message(:plain_text => true).strip, :length => TRUNCATION_LEN)}")
end
end
@@ -89,11 +85,10 @@ class Notifier < ActionMailer::Base
log_mail(recipient_id, sender_id, 'comment_on_post')
- attachments.inline['logo_caps.png'] = ATTACHMENT
-
I18n.with_locale(@receiver.language) do
- mail(:to => "\"#{@receiver.name}\" <#{@receiver.email}>",
- :subject => I18n.t('notifier.also_commented.subject', :name => @sender.name, :post_author => @post_author_name ), :host => AppConfig[:pod_uri].host)
+ mail(:from => "\"#{@sender.name} (Diaspora)\" <#{AppConfig[:smtp_sender_address]}>",
+ :to => "\"#{@receiver.name}\" <#{@receiver.email}>",
+ :subject => "Re: #{truncate(@comment.parent.formatted_message(:plain_text => true).strip, :length => TRUNCATION_LEN)}")
end
end
@@ -107,11 +102,14 @@ class Notifier < ActionMailer::Base
log_mail(recipient_id, sender_id, 'private_message')
- attachments.inline['logo_caps.png'] = ATTACHMENT
+ subject = @conversation.subject.strip
+ subject = "Re: #{subject}" if @conversation.messages.size > 1
+
I18n.with_locale(@receiver.language) do
- mail(:to => "\"#{@receiver.name}\" <#{@receiver.email}>",
- :subject => I18n.t('notifier.private_message.subject', :name => @sender.name), :host => AppConfig[:pod_uri].host)
+ mail(:from => "\"#{@sender.name} (Diaspora)\" <#{AppConfig[:smtp_sender_address]}>",
+ :to => "\"#{@receiver.name}\" <#{@receiver.email}>",
+ :subject => subject)
end
end
diff --git a/app/views/layouts/notifier.html.erb b/app/views/layouts/notifier.html.erb
new file mode 100644
index 000000000..762f1032d
--- /dev/null
+++ b/app/views/layouts/notifier.html.erb
@@ -0,0 +1,36 @@
+
+
+
+ <% if @sender %>
+
+
+ %>)
+
+ |
+ <% end %>
+
+ <%= yield %>
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
diff --git a/app/views/layouts/notifier.html.haml b/app/views/layouts/notifier.html.haml
deleted file mode 100644
index 51ad81af3..000000000
--- a/app/views/layouts/notifier.html.haml
+++ /dev/null
@@ -1,12 +0,0 @@
-!!!
-%html
- %head
- %meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}/
- = render :partial => 'notifier_css'
- %body
- %header
- = image_tag attachments['logo_caps.png'].url, :alt => "DIASPORA"
- #container
- = yield
- %a{:href => "#{AppConfig[:pod_uri].scheme}://#{AppConfig[:pod_uri].host}#{edit_user_path}"}
- = t('notifier.manage_your_email_settings')
diff --git a/app/views/layouts/notifier.text.haml b/app/views/layouts/notifier.text.haml
index 5321fe644..88e0f4918 100644
--- a/app/views/layouts/notifier.text.haml
+++ b/app/views/layouts/notifier.text.haml
@@ -1,3 +1,4 @@
!= yield
-!= t('notifier.manage_your_email_settings')
-!= "#{AppConfig[:pod_uri].scheme}://#{AppConfig[:pod_uri].host}#{edit_user_path}"
+!= t('notifier.email_sent_by_diaspora')
+!= t('notifier.to_change_your_notification_settings')
+!= edit_user_url
diff --git a/app/views/notifier/_notifier_css.haml b/app/views/notifier/_notifier_css.haml
index d75c9003a..4ca518b2d 100644
--- a/app/views/notifier/_notifier_css.haml
+++ b/app/views/notifier/_notifier_css.haml
@@ -1,14 +1,9 @@
:css
body{
width:600px;
- font-family:'Arial','Helvetica',sans-serif;
- font-size:14px;
- color:#333;
+ font-family: 'Helvetica',sans-serif;
}
#container{
- margin-bottom:25px
- min-height:400px;
- padding-left:15px;
}
header{
margin-bottom: 25px;
@@ -31,7 +26,3 @@
a:active{
color: #005D9C;
}
- .large_text{
- font-size:21px;
- font-family:"Helvetica Neue",Arial,Helvetica,sans-serif;
- }
diff --git a/app/views/notifier/also_commented.html.haml b/app/views/notifier/also_commented.html.haml
index c65f0bccf..680f0f5f8 100644
--- a/app/views/notifier/also_commented.html.haml
+++ b/app/views/notifier/also_commented.html.haml
@@ -1,17 +1,4 @@
%p
- = t('notifier.hello', :name => @receiver.profile.first_name)
+ = process_newlines(truncate(@comment.text, :length => 600))
%p
- = "#{@sender.name} (#{@sender.diaspora_handle})"
- = t('.commented', :post_author => @post_author_name)
- %br
- %br
- = @comment.text
-
- %br
- %br
- = link_to t('.sign_in'), post_url(@comment.post)
-
- %br
- = t('notifier.love')
- %br
- = t('notifier.diaspora')
+ = link_to t('notifier.comment_on_post.reply', :name => @comment.post.author.first_name), post_url(@comment.post)
diff --git a/app/views/notifier/also_commented.text.haml b/app/views/notifier/also_commented.text.haml
index 58d304bb3..cbb52570a 100644
--- a/app/views/notifier/also_commented.text.haml
+++ b/app/views/notifier/also_commented.text.haml
@@ -1,8 +1 @@
-!= t('notifier.hello', :name => @receiver.profile.first_name)
-!= "#{@sender.name} (#{@sender.diaspora_handle})"
-!= t('notifier.also_commented.commented', :post_author => @post_author_name)
-
-!= @comment.text
-
-!= "#{t('notifier.love')} \n"
-!= t('notifier.diaspora')
+!= truncate(@comment.text, :length => 600)
diff --git a/app/views/notifier/comment_on_post.html.haml b/app/views/notifier/comment_on_post.html.haml
index 47049b8bb..080957f75 100644
--- a/app/views/notifier/comment_on_post.html.haml
+++ b/app/views/notifier/comment_on_post.html.haml
@@ -1,15 +1,4 @@
%p
- = t('notifier.hello', :name => @receiver.profile.first_name)
+ = process_newlines(truncate(@comment.text, :length => 600))
%p
- = "#{@sender.name} (#{@sender.diaspora_handle})"
- = t('.commented')
-
- = @comment.text
-
- %br
- = link_to t('.sign_in'), post_url(@comment.post)
-
- %br
- = t('notifier.love')
- %br
- = t('notifier.diaspora')
+ = link_to t('notifier.comment_on_post.reply', :name => @comment.post.author.name), post_url(@comment.post)
diff --git a/app/views/notifier/comment_on_post.text.haml b/app/views/notifier/comment_on_post.text.haml
index ccfedab8e..cbb52570a 100644
--- a/app/views/notifier/comment_on_post.text.haml
+++ b/app/views/notifier/comment_on_post.text.haml
@@ -1,10 +1 @@
-!= t('notifier.hello', :name => @receiver.profile.first_name)
-!= "#{@sender.name} (#{@sender.diaspora_handle})"
-!= t('notifier.comment_on_post.commented')
-
-!= @comment.text
-
-!= post_url(@comment.post)
-
-!= "#{t('notifier.love')} \n"
-!= t('notifier.diaspora')
+!= truncate(@comment.text, :length => 600)
diff --git a/app/views/notifier/liked.html.haml b/app/views/notifier/liked.html.haml
index 6cf23d193..af6988fdd 100644
--- a/app/views/notifier/liked.html.haml
+++ b/app/views/notifier/liked.html.haml
@@ -1,15 +1,8 @@
%p
- = t('notifier.hello', :name => @receiver.profile.first_name)
-%p
- = t('.liked', :name => "#{@sender.name} (#{@sender.diaspora_handle})")
+ = "#{t('.liked', :name => "#{@sender.name}")}:"
+
+%p{:style => "font-style:italic;color:#666"}
+ = process_newlines(truncate(@like.target.formatted_message(:plain_text => true), :length => 200))
%p
- = @like.target.formatted_message(:plain_text => true)
-%p
-
- %br
- = link_to t('.sign_in'), post_url(@like.target)
- %br
- = t('notifier.love')
- %br
- = t('notifier.diaspora')
+ = link_to t('.view_post'), post_url(@like.target)
diff --git a/app/views/notifier/liked.text.haml b/app/views/notifier/liked.text.haml
index 9cc0740a6..c2a05ba40 100644
--- a/app/views/notifier/liked.text.haml
+++ b/app/views/notifier/liked.text.haml
@@ -1,8 +1,3 @@
-!= t('notifier.hello', :name => @receiver.profile.first_name)
+!= "#{t('notifier.liked.liked', :name => "#{@sender.name}")}:"
+!= truncate(@like.target.formatted_message(:plain_text => true), :length => 200)
-!= t('notifier.liked.liked', :name => "#{@sender.name} (#{@sender.diaspora_handle})")
-
-!= @like.target.formatted_message(:plain_text => true)
-
-!= t('notifier.love')
-!= t('notifier.diaspora')
diff --git a/app/views/notifier/mentioned.html.haml b/app/views/notifier/mentioned.html.haml
index 6751e62fc..8844eb002 100644
--- a/app/views/notifier/mentioned.html.haml
+++ b/app/views/notifier/mentioned.html.haml
@@ -1,16 +1,4 @@
%p
- = t('notifier.hello', :name => @receiver.profile.first_name)
+ = process_newlines(truncate(@post.formatted_message(:plain_text => true), :length => 600))
%p
- = "#{@sender.name} (#{@sender.diaspora_handle})"
- = t('.mentioned')
-%p
- = @post.formatted_message(:plain_text => true)
-%p
-
- %br
- = link_to t('.sign_in'), post_url(@post)
-
- %br
- = t('notifier.love')
- %br
- = t('notifier.diaspora')
+ = link_to t('notifier.comment_on_post.reply', :name => @post.author.name), post_url(@post)
diff --git a/app/views/notifier/mentioned.text.haml b/app/views/notifier/mentioned.text.haml
index 86cdce64f..1b2323c4a 100644
--- a/app/views/notifier/mentioned.text.haml
+++ b/app/views/notifier/mentioned.text.haml
@@ -1,8 +1 @@
-!= t('notifier.hello', :name => @receiver.profile.first_name)
-!= "#{@sender.name} (#{@sender.diaspora_handle})"
-!= t('notifier.mentioned.mentioned')
-
!= @post.formatted_message(:plain_text => true)
-
-!= "#{t('notifier.love')} \n"
-!= t('notifier.diaspora')
diff --git a/app/views/notifier/private_message.html.haml b/app/views/notifier/private_message.html.haml
index e793779dd..9e808b449 100644
--- a/app/views/notifier/private_message.html.haml
+++ b/app/views/notifier/private_message.html.haml
@@ -1,18 +1,4 @@
%p
- = t('notifier.hello', :name => @receiver.profile.first_name)
+ = markdownify(@message.text)
%p
- = "#{@sender.name} (#{@sender.diaspora_handle})"
- = t('.private_message')
-%p
- = t('.message_subject', :subject => @conversation.subject)
-%p
- = @message.text
-%p
-
- %br
- = link_to t('.sign_in'), conversations_url(:conversation_id => @conversation)
-
- %br
- = t('notifier.love')
- %br
- = t('notifier.diaspora')
+ = link_to t('.reply_to_or_view'), conversations_url(:conversation_id => @conversation)
diff --git a/app/views/notifier/private_message.text.haml b/app/views/notifier/private_message.text.haml
index 9819a2ade..98bb94557 100644
--- a/app/views/notifier/private_message.text.haml
+++ b/app/views/notifier/private_message.text.haml
@@ -1,9 +1 @@
-!= t('notifier.hello', :name => @receiver.profile.first_name)
-!= "#{@sender.name} (#{@sender.diaspora_handle})"
-!= t('notifier.private_message.private_message')
-
-!= t('notifier.private_message.message_subject', :subject => @conversation.subject)
!= @message.text
-
-!= "#{t('notifier.love')} \n"
-!= t('notifier.diaspora')
diff --git a/app/views/notifier/started_sharing.html.haml b/app/views/notifier/started_sharing.html.haml
index 0b34089f4..d57693356 100644
--- a/app/views/notifier/started_sharing.html.haml
+++ b/app/views/notifier/started_sharing.html.haml
@@ -1,12 +1,5 @@
%p
- = t('notifier.hello', :name => @receiver.profile.first_name)
-%p
- = "#{@sender.name} (#{@sender.diaspora_handle})"
+ = @sender.name
= t('.sharing')
-
- %br
- = link_to t('.sign_in'), new_user_session_url
- %br
- = t('notifier.love')
- %br
- = t('notifier.diaspora')
+%p
+ = link_to t('.view_profile', :name => @sender.first_name), person_url(@sender)
diff --git a/app/views/notifier/started_sharing.text.haml b/app/views/notifier/started_sharing.text.haml
index c848e3a74..b188dfebe 100644
--- a/app/views/notifier/started_sharing.text.haml
+++ b/app/views/notifier/started_sharing.text.haml
@@ -1,8 +1,4 @@
-!= t('notifier.hello', :name => @receiver.profile.first_name)
-!= "#{@sender.name} (#{@sender.diaspora_handle})"
+!= "#{@sender.name}"
!= t('notifier.started_sharing.sharing')
-
-!= t('.sign_in')
-!= new_user_session_url
-!= "#{t('notifier.love')} \n"
-!= t('notifier.diaspora')
+!= t('.view_profile', :name => @sender.first_name)
+!= person_url(@sender)
diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml
index 35a650d59..fc6238b18 100644
--- a/config/locales/diaspora/en.yml
+++ b/config/locales/diaspora/en.yml
@@ -397,39 +397,28 @@ en:
other: "%{count} new notifications"
notifier:
+ email_sent_by_diaspora: "This email was sent by Diaspora. If you'd like to stop getting emails like this,"
+ click_here: "click here"
hello: "Hello %{name}!"
- love: "love,"
thanks: "Thanks,"
- diaspora: "the diaspora email robot"
- manage_your_email_settings: "manage your email settings"
+ to_change_your_notification_settings: "to change your notification settings"
single_admin:
subject: "A message about your Diaspora account:"
admin: "Your Diaspora administrator"
started_sharing:
- subject: "%{name} has started sharing with you on Diaspora*"
+ subject: "%{name} started sharing with you on Diaspora*"
sharing: "has started sharing with you!"
- sign_in: "Sign in here"
+ view_profile: "View %{name}'s profile"
comment_on_post:
- subject: "%{name} has commented on your post."
- commented: "has commented on your post:"
- sign_in: "Sign in to view it."
- also_commented:
- subject: "%{name} has also commented on %{post_author}'s post."
- commented: "has also commented on %{post_author}'s post:"
- sign_in: "Sign in to view it."
+ reply: "Reply or view %{name}'s post >"
mentioned:
subject: "%{name} has mentioned you on Diaspora*"
mentioned: "mentioned you in a post:"
- sign_in: "Sign in to view it."
private_message:
- subject: "%{name} has sent you a private message on Diaspora*"
- private_message: "has sent you a private message:"
- message_subject: "Subject: %{subject}"
- sign_in: "Sign in to view it."
+ reply_to_or_view: "Reply to or view this conversation >"
liked:
- subject: "%{name} has just liked your post"
- liked: "%{name} has just liked your post: "
- sign_in: "Sign in to view it"
+ liked: "%{name} just liked your post:"
+ view_post: "View post >"
people:
zero: "no people"
diff --git a/spec/mailers/notifier_spec.rb b/spec/mailers/notifier_spec.rb
index 1eeb068ab..f585b7841 100644
--- a/spec/mailers/notifier_spec.rb
+++ b/spec/mailers/notifier_spec.rb
@@ -1,7 +1,8 @@
-
require 'spec_helper'
describe Notifier do
+ include ActionView::Helpers::TextHelper
+
let!(:user) {alice}
let!(:user2) {eve}
@@ -47,7 +48,7 @@ describe Notifier do
it 'has the layout' do
mail = Notifier.single_admin("Welcome to bureaucracy!", user)
- mail.body.encoded.should match /manage your email settings/
+ mail.body.encoded.should match /change your notification settings/
end
end
@@ -57,10 +58,6 @@ describe Notifier do
request_mail.to.should == [user.email]
end
- it 'has the receivers name in the body' do
- request_mail.body.encoded.include?(user.person.profile.first_name).should be true
- end
-
it 'has the name of person sending the request' do
request_mail.body.encoded.include?(person.name).should be true
end
@@ -73,21 +70,18 @@ describe Notifier do
describe ".mentioned" do
before do
@user = alice
- @sm = Factory(:status_message)
- @m = Mention.create(:person => @user.person, :post=> @sm)
+ @sm = Factory(:status_message)
+ @m = Mention.create(:person => @user.person, :post=> @sm)
@mail = Notifier.mentioned(@user.id, @sm.author.id, @m.id)
end
- it 'goes to the right person' do
+
+ it 'TO: goes to the right person' do
@mail.to.should == [@user.email]
end
- it 'has the receivers name in the body' do
- @mail.body.encoded.include?(@user.person.profile.first_name).should be_true
- end
-
- it 'has the name of person mentioning in the body' do
- @mail.body.encoded.include?(@sm.author.name).should be_true
+ it 'SUBJECT: has the name of person mentioning in the subject' do
+ @mail.subject.should include(@sm.author.name)
end
it 'has the post text in the body' do
@@ -106,16 +100,16 @@ describe Notifier do
@mail = Notifier.liked(alice.id, @like.author.id, @like.id)
end
- it 'goes to the right person' do
+ it 'TO: goes to the right person' do
@mail.to.should == [alice.email]
end
- it 'has the receivers name in the body' do
- @mail.body.encoded.include?(alice.person.profile.first_name).should be true
+ it 'BODY: contains the truncated original post' do
+ @mail.body.encoded.should include(@sm.formatted_message)
end
- it 'has the name of person liking in the body' do
- @mail.body.encoded.include?(@like.author.name).should be_true
+ it 'BODY: contains the name of person liking' do
+ @mail.body.encoded.should include(@like.author.name)
end
it 'should not include translation missing' do
@@ -135,23 +129,28 @@ describe Notifier do
@mail = Notifier.private_message(user.id, @cnv.author.id, @cnv.messages.first.id)
end
- it 'goes to the right person' do
+
+ it 'TO: goes to the right person' do
@mail.to.should == [user.email]
end
- it 'has the recipients in the body' do
- @mail.body.encoded.include?(user.person.first_name).should be true
+ it "FROM: contains the sender's name" do
+ pending
+ @mail.from.should == "\"#{person.name} (Diaspora)\" <#{AppConfig[:smtp_sender_address]}>"
end
- it 'has the name of the sender in the body' do
- @mail.body.encoded.include?(@cnv.author.name).should be true
+ it 'SUBJECT: has a snippet of the post contents' do
+ @mail.subject.should == @cnv.subject
end
- it 'has the conversation subject in the body' do
- @mail.body.encoded.should include(@cnv.subject)
+ it 'SUBJECT: has "Re:" if not the first message in a conversation' do
+ @cnv.messages << Message.new(:text => 'yo', :author => eve.person)
+ @mail = Notifier.private_message(user.id, @cnv.author.id, @cnv.messages.last.id)
+
+ @mail.subject.should == "Re: #{@cnv.subject}"
end
- it 'has the post text in the body' do
+ it 'BODY: contains the message text' do
@mail.body.encoded.should include(@cnv.messages.first.text)
end
@@ -162,50 +161,61 @@ describe Notifier do
context "comments" do
let!(:connect) { connect_users(user, aspect, user2, aspect2)}
- let!(:sm) {user.post(:status_message, :text => "Sunny outside", :to => :all)}
+ let!(:sm) {user.post(:status_message, :text => "It's really sunny outside today, and this is a super long status message! #notreally", :to => :all)}
let!(:comment) { user2.comment("Totally is", :post => sm )}
- describe ".comment_on_post" do
+ describe ".comment_on_post" do
let!(:comment_mail) {Notifier.comment_on_post(user.id, person.id, comment.id).deliver}
- it 'goes to the right person' do
+ it 'TO: goes to the right person' do
comment_mail.to.should == [user.email]
end
- it 'has the receivers name in the body' do
- comment_mail.body.encoded.include?(user.person.profile.first_name).should be true
+ it "FROM: contains the sender's name" do
+ pending
+ comment_mail.from.should == "\"#{person.name} (Diaspora)\" <#{AppConfig[:smtp_sender_address]}>"
end
- it 'has the name of person commenting' do
- comment_mail.body.encoded.include?(person.name).should be true
+ it 'SUBJECT: has a snippet of the post contents' do
+ comment_mail.subject.should == "Re: #{truncate(sm.text, :length => 70)}"
end
- it 'has the post link in the body' do
- comment_mail.body.encoded.include?("#{comment.post.id.to_s}").should be true
- end
+ context 'BODY' do
+ it "contains the comment" do
+ comment_mail.body.encoded.should include(comment.text)
+ end
+ it "contains the original post's link" do
+ comment_mail.body.encoded.include?("#{comment.post.id.to_s}").should be true
+ end
+ end
end
- describe ".also commented" do
+ describe ".also_commented" do
let!(:comment_mail) {Notifier.also_commented(user.id, person.id, comment.id)}
- it 'goes to the right person' do
+ it 'TO: goes to the right person' do
comment_mail.to.should == [user.email]
end
- it 'has the receivers name in the body' do
- comment_mail.body.encoded.include?(user.person.profile.first_name).should be true
+ it 'FROM: has the name of person commenting as the sender' do
+ pending
+ comment_mail.from.should == "\"#{person.name} (Diaspora)\" <#{AppConfig[:smtp_sender_address]}>"
end
- it 'has the name of person commenting' do
- comment_mail.body.encoded.include?(person.name).should be true
+ it 'SUBJECT: has a snippet of the post contents' do
+ comment_mail.subject.should == "Re: #{truncate(sm.text, :length => 70)}"
end
- it 'has the post link in the body' do
- comment_mail.body.encoded.include?("#{comment.post.id.to_s}").should be true
- end
+ context 'BODY' do
+ it "contains the comment" do
+ comment_mail.body.encoded.should include(comment.text)
+ end
+ it "contains the original post's link" do
+ comment_mail.body.encoded.include?("#{comment.post.id.to_s}").should be true
+ end
+ end
end
-
end
end