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
def post_source_tag(post)
if post.source =~ /^http/
text = truncate(post.normalized_source.sub(/^https?:\/\//, ""))
link_to(truncate(text, :length => 15), post.normalized_source)
if post.source =~ %r!http://img\d+\.pixiv\.net/img/([^\/]+)/!
text = "pixiv/#{$1}"
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
truncate(post.source, :length => 100)
end

View File

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