fixes #2660: Support approver:any and approver:none metatags
This commit is contained in:
@@ -242,7 +242,13 @@ class PostQueryBuilder
|
|||||||
end
|
end
|
||||||
|
|
||||||
if q[:approver_id]
|
if q[:approver_id]
|
||||||
relation = relation.where("posts.approver_id = ?", q[:approver_id])
|
if q[:approver_id] == "any"
|
||||||
|
relation = relation.where("posts.approver_id is not null")
|
||||||
|
elsif q[:approver_id] == "none"
|
||||||
|
relation = relation.where("posts.approver_id is null")
|
||||||
|
else
|
||||||
|
relation = relation.where("posts.approver_id = ?", q[:approver_id])
|
||||||
|
end
|
||||||
has_constraints!
|
has_constraints!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -418,8 +418,14 @@ class Tag < ActiveRecord::Base
|
|||||||
q[:approver_id_neg] << user_id unless user_id.blank?
|
q[:approver_id_neg] << user_id unless user_id.blank?
|
||||||
|
|
||||||
when "approver"
|
when "approver"
|
||||||
user_id = User.name_to_id($2)
|
if $2 == "none"
|
||||||
q[:approver_id] = user_id unless user_id.blank?
|
q[:approver_id] = "none"
|
||||||
|
elsif $2 == "any"
|
||||||
|
q[:approver_id] = "any"
|
||||||
|
else
|
||||||
|
user_id = User.name_to_id($2)
|
||||||
|
q[:approver_id] = user_id unless user_id.blank?
|
||||||
|
end
|
||||||
|
|
||||||
when "commenter", "comm"
|
when "commenter", "comm"
|
||||||
q[:commenter_ids] ||= []
|
q[:commenter_ids] ||= []
|
||||||
|
|||||||
Reference in New Issue
Block a user