X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/9c002d5c711dee6035179c7d2b15327652dcbae2..9bd29748be8e6770e276e93e54bb99c69d464498:/app/controllers/api/changesets_controller.rb diff --git a/app/controllers/api/changesets_controller.rb b/app/controllers/api/changesets_controller.rb index e335f88f0..891e2175b 100644 --- a/app/controllers/api/changesets_controller.rb +++ b/app/controllers/api/changesets_controller.rb @@ -4,13 +4,13 @@ module Api class ChangesetsController < ApiController include QueryMethods - before_action :check_api_writable, :only => [:create, :update, :upload, :subscribe, :unsubscribe] + before_action :check_api_writable, :only => [:create, :update, :upload] before_action :setup_user_auth, :only => [:show] - before_action :authorize, :only => [:create, :update, :upload, :close, :subscribe, :unsubscribe] + before_action :authorize, :only => [:create, :update, :upload, :close] authorize_resource - before_action :require_public_data, :only => [:create, :update, :upload, :close, :subscribe, :unsubscribe] + before_action :require_public_data, :only => [:create, :update, :upload, :close] before_action :set_request_formats, :except => [:create, :close, :upload] skip_around_action :api_call_timeout, :only => [:upload] @@ -152,58 +152,6 @@ module Api end end - ## - # Adds a subscriber to the changeset - def subscribe - # Check the arguments are sane - raise OSM::APIBadUserInput, "No id was given" unless params[:id] - - # Extract the arguments - id = params[:id].to_i - - # Find the changeset and check it is valid - changeset = Changeset.find(id) - raise OSM::APIChangesetAlreadySubscribedError, changeset if changeset.subscribers.include?(current_user) - - # Add the subscriber - changeset.subscribers << current_user - - # Return a copy of the updated changeset - @changeset = changeset - render "show" - - respond_to do |format| - format.xml - format.json - end - end - - ## - # Removes a subscriber from the changeset - def unsubscribe - # Check the arguments are sane - raise OSM::APIBadUserInput, "No id was given" unless params[:id] - - # Extract the arguments - id = params[:id].to_i - - # Find the changeset and check it is valid - changeset = Changeset.find(id) - raise OSM::APIChangesetNotSubscribedError, changeset unless changeset.subscribers.include?(current_user) - - # Remove the subscriber - changeset.subscribers.delete(current_user) - - # Return a copy of the updated changeset - @changeset = changeset - render "show" - - respond_to do |format| - format.xml - format.json - end - end - private #------------------------------------------------------------