Files
openstreetmap-website/app/controllers/changeset_subscriptions_controller.rb
Anton Khorev 9c002d5c71 Remove subscription methods from changeset model
Undoes 8e21e4e801 , but these methods weren't used consistently.
2025-03-13 20:09:01 +03:00

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