summaryrefslogtreecommitdiff
path: root/help
diff options
context:
space:
mode:
authorjessib <jessib@leap.se>2012-12-20 15:16:09 -0800
committerjessib <jessib@leap.se>2012-12-20 15:16:09 -0800
commit6af8c4c72be753e3aeb30bbfbadf0c49a3ed5ef4 (patch)
tree64845b90d4317412ea743085bd39c906a6ebf4c6 /help
parentaeb69e4abf69993157f9970fa5503b7f9fd4aab5 (diff)
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.)
Diffstat (limited to 'help')
-rw-r--r--help/app/controllers/tickets_controller.rb8
1 files changed, 3 insertions, 5 deletions
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