Add more support for negated existing metatags
This commit is contained in:
@@ -436,9 +436,15 @@ class Tag < ActiveRecord::Base
|
||||
q[:uploader_id] = user_id unless user_id.blank?
|
||||
|
||||
when "-approver"
|
||||
q[:approver_id_neg] ||= []
|
||||
user_id = User.name_to_id($2)
|
||||
q[:approver_id_neg] << user_id unless user_id.blank?
|
||||
if $2 == "none"
|
||||
q[:approver_id] = "any"
|
||||
elsif $2 == "any"
|
||||
q[:approver_id] = "none"
|
||||
else
|
||||
q[:approver_id_neg] ||= []
|
||||
user_id = User.name_to_id($2)
|
||||
q[:approver_id_neg] << user_id unless user_id.blank?
|
||||
end
|
||||
|
||||
when "approver"
|
||||
if $2 == "none"
|
||||
@@ -463,9 +469,17 @@ class Tag < ActiveRecord::Base
|
||||
end
|
||||
|
||||
when "-flagger"
|
||||
q[:flagger_ids_neg] ||= []
|
||||
user_id = User.name_to_id($2)
|
||||
q[:flagger_ids_neg] << user_id unless user_id.blank?
|
||||
if $2 == "none"
|
||||
q[:flagger_ids] ||= []
|
||||
q[:flagger_ids] << "any"
|
||||
elsif $2 == "any"
|
||||
q[:flagger_ids] ||= []
|
||||
q[:flagger_ids] << "none"
|
||||
else
|
||||
q[:flagger_ids_neg] ||= []
|
||||
user_id = User.name_to_id($2)
|
||||
q[:flagger_ids_neg] << user_id unless user_id.blank?
|
||||
end
|
||||
|
||||
when "appealer"
|
||||
q[:appealer_ids] ||= []
|
||||
@@ -480,9 +494,17 @@ class Tag < ActiveRecord::Base
|
||||
end
|
||||
|
||||
when "-appealer"
|
||||
q[:appealer_ids_neg] ||= []
|
||||
user_id = User.name_to_id($2)
|
||||
q[:appealer_ids_neg] << user_id unless user_id.blank?
|
||||
if $2 == "none"
|
||||
q[:appealer_ids] ||= []
|
||||
q[:appealer_ids] << "any"
|
||||
elsif $2 == "any"
|
||||
q[:appealer_ids] ||= []
|
||||
q[:appealer_ids] << "none"
|
||||
else
|
||||
q[:appealer_ids_neg] ||= []
|
||||
user_id = User.name_to_id($2)
|
||||
q[:appealer_ids_neg] << user_id unless user_id.blank?
|
||||
end
|
||||
|
||||
when "commenter", "comm"
|
||||
q[:commenter_ids] ||= []
|
||||
@@ -519,7 +541,11 @@ class Tag < ActiveRecord::Base
|
||||
q[:artcomm_ids] << user_id unless user_id.blank?
|
||||
|
||||
when "-pool"
|
||||
if $2.downcase == "series"
|
||||
if $2.downcase == "none"
|
||||
q[:pool] = "any"
|
||||
elsif $2.downcase == "any"
|
||||
q[:pool] = "none"
|
||||
elsif $2.downcase == "series"
|
||||
q[:tags][:exclude] << "pool:series"
|
||||
elsif $2.downcase == "collection"
|
||||
q[:tags][:exclude] << "pool:collection"
|
||||
@@ -648,7 +674,14 @@ class Tag < ActiveRecord::Base
|
||||
q[:parent] = $2.downcase
|
||||
|
||||
when "-parent"
|
||||
q[:parent_neg] = $2.downcase
|
||||
if $2.downcase == "none"
|
||||
q[:parent] = "any"
|
||||
elsif $2.downcase == "any"
|
||||
q[:parent] = "none"
|
||||
else
|
||||
q[:parent_neg_ids] ||= []
|
||||
q[:parent_neg_ids] << $2.downcase
|
||||
end
|
||||
|
||||
when "child"
|
||||
q[:child] = $2.downcase
|
||||
|
||||
Reference in New Issue
Block a user