1 module ChangesetComments
 
   2   class FeedsController < ApplicationController
 
   5     before_action :authorize_web
 
   6     before_action :set_locale
 
   8     authorize_resource :changeset_comment
 
  10     before_action -> { check_database_readable(:need_api => true) }
 
  11     around_action :web_timeout
 
  14     # Get a feed of recent changeset comments
 
  16       if params[:changeset_id]
 
  17         # Extract the arguments
 
  18         changeset_id = params[:changeset_id].to_i
 
  21         changeset = Changeset.find(changeset_id)
 
  23         # Return comments for this changeset only
 
  24         @comments = changeset.comments.includes(:author, :changeset).reverse_order
 
  25         @comments = query_limit(@comments)
 
  28         @comments = ChangesetComment.includes(:author, :changeset).where(:visible => true).order("created_at DESC")
 
  29         @comments = query_limit(@comments)
 
  30         @comments = @comments.preload(:changeset)
 
  34       respond_to do |format|
 
  37     rescue OSM::APIBadUserInput