Feature #10828 ยป restapi-issues-id-param.patch
app/controllers/issues_controller.rb | ||
---|---|---|
66 | 66 |
@limit = Setting.feeds_limit.to_i |
67 | 67 |
when 'xml', 'json' |
68 | 68 |
@offset, @limit = api_offset_and_limit |
69 | ||
70 |
@query.available_filters["id"] = { :type => :integer, :order => 1 } |
|
71 |
@query.add_short_filter('id', params[:id]) if params[:id] |
|
72 | ||
73 |
@query.available_filters["parent_id"] = { :type => :integer, :order => 1 } |
|
74 |
@query.add_short_filter('parent_id', params[:parent_id]) if params[:parent_id] |
|
75 | ||
76 |
@query.available_filters["root_id"] = { :type => :integer, :order => 1 } |
|
77 |
@query.add_short_filter('root_id', params[:root_id]) if params[:root_id] |
|
69 | 78 |
else |
70 | 79 |
@limit = per_page_option |
71 | 80 |
end |
app/models/query.rb | ||
---|---|---|
720 | 720 |
if is_custom_filter |
721 | 721 |
sql = "(#{db_table}.#{db_field} <> '' AND CAST(#{db_table}.#{db_field} AS decimal(60,3)) = #{value.first.to_i})" |
722 | 722 |
else |
723 |
sql = "#{db_table}.#{db_field} = #{value.first.to_i}" |
|
723 |
if value.length > 1 |
|
724 |
sql = "#{db_table}.#{db_field} IN (" + value.collect{|val| val.to_i}.join(",") + ")" |
|
725 |
else |
|
726 |
sql = "#{db_table}.#{db_field} = #{value.first.to_i}" |
|
727 |
end |
|
724 | 728 |
end |
725 | 729 |
when :float |
726 | 730 |
if is_custom_filter |