Skip to content

Commit

Permalink
Merge branch 'develop' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
phuongdh authored Mar 29, 2017
2 parents 2ffa797 + 01b9d65 commit f85d45f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 10 deletions.
12 changes: 6 additions & 6 deletions app/controllers/comments_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@ def create

if (@comment.valid?)
begin
CommentsMailer.contact_email(@comment).deliver_later
CommentsMailer.contact_email(@comment.to_h).deliver_later
rescue Errno::ECONNRESET => e
logger.warn "The mail server does not appear to be responding \n #{e}"
logger.warn "The mail server does not appear to be responding \n #{e}"

flash[:notice] = "The message could not be sent in a timely fashion. Contact us at #{Avalon::Configuration.lookup('email.support')} to report the problem."
render action: "index"
flash[:notice] = "The message could not be sent in a timely fashion. Contact us at #{Avalon::Configuration.lookup('email.support')} to report the problem."
render action: "index"
end
else
flash[:error] = "There were problems submitting your comment. Please correct the errors and try again."
render action: "index"
flash[:error] = "There were problems submitting your comment. Please correct the errors and try again."
render action: "index"
end
end

Expand Down
4 changes: 2 additions & 2 deletions app/mailers/comments_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class CommentsMailer < ActionMailer::Base
default :to => Avalon::Configuration.lookup('email.comments')

def contact_email(comment)
@comment = comment
mail(:from => comment.email, :subject => comment.subject)
@comment = OpenStruct.new(comment)
mail(:from => @comment.email, :subject => @comment.subject)
end
end
9 changes: 9 additions & 0 deletions app/models/comment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,13 @@ def persisted?
false
end

def to_h
{
name: name,
subject: subject,
email: email,
nickname: nickname,
comment: comment
}
end
end
4 changes: 2 additions & 2 deletions spec/features/capybara_playlist_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
page.should have_content('private_playlist')
page.should have_button('Edit Playlist')
page.should have_content('This is test')
page.should have_content('This playlist currently has no items')
page.should have_content('This playlist currently has no playable items')
end
it 'is able to view playlist by accessing View Playlist' do
user = FactoryGirl.create(:administrator)
Expand All @@ -75,7 +75,7 @@
page.should have_content('private_playlist')
page.should have_button('Edit Playlist')
page.should have_content('This is test')
page.should have_content('This playlist currently has no items')
page.should have_content('This playlist currently has no playable items')
end

it 'deletes playlist permanently from playlists page' do
Expand Down

0 comments on commit f85d45f

Please sign in to comment.