2 module ChangesetComments
3 class VisibilitiesController < ApiController
4 before_action :check_api_writable
5 before_action :authorize
7 authorize_resource :class => :changeset_comment_visibility
9 before_action :set_request_formats
12 # Sets visible flag on comment to true
14 # Check the arguments are sane
15 raise OSM::APIBadUserInput, "No id was given" unless params[:changeset_comment_id]
17 # Extract the arguments
18 changeset_comment_id = params[:changeset_comment_id].to_i
21 comment = ChangesetComment.find(changeset_comment_id)
24 comment.update(:visible => true)
26 # Return a copy of the updated changeset
27 @changeset = comment.changeset
29 respond_to do |format|
36 # Sets visible flag on comment to false
38 # Check the arguments are sane
39 raise OSM::APIBadUserInput, "No id was given" unless params[:changeset_comment_id]
41 # Extract the arguments
42 changeset_comment_id = params[:changeset_comment_id].to_i
45 comment = ChangesetComment.find(changeset_comment_id)
48 comment.update(:visible => false)
50 # Return a copy of the updated changeset
51 @changeset = comment.changeset
53 respond_to do |format|