Merge pull request #3347 from BrokenEagle/fix-newpool-upload
Fix bug with newpool metatag on uploads
This commit is contained in:
@@ -765,7 +765,9 @@ class Post < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def apply_casesensitive_metatags(tags)
|
def apply_casesensitive_metatags(tags)
|
||||||
casesensitive_metatags, tags = tags.partition {|x| x =~ /\A(?:source|newpool):/i}
|
casesensitive_metatags, tags = tags.partition {|x| x =~ /\A(?:source):/i}
|
||||||
|
#Reuse the following metatags after the post has been saved
|
||||||
|
casesensitive_metatags += tags.select {|x| x =~ /\A(?:newpool):/i}
|
||||||
if casesensitive_metatags.length > 0
|
if casesensitive_metatags.length > 0
|
||||||
case casesensitive_metatags[-1]
|
case casesensitive_metatags[-1]
|
||||||
when /^source:none$/i
|
when /^source:none$/i
|
||||||
@@ -782,7 +784,6 @@ class Post < ApplicationRecord
|
|||||||
if pool.nil?
|
if pool.nil?
|
||||||
pool = Pool.create(:name => $1, :description => "This pool was automatically generated")
|
pool = Pool.create(:name => $1, :description => "This pool was automatically generated")
|
||||||
end
|
end
|
||||||
add_pool!(pool) if pool
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return tags
|
return tags
|
||||||
@@ -791,7 +792,7 @@ class Post < ApplicationRecord
|
|||||||
def filter_metatags(tags)
|
def filter_metatags(tags)
|
||||||
@pre_metatags, tags = tags.partition {|x| x =~ /\A(?:rating|parent|-parent|-?locked):/i}
|
@pre_metatags, tags = tags.partition {|x| x =~ /\A(?:rating|parent|-parent|-?locked):/i}
|
||||||
tags = apply_categorization_metatags(tags)
|
tags = apply_categorization_metatags(tags)
|
||||||
@post_metatags, tags = tags.partition {|x| x =~ /\A(?:-pool|pool|fav|-fav|child|-favgroup|favgroup|upvote|downvote):/i}
|
@post_metatags, tags = tags.partition {|x| x =~ /\A(?:-pool|pool|newpool|fav|-fav|child|-favgroup|favgroup|upvote|downvote):/i}
|
||||||
apply_pre_metatags
|
apply_pre_metatags
|
||||||
return tags
|
return tags
|
||||||
end
|
end
|
||||||
@@ -828,6 +829,10 @@ class Post < ApplicationRecord
|
|||||||
pool = Pool.find_by_name($1)
|
pool = Pool.find_by_name($1)
|
||||||
add_pool!(pool) if pool
|
add_pool!(pool) if pool
|
||||||
|
|
||||||
|
when /^newpool:(.+)$/i
|
||||||
|
pool = Pool.find_by_name($1)
|
||||||
|
add_pool!(pool) if pool
|
||||||
|
|
||||||
when /^fav:(.+)$/i
|
when /^fav:(.+)$/i
|
||||||
add_favorite!(CurrentUser.user)
|
add_favorite!(CurrentUser.user)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user