Sha256: f18183101cc68ce67d3ceef2db48a29d2c1bdd8b79402f33d71f63b326e8e94b

Contents?: true

Size: 954 Bytes

Versions: 2

Compression:

Stored size: 954 Bytes

Contents

module Commontator
  class ThreadsController < ApplicationController
    before_filter :get_thread

    # GET /threads/1
    def show
      raise SecurityTransgression unless @thread.can_be_read_by?(@commontator)

      @thread.mark_as_read_for(@commontator)

      respond_to do |format|
        format.html { redirect_to @commontable_url }
        format.js
      end
    end
    
    # PUT /threads/1/close
    def close
      raise SecurityTransgression unless @thread.can_be_edited_by?(@commontator)

      @thread.close(@commontator)
      @thread.thread_closed_callback(@commontator)

      respond_to do |format|
        format.html { redirect_to @commontable_url }
      end
    end
    
    # PUT /threads/1/reopen
    def reopen
      raise SecurityTransgression unless @thread.can_be_edited_by?(@commontator)

      @thread.reopen

      respond_to do |format|
        format.html { redirect_to @commontable_url }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
commontator-0.4.1 app/controllers/commontator/threads_controller.rb
commontator-0.3.10 app/controllers/commontator/threads_controller.rb