2 class ChangesetCommentsController < ApplicationController
3 before_action :authorize_web
4 before_action :set_locale
8 before_action -> { check_database_readable(:need_api => true) }
9 around_action :web_timeout
12 # Get a feed of recent changeset comments
15 # Extract the arguments
19 changeset = Changeset.find(id)
21 # Return comments for this changeset only
22 @comments = changeset.comments.includes(:author, :changeset).reverse_order.limit(comments_limit)
25 @comments = ChangesetComment.includes(:author, :changeset).where(:visible => true).order("created_at DESC").limit(comments_limit).preload(:changeset)
29 respond_to do |format|
32 rescue OSM::APIBadUserInput
39 # Get the maximum number of comments to return
42 if params[:limit].to_i.positive? && params[:limit].to_i <= 10000
45 raise OSM::APIBadUserInput, "Comments limit must be between 1 and 10000"