diff --git a/app/helpers/embed_helper.rb b/app/helpers/embed_helper.rb
index d3f04cd59..908a465f6 100644
--- a/app/helpers/embed_helper.rb
+++ b/app/helpers/embed_helper.rb
@@ -9,7 +9,7 @@ module EmbedHelper
if dt.year == current.year
dt.strftime("%e %b")
else
- dt.strftime("%e %b %Y")
+ dt.strftime("%b '%y")
end
end
end
diff --git a/app/models/topic_embed.rb b/app/models/topic_embed.rb
index 60bc4de0f..552493ac6 100644
--- a/app/models/topic_embed.rb
+++ b/app/models/topic_embed.rb
@@ -7,7 +7,7 @@ class TopicEmbed < ActiveRecord::Base
validates_presence_of :content_sha1
def self.normalize_url(url)
- url.sub(/\/$/, '')
+ url.downcase.sub(/\/$/, '').sub(/\-+/, '-')
end
# Import an article from a source (RSS/Atom/Other)
@@ -21,7 +21,7 @@ class TopicEmbed < ActiveRecord::Base
end
contents << "\n
\n#{I18n.t('embed.imported_from', link: "#{url}")}\n"
- embed = TopicEmbed.where(embed_url: url).first
+ embed = TopicEmbed.where("lower(embed_url) = ?", url).first
content_sha1 = Digest::SHA1.hexdigest(contents)
post = nil
@@ -93,7 +93,7 @@ class TopicEmbed < ActiveRecord::Base
def self.topic_id_for_embed(embed_url)
embed_url = normalize_url(embed_url)
- TopicEmbed.where(embed_url: embed_url).pluck(:topic_id).first
+ TopicEmbed.where("lower(embed_url) = ?", embed_url).pluck(:topic_id).first
end
def self.first_paragraph_from(html)
diff --git a/app/views/embed/comments.html.erb b/app/views/embed/comments.html.erb
index dc8590d65..04f6714c5 100644
--- a/app/views/embed/comments.html.erb
+++ b/app/views/embed/comments.html.erb
@@ -10,7 +10,7 @@
<%- if @topic_view.posts.present? %>
<%- @topic_view.posts.each do |post| %>
- <%= link_to embed_post_date(post.created_at), post.url, class: 'post-date', target: "_blank" %>
+ <%= link_to embed_post_date(post.created_at), post.url, title: post.created_at.strftime("%B %e, %Y %l:%M%P"), class: 'post-date', target: "_blank" %>
<%- if post.reply_to_post.present? && !post.cooked.index('aside') %>
<%= link_to I18n.t('embed.in_reply_to', username: post.reply_to_post.username), post.reply_to_post.url, 'data-link-to-post' => post.reply_to_post.id.to_s, :class => 'in-reply-to' %>
<%- end %>