Skip to content

Commit

Permalink
Multipart emails are just to much of a pain to handle replying to [#2]
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason L Perry committed Nov 28, 2008
1 parent a02bf62 commit 73cb5ea
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
6 changes: 3 additions & 3 deletions app/models/notification.rb
Expand Up @@ -26,10 +26,10 @@ def reply_body(mail)
pattern = /^.*Reply above this line.*$/
message = full_body(mail)
match = pattern.match(message)

clean_reply(match ? match.pre_match.strip : message)
end

def full_body(mail)
if mail.multipart?
plain = mail.parts.select { |part| part.content_type == "text/plain" }
Expand All @@ -54,7 +54,7 @@ def self.topic_key(address)
key = address.scan(/topic-(\d+)@.*/).flatten.first
key ? key.to_i : nil
end

def self.topic_reply_to(post)
topic = post.respond_to?(:topic) ? post.topic : post
"topic-#{topic.id}@#{ActionMailer::Base.default_url_options[:host]}"
Expand Down
7 changes: 0 additions & 7 deletions app/views/notification/post.text.html.erb

This file was deleted.

6 changes: 3 additions & 3 deletions spec/models/notification_spec.rb
Expand Up @@ -7,7 +7,7 @@
it "should find the topic id from the address" do
Notification.topic_key("topic-123@example.com").should == 123
end

it "should not find an id for other addresses" do
Notification.topic_key("postmaster@example.com").should be_nil
end
Expand All @@ -20,7 +20,7 @@
@email = File.open(fixture_path + "/emails/simple.email").read
@topic = stub_model(Topic)
@user = stub_model(User)

User.stub!(:find_by_email).and_return(@user)
Topic.stub!(:find_by_id).and_return(@topic)
end
Expand Down Expand Up @@ -59,7 +59,7 @@
:author => @user,
:body => "I am replying."
)
Notification.receive(File.open(fixture_path + "/emails/reply.email").read)
Notification.receive(File.open(fixture_path + "/emails/reply.email").read)
end

end
Expand Down

0 comments on commit 73cb5ea

Please sign in to comment.