]> git.openstreetmap.org Git - rails.git/blob - app/controllers/api/changesets/closes_controller.rb
Add frozen_string_literal comments to ruby files
[rails.git] / app / controllers / api / changesets / closes_controller.rb
1 # frozen_string_literal: true
2
3 module Api
4   module Changesets
5     class ClosesController < ApiController
6       before_action :check_api_writable
7       before_action :authorize
8
9       authorize_resource :class => Changeset
10
11       before_action :require_public_data
12
13       # Helper methods for checking consistency
14       include ConsistencyValidations
15
16       ##
17       # marks a changeset as closed. this may be called multiple times
18       # on the same changeset, so is idempotent.
19       def update
20         changeset = Changeset.find(params[:changeset_id])
21         check_changeset_consistency(changeset, current_user)
22
23         # to close the changeset, we'll just set its closed_at time to
24         # now. this might not be enough if there are concurrency issues,
25         # but we'll have to wait and see.
26         changeset.set_closed_time_now
27
28         changeset.save!
29         head :ok
30       end
31     end
32   end
33 end