From 6af8c4c72be753e3aeb30bbfbadf0c49a3ed5ef4 Mon Sep 17 00:00:00 2001 From: jessib Date: Thu, 20 Dec 2012 15:16:09 -0800 Subject: Slight tweaks to tickets controller. Only non-comment change is that we will keep an unauthenticated user looking at the same ticket if they have closed it (rather than redirecting to index which they will not be able to access.) --- help/app/controllers/tickets_controller.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'help') diff --git a/help/app/controllers/tickets_controller.rb b/help/app/controllers/tickets_controller.rb index 297de30..d4aa378 100644 --- a/help/app/controllers/tickets_controller.rb +++ b/help/app/controllers/tickets_controller.rb @@ -66,9 +66,9 @@ class TicketsController < ApplicationController end if @ticket.changed? and @ticket.save flash[:notice] = 'Ticket was successfully updated.' - if @ticket.is_open + if @ticket.is_open || !logged_in? respond_with @ticket - else #for closed tickets, redirect to index. + else #for closed tickets with authenticated users, redirect to index. redirect_to tickets_path end else @@ -83,13 +83,11 @@ class TicketsController < ApplicationController def index @all_tickets = Ticket.for_user(current_user, params, admin?) #for tests, useful to have as separate variable - - #below works if @tickets is a CouchRest::Model::Designs::View, but not if it is an Array @tickets = @all_tickets.page(params[:page]).per(10) - #respond_with(@tickets) end def destroy + # should we allow non-admins to delete their own tickets? i don't think necessary. @ticket = Ticket.find(params[:id]) @ticket.destroy if admin? redirect_to tickets_path -- cgit v1.2.3