mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 09:36:19 -05:00
Always use lower case URLs, fix date formatting and add full date title
This commit is contained in:
parent
ad71490deb
commit
9d1855f92f
3 changed files with 5 additions and 5 deletions
|
@ -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
|
||||
|
|
|
@ -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<hr>\n<small>#{I18n.t('embed.imported_from', link: "<a href='#{url}'>#{url}</a>")}</small>\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)
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<%- if @topic_view.posts.present? %>
|
||||
<%- @topic_view.posts.each do |post| %>
|
||||
<article class='post<%- if post.trashed? %> deleted<% end %>' id='post-<%= post.id.to_s %>'>
|
||||
<%= 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 %>
|
||||
|
|
Loading…
Reference in a new issue