3 class ClosesController < ApiController
4 before_action :check_api_writable
5 before_action :authorize
7 authorize_resource :class => Changeset
9 before_action :require_public_data
11 # Helper methods for checking consistency
12 include ConsistencyValidations
15 # marks a changeset as closed. this may be called multiple times
16 # on the same changeset, so is idempotent.
18 changeset = Changeset.find(params[:changeset_id])
19 check_changeset_consistency(changeset, current_user)
21 # to close the changeset, we'll just set its closed_at time to
22 # now. this might not be enough if there are concurrency issues,
23 # but we'll have to wait and see.
24 changeset.set_closed_time_now