make forum post quoting regexp nongreedy

This commit is contained in:
albert
2013-02-22 12:24:10 -05:00
parent 804055aac7
commit bbb8767b29
10 changed files with 35 additions and 18 deletions

View File

@@ -110,7 +110,7 @@ class ForumPost < ActiveRecord::Base
end
def quoted_response
stripped_body = body.gsub(/\[quote\](?:.|\n|\r)+\[\/quote\][\n\r]*/m, "")
stripped_body = body.gsub(/\[quote\](?:.|\n|\r)+?\[\/quote\][\n\r]*/m, "")
"[quote]\n#{creator_name} said:\n\n#{stripped_body}\n[/quote]\n\n"
end

View File

@@ -16,7 +16,7 @@ class Upload < ActiveRecord::Base
module ValidationMethods
def uploader_is_not_limited
if !uploader.can_upload?
raise "uploader has reached their daily limit"
raise Error.new("uploader has reached their daily limit")
end
end