This commit is contained in:
albert
2013-04-09 15:31:49 -04:00
parent c17ab321be
commit 6a4a19fae4
2 changed files with 14 additions and 6 deletions

View File

@@ -18,9 +18,15 @@ module PostsHelper
end end
def post_source_tag(post) def post_source_tag(post)
if post.source =~ /^http/ if post.source =~ %r!http://img\d+\.pixiv\.net/img/([^\/]+)/!
text = truncate(post.normalized_source.sub(/^https?:\/\//, "")) text = "pixiv/#{$1}"
link_to(truncate(text, :length => 15), post.normalized_source) link_to(text, post.normalized_source)
elsif post.source =~ %r!http://i\d\.pixiv\.net/img\d+/img/([^\/]+)/!
text = "pixiv/#{$1}"
link_to(text, post.normalized_source)
elsif post.source =~ /^http/
text = truncate(post.normalized_source.sub(/^https?:\/\/(?:www)?/, ""))
link_to(truncate(text, :length => 20), post.normalized_source)
else else
truncate(post.source, :length => 100) truncate(post.source, :length => 100)
end end

View File

@@ -6,9 +6,11 @@ class PostPruner
end end
def prune! def prune!
prune_pending! Post.without_timeout do
prune_flagged! prune_pending!
prune_mod_actions! prune_flagged!
prune_mod_actions!
end
end end
protected protected