1 class ChangesetCommentsController < ApplicationController
2 before_action :authorize_web
3 before_action :set_locale
7 before_action -> { check_database_readable(:need_api => true) }
8 around_action :web_timeout
11 # Get a feed of recent changeset comments
14 # Extract the arguments
18 changeset = Changeset.find(id)
20 # Return comments for this changeset only
21 @comments = changeset.comments.includes(:author, :changeset).reverse_order.limit(comments_limit)
24 @comments = ChangesetComment.includes(:author, :changeset).where(:visible => true).order("created_at DESC").limit(comments_limit).preload(:changeset)
28 respond_to do |format|
31 rescue OSM::APIBadUserInput
38 # Get the maximum number of comments to return
41 if params[:limit].to_i.positive? && params[:limit].to_i <= 10000
44 raise OSM::APIBadUserInput, "Comments limit must be between 1 and 10000"