X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/cb0c5262a8a72baa4f0a960f422a3c54a13837cb..6569ed24e4bcc74b8fcbdd70591d4c4a6d907691:/app/controllers/api/notes_controller.rb diff --git a/app/controllers/api/notes_controller.rb b/app/controllers/api/notes_controller.rb index 1a53877e6..a0095d954 100644 --- a/app/controllers/api/notes_controller.rb +++ b/app/controllers/api/notes_controller.rb @@ -266,7 +266,9 @@ module Api end # Add any text filter - @notes = @notes.joins(:comments).where("to_tsvector('english', note_comments.body) @@ plainto_tsquery('english', ?)", params[:q]) if params[:q] + if params[:q] + @notes = @notes.joins(:comments).where("to_tsvector('english', note_comments.body) @@ plainto_tsquery('english', ?) OR to_tsvector('english', notes.description) @@ plainto_tsquery('english', ?)", params[:q], params[:q]) + end # Add any date filter if params[:from] @@ -385,7 +387,7 @@ module Api ## # Get author's information (for logged in users - user_id, for logged out users - IP address) def author_info - if scope_enabled?(:write_notes) + if current_user { :user_id => current_user.id } else { :user_ip => request.remote_ip }