summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzul <azul@riseup.net>2016-05-13 16:23:10 +0200
committerAzul <azul@riseup.net>2016-05-14 10:47:35 +0200
commita1b494e334406660a1f49fb7de9b043493809640 (patch)
tree16b86b0d85e01cb783ca79caa37b1c3a183ef7bd
parentaeb0f39362b2195d4aec418349538b5f8443f693 (diff)
ensure invalid user ids still render the ticket form
We still have strange urls requested like /pt/users/AnonymousUser.../tickets/new Not sure where they are coming from - but this should make sure we respond with sth. meaningful instead of erroring out. Conflicts: app/views/layouts/_content.html.haml
-rw-r--r--app/views/layouts/_content.html.haml2
-rw-r--r--engines/support/app/views/tickets/edit.html.haml1
-rw-r--r--engines/support/app/views/tickets/index.html.haml2
-rw-r--r--engines/support/app/views/tickets/new.html.haml5
-rw-r--r--engines/support/app/views/tickets/show.html.haml2
-rw-r--r--engines/support/test/functional/tickets_controller_test.rb6
6 files changed, 7 insertions, 11 deletions
diff --git a/app/views/layouts/_content.html.haml b/app/views/layouts/_content.html.haml
index 21d2e12..8e0bfbc 100644
--- a/app/views/layouts/_content.html.haml
+++ b/app/views/layouts/_content.html.haml
@@ -7,7 +7,7 @@
- else
- content = yield
-- if @show_navigation
+- if @show_navigation && @user
.col-md-2
= render 'layouts/navigation'
.col-md-10
diff --git a/engines/support/app/views/tickets/edit.html.haml b/engines/support/app/views/tickets/edit.html.haml
index 03bda7d..cdc5e16 100644
--- a/engines/support/app/views/tickets/edit.html.haml
+++ b/engines/support/app/views/tickets/edit.html.haml
@@ -1,4 +1,3 @@
-- @show_navigation = params[:user_id].present?
- @comment = TicketComment.new
.ticket
diff --git a/engines/support/app/views/tickets/index.html.haml b/engines/support/app/views/tickets/index.html.haml
index d107ce2..56c7012 100644
--- a/engines/support/app/views/tickets/index.html.haml
+++ b/engines/support/app/views/tickets/index.html.haml
@@ -1,5 +1,3 @@
-- @show_navigation = params[:user_id].present?
-
= render 'tickets/tabs'
= table @tickets, %w(subject created updated voices)
= paginate @tickets
diff --git a/engines/support/app/views/tickets/new.html.haml b/engines/support/app/views/tickets/new.html.haml
index d3580f9..d0b0f89 100644
--- a/engines/support/app/views/tickets/new.html.haml
+++ b/engines/support/app/views/tickets/new.html.haml
@@ -1,10 +1,5 @@
-- @show_navigation = params[:user_id].present?
-
= render 'tickets/tabs'
-- user = @user if admin?
-- user ||= current_user
-
= simple_form_for @ticket, :validate => true, :html => {:class => 'form-horizontal'} do |f|
= hidden_ticket_fields
= f.input :subject
diff --git a/engines/support/app/views/tickets/show.html.haml b/engines/support/app/views/tickets/show.html.haml
index 99afa2a..a625870 100644
--- a/engines/support/app/views/tickets/show.html.haml
+++ b/engines/support/app/views/tickets/show.html.haml
@@ -1,5 +1,3 @@
-- @show_navigation = params[:user_id].present?
-
.ticket
= render 'tickets/edit_form'
= render 'tickets/comments'
diff --git a/engines/support/test/functional/tickets_controller_test.rb b/engines/support/test/functional/tickets_controller_test.rb
index a7a2011..5c2b346 100644
--- a/engines/support/test/functional/tickets_controller_test.rb
+++ b/engines/support/test/functional/tickets_controller_test.rb
@@ -35,6 +35,12 @@ class TicketsControllerTest < ActionController::TestCase
assert_response :success
end
+ test "should get new despite invalid user_id" do
+ get :new, user_id: :bla
+ assert_equal Ticket, assigns(:ticket).class
+ assert_response :success
+ end
+
test "unauthenticated tickets are visible" do
ticket = find_record :ticket, :created_by => nil
get :show, :id => ticket.id