diff --git a/app/assets/javascripts/app/lib/app_post/auth.coffee b/app/assets/javascripts/app/lib/app_post/auth.coffee index 7f95f2375..c15c6b2e7 100644 --- a/app/assets/javascripts/app/lib/app_post/auth.coffee +++ b/app/assets/javascripts/app/lib/app_post/auth.coffee @@ -150,10 +150,6 @@ class App.Auth # clear all in-memory data of all App.Model's for model_key, model_object of App - if _.isFunction(model_object.resetCallbacks) - model_object.resetCallbacks() - if _.isFunction(model_object.resetAttributes) - model_object.resetAttributes() if _.isFunction(model_object.clearInMemory) model_object.clearInMemory() diff --git a/app/assets/javascripts/app/models/_application_model.coffee b/app/assets/javascripts/app/models/_application_model.coffee index ba5b442d3..ce05630e6 100644 --- a/app/assets/javascripts/app/models/_application_model.coffee +++ b/app/assets/javascripts/app/models/_application_model.coffee @@ -816,17 +816,16 @@ set new attributes of model (remove already available attributes) ) @clearInMemory: -> - return if !@className + # reset callbacks to session based functions + @resetCallbacks() # reset attributes to prevent cached forms on relogin - if !_.isEmpty(App[@className].org_configure_attributes) - App[@className].configure_attributes = App[@className].org_configure_attributes + @resetAttributes() # reset cached values of model - App[@className].deleteAll() + @deleteAll() @updateAttributes: (attributes) -> - return if !@className if _.isEmpty(@org_configure_attributes) # use jquery instead of ._clone() because we need a deep copy of the obj diff --git a/script/build/test_slice_tests.sh b/script/build/test_slice_tests.sh index 470d66942..7fd644c28 100755 --- a/script/build/test_slice_tests.sh +++ b/script/build/test_slice_tests.sh @@ -42,6 +42,7 @@ if [ "$LEVEL" == '1' ]; then rm test/browser/agent_user_profile_test.rb # test/browser/auth_test.rb rm test/browser/chat_test.rb + rm test/browser/customer_ticket_create_fields_test.rb rm test/browser/customer_ticket_create_test.rb rm test/browser/first_steps_test.rb # test/browser/form_test.rb @@ -102,6 +103,7 @@ elif [ "$LEVEL" == '2' ]; then rm test/browser/agent_user_profile_test.rb rm test/browser/auth_test.rb rm test/browser/chat_test.rb + rm test/browser/customer_ticket_create_fields_test.rb rm test/browser/customer_ticket_create_test.rb rm test/browser/first_steps_test.rb rm test/browser/form_test.rb @@ -162,6 +164,7 @@ elif [ "$LEVEL" == '3' ]; then rm test/browser/agent_user_profile_test.rb rm test/browser/auth_test.rb rm test/browser/chat_test.rb + rm test/browser/customer_ticket_create_fields_test.rb rm test/browser/customer_ticket_create_test.rb rm test/browser/first_steps_test.rb rm test/browser/form_test.rb @@ -222,6 +225,7 @@ elif [ "$LEVEL" == '4' ]; then rm test/browser/agent_user_profile_test.rb rm test/browser/auth_test.rb rm test/browser/chat_test.rb + # test/browser/customer_ticket_create_fields_test.rb # test/browser/customer_ticket_create_test.rb rm test/browser/first_steps_test.rb rm test/browser/form_test.rb @@ -281,6 +285,7 @@ elif [ "$LEVEL" == '5' ]; then # test/browser/agent_user_profile_test.rb rm test/browser/auth_test.rb rm test/browser/chat_test.rb + rm test/browser/customer_ticket_create_fields_test.rb rm test/browser/customer_ticket_create_test.rb rm test/browser/first_steps_test.rb rm test/browser/form_test.rb @@ -343,6 +348,7 @@ elif [ "$LEVEL" == '6' ]; then rm test/browser/agent_user_profile_test.rb rm test/browser/auth_test.rb # test/browser/chat_test.rb + rm test/browser/customer_ticket_create_fields_test.rb rm test/browser/customer_ticket_create_test.rb # test/browser/first_steps_test.rb rm test/browser/form_test.rb diff --git a/test/browser/customer_ticket_create_fields_test.rb b/test/browser/customer_ticket_create_fields_test.rb new file mode 100644 index 000000000..1b7b59add --- /dev/null +++ b/test/browser/customer_ticket_create_fields_test.rb @@ -0,0 +1,45 @@ +require 'browser_test_helper' + +class CustomerTicketCreateFieldsTest < TestCase + def test_customer_ticket_create_fields + @browser = browser_instance + + # create agent session and fetch object attributes + login( + username: 'master@example.com', + password: 'test', + url: browser_url, + ) + # remove local object attributes bound to the session + logout() + + # re-create agent session and fetch object attributes + login( + username: 'master@example.com', + password: 'test', + url: browser_url, + ) + # re-remove local object attributes bound to the session + # there was an issue (#1856) where the old attribute values + # persisted and were stored as the original attributes + logout() + + # create customer session and fetch object attributes + login( + username: 'nicole.braun@zammad.org', + password: 'test', + url: browser_url, + ) + + # customer ticket create + click(css: 'a[href="#new"]', only_if_exists: true) + click(css: 'a[href="#customer_ticket_new"]') + sleep 2 + + # ensure that the object attributes of the agent session + # were removed properly and won't get displayed in the form + exists_not( + css: '.newTicket input[name="customer_id"]', + ) + end +end