summaryrefslogtreecommitdiff
path: root/engines/support/app/controllers
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2014-05-13 13:52:16 +0200
committerAzul <azul@leap.se>2014-05-13 14:02:15 +0200
commit81a4a0527639fe4b560b8d98f977f6dbac67bb41 (patch)
tree725b9effd20be6d9d62e5f0e5443c7e4c5398fcf /engines/support/app/controllers
parent84ce597ad0516b92d6633c1f81c03517b5d74004 (diff)
prefill ticket form from the model - fixes #5657
email and regarding user fields can be set to defaults based on created_by user. If these fields are emptied by the submitting user they will be set to whereas they are nil if they have not been initialized. In that case we will use meaningful defaults from the user who created the ticket.
Diffstat (limited to 'engines/support/app/controllers')
-rw-r--r--engines/support/app/controllers/tickets_controller.rb5
1 files changed, 2 insertions, 3 deletions
diff --git a/engines/support/app/controllers/tickets_controller.rb b/engines/support/app/controllers/tickets_controller.rb
index 8ec8e4d..99357ab 100644
--- a/engines/support/app/controllers/tickets_controller.rb
+++ b/engines/support/app/controllers/tickets_controller.rb
@@ -12,6 +12,7 @@ class TicketsController < ApplicationController
def new
@ticket = Ticket.new
+ @ticket.created_by = current_user.id
@ticket.comments.build
end
@@ -24,9 +25,7 @@ class TicketsController < ApplicationController
@ticket.created_by = current_user.id
if @ticket.save
flash[:notice] = t(:thing_was_successfully_created, :thing => t(:ticket))
-
- # cannot set this until ticket has been saved, as @ticket.id will not be set
- if !logged_in? and flash[:notice]
+ if !logged_in?
flash[:notice] += " " + t(:access_ticket_text, :full_url => ticket_url(@ticket.id))
end
end