Class: Commontator::ThreadsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/commontator/threads_controller.rb

Instance Method Summary collapse

Instance Method Details

#closeObject

PUT /threads/1/close

Raises:

  • (SecurityTransgression)


18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/commontator/threads_controller.rb', line 18

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

#reopenObject

PUT /threads/1/reopen

Raises:

  • (SecurityTransgression)


30
31
32
33
34
35
36
37
38
# File 'app/controllers/commontator/threads_controller.rb', line 30

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

#showObject

GET /threads/1

Raises:

  • (SecurityTransgression)


6
7
8
9
10
11
12
13
14
15
# File 'app/controllers/commontator/threads_controller.rb', line 6

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