From 8b4c030c16d021f1e227a15784890881a6c4c6ed Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Tue, 3 Dec 2013 10:10:53 -0500 Subject: [PATCH] Small email fixes --- app/mailers/user_notifications.rb | 2 +- lib/email/styles.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/mailers/user_notifications.rb b/app/mailers/user_notifications.rb index 101cb4fb55d..f4eb30cdcc7 100644 --- a/app/mailers/user_notifications.rb +++ b/app/mailers/user_notifications.rb @@ -46,7 +46,7 @@ class UserNotifications < ActionMailer::Base @featured_topics, @new_topics = @featured_topics[0..4], @featured_topics[5..-1] # Sort the new topics by score - @new_topics.sort! {|a, b| b.score - a.score } if @new_topics.present? + @new_topics.sort! {|a, b| (b.score || 0) - (a.score || 0) } if @new_topics.present? @markdown_linker = MarkdownLinker.new(Discourse.base_url) diff --git a/lib/email/styles.rb b/lib/email/styles.rb index c65c41e9d56..8ab76b2efc6 100644 --- a/lib/email/styles.rb +++ b/lib/email/styles.rb @@ -28,7 +28,7 @@ module Email end # ensure no schemaless urls - if img['src'].starts_with?("//") + if img['src'] && img['src'].starts_with?("//") img['src'] = "http:" + img['src'] end end