mirror of
https://github.com/openstreetmap/openstreetmap-website.git
synced 2025-08-16 17:07:06 +00:00
39 lines
1.0 KiB
Ruby
39 lines
1.0 KiB
Ruby
class ChangesetSubscriptionsController < ApplicationController
|
|
layout "site"
|
|
|
|
before_action :authorize_web
|
|
before_action :set_locale
|
|
before_action :check_database_writable
|
|
|
|
authorize_resource
|
|
|
|
around_action :web_timeout
|
|
|
|
def show
|
|
@changeset = Changeset.find(params[:changeset_id])
|
|
@subscribed = @changeset.subscribers.include?(current_user)
|
|
rescue ActiveRecord::RecordNotFound
|
|
render :action => "no_such_entry", :status => :not_found
|
|
end
|
|
|
|
def create
|
|
@changeset = Changeset.find(params[:changeset_id])
|
|
|
|
@changeset.subscribers << current_user unless @changeset.subscribers.include?(current_user)
|
|
|
|
redirect_to changeset_path(@changeset)
|
|
rescue ActiveRecord::RecordNotFound
|
|
render :action => "no_such_entry", :status => :not_found
|
|
end
|
|
|
|
def destroy
|
|
@changeset = Changeset.find(params[:changeset_id])
|
|
|
|
@changeset.subscribers.delete(current_user)
|
|
|
|
redirect_to changeset_path(@changeset)
|
|
rescue ActiveRecord::RecordNotFound
|
|
render :action => "no_such_entry", :status => :not_found
|
|
end
|
|
end
|