]> git.openstreetmap.org Git - rails.git/blob - app/controllers/changeset_subscriptions_controller.rb
Add frozen_string_literal comments to ruby files
[rails.git] / app / controllers / changeset_subscriptions_controller.rb
1 # frozen_string_literal: true
2
3 class ChangesetSubscriptionsController < ApplicationController
4   layout :site_layout
5
6   before_action :authorize_web
7   before_action :set_locale
8   before_action :check_database_writable
9
10   authorize_resource
11
12   around_action :web_timeout
13
14   def show
15     @changeset = Changeset.find(params[:changeset_id])
16     @subscribed = @changeset.subscribers.include?(current_user)
17   rescue ActiveRecord::RecordNotFound
18     render :action => "no_such_entry", :status => :not_found
19   end
20
21   def create
22     @changeset = Changeset.find(params[:changeset_id])
23
24     @changeset.subscribers << current_user unless @changeset.subscribers.include?(current_user)
25
26     redirect_to changeset_path(@changeset)
27   rescue ActiveRecord::RecordNotFound
28     render :action => "no_such_entry", :status => :not_found
29   end
30
31   def destroy
32     @changeset = Changeset.find(params[:changeset_id])
33
34     @changeset.subscribers.delete(current_user)
35
36     redirect_to changeset_path(@changeset)
37   rescue ActiveRecord::RecordNotFound
38     render :action => "no_such_entry", :status => :not_found
39   end
40 end