]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/api/notes_controller.rb
Merge pull request #5363 from AntonKhorev/no-compact-nav-2
[rails.git] / app / controllers / api / notes_controller.rb
index 1a53877e6e9ffa8d2d5fa084b9f744502460a361..a0095d954b5d6f48dd891560d11c7f755523c964 100644 (file)
@@ -266,7 +266,9 @@ module Api
       end
 
       # Add any text filter
       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]
 
       # 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
     ##
     # 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 }
         { :user_id => current_user.id }
       else
         { :user_ip => request.remote_ip }