app/controllers/commontator/threads_controller.rb~ in commontator-0.5.14 vs app/controllers/commontator/threads_controller.rb~ in commontator-1.0.0
- old
+ new
@@ -15,12 +15,12 @@
# PUT /threads/1/close
def close
raise SecurityTransgression unless @thread.can_be_edited_by?(@user)
- @thread.close(@user)
- @thread.thread_closed_callback(@user)
+ @thread.errors.add(:base, "This thread has already been closed") \
+ unless @thread.close(@user)
respond_to do |format|
format.html { redirect_to @thread }
format.js { render :show }
end
@@ -28,13 +28,15 @@
# PUT /threads/1/reopen
def reopen
raise SecurityTransgression unless @thread.can_be_edited_by?(@user)
- @thread.reopen
+ @thread.errors.add(:base, "This thread is not closed") \
+ unless @thread.reopen
respond_to do |format|
format.html { redirect_to @thread }
+ format.js { render :show }
end
end
end
end