1 class ChangesetSubscriptionsController < ApplicationController
4 before_action :authorize_web
5 before_action :set_locale
6 before_action :check_database_writable
8 authorize_resource :class => :changeset_subscription
10 around_action :web_timeout
13 @changeset = Changeset.find(params[:changeset_id])
14 @subscribed = @changeset.subscribed?(current_user)
15 rescue ActiveRecord::RecordNotFound
16 render :action => "no_such_entry", :status => :not_found
20 @changeset = Changeset.find(params[:changeset_id])
22 @changeset.subscribe(current_user) unless @changeset.subscribed?(current_user)
24 redirect_to changeset_path(@changeset)
25 rescue ActiveRecord::RecordNotFound
26 render :action => "no_such_entry", :status => :not_found
30 @changeset = Changeset.find(params[:changeset_id])
32 @changeset.unsubscribe(current_user)
34 redirect_to changeset_path(@changeset)
35 rescue ActiveRecord::RecordNotFound
36 render :action => "no_such_entry", :status => :not_found