Fixed issue #1856 as a follow up of issue #949: Unpermitted customer field in customer create ticket view.

This commit is contained in:
Thorsten Eckel 2018-03-09 08:56:35 +01:00
commit dc00c7703b
4 changed files with 55 additions and 9 deletions

View file

@ -150,10 +150,6 @@ class App.Auth
# clear all in-memory data of all App.Model's # clear all in-memory data of all App.Model's
for model_key, model_object of App 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) if _.isFunction(model_object.clearInMemory)
model_object.clearInMemory() model_object.clearInMemory()

View file

@ -816,17 +816,16 @@ set new attributes of model (remove already available attributes)
) )
@clearInMemory: -> @clearInMemory: ->
return if !@className # reset callbacks to session based functions
@resetCallbacks()
# reset attributes to prevent cached forms on relogin # reset attributes to prevent cached forms on relogin
if !_.isEmpty(App[@className].org_configure_attributes) @resetAttributes()
App[@className].configure_attributes = App[@className].org_configure_attributes
# reset cached values of model # reset cached values of model
App[@className].deleteAll() @deleteAll()
@updateAttributes: (attributes) -> @updateAttributes: (attributes) ->
return if !@className
if _.isEmpty(@org_configure_attributes) if _.isEmpty(@org_configure_attributes)
# use jquery instead of ._clone() because we need a deep copy of the obj # use jquery instead of ._clone() because we need a deep copy of the obj

View file

@ -42,6 +42,7 @@ if [ "$LEVEL" == '1' ]; then
rm test/browser/agent_user_profile_test.rb rm test/browser/agent_user_profile_test.rb
# test/browser/auth_test.rb # test/browser/auth_test.rb
rm test/browser/chat_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/customer_ticket_create_test.rb
rm test/browser/first_steps_test.rb rm test/browser/first_steps_test.rb
# test/browser/form_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/agent_user_profile_test.rb
rm test/browser/auth_test.rb rm test/browser/auth_test.rb
rm test/browser/chat_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/customer_ticket_create_test.rb
rm test/browser/first_steps_test.rb rm test/browser/first_steps_test.rb
rm test/browser/form_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/agent_user_profile_test.rb
rm test/browser/auth_test.rb rm test/browser/auth_test.rb
rm test/browser/chat_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/customer_ticket_create_test.rb
rm test/browser/first_steps_test.rb rm test/browser/first_steps_test.rb
rm test/browser/form_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/agent_user_profile_test.rb
rm test/browser/auth_test.rb rm test/browser/auth_test.rb
rm test/browser/chat_test.rb rm test/browser/chat_test.rb
# test/browser/customer_ticket_create_fields_test.rb
# test/browser/customer_ticket_create_test.rb # test/browser/customer_ticket_create_test.rb
rm test/browser/first_steps_test.rb rm test/browser/first_steps_test.rb
rm test/browser/form_test.rb rm test/browser/form_test.rb
@ -281,6 +285,7 @@ elif [ "$LEVEL" == '5' ]; then
# test/browser/agent_user_profile_test.rb # test/browser/agent_user_profile_test.rb
rm test/browser/auth_test.rb rm test/browser/auth_test.rb
rm test/browser/chat_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/customer_ticket_create_test.rb
rm test/browser/first_steps_test.rb rm test/browser/first_steps_test.rb
rm test/browser/form_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/agent_user_profile_test.rb
rm test/browser/auth_test.rb rm test/browser/auth_test.rb
# test/browser/chat_test.rb # 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/customer_ticket_create_test.rb
# test/browser/first_steps_test.rb # test/browser/first_steps_test.rb
rm test/browser/form_test.rb rm test/browser/form_test.rb

View file

@ -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