Allow source:"text with spaces", also allow source: for post edit

This commit is contained in:
Type-kun
2016-09-19 19:33:21 +05:00
parent 6241a50c31
commit 02b8f37515
2 changed files with 20 additions and 5 deletions

View File

@@ -674,7 +674,7 @@ class Post < ActiveRecord::Base
end
def filter_metatags(tags)
@pre_metatags, tags = tags.partition {|x| x =~ /\A(?:rating|parent|-parent):/i}
@pre_metatags, tags = tags.partition {|x| x =~ /\A(?:rating|parent|-parent|source):/i}
@post_metatags, tags = tags.partition {|x| x =~ /\A(?:-pool|pool|newpool|fav|-fav|child|-favgroup|favgroup):/i}
apply_pre_metatags
return tags
@@ -757,6 +757,15 @@ class Post < ActiveRecord::Base
remove_parent_loops
end
when /^source:none$/i
self.source = nil
when /^source:"(.*)"$/i
self.source = $1
when /^source:(.*)$/i
self.source = $1
when /^rating:([qse])/i
unless is_rating_locked?
self.rating = $1.downcase