diff --git a/app/assets/javascripts/app/controllers/_ui_element/ticket_perform_action.coffee b/app/assets/javascripts/app/controllers/_ui_element/ticket_perform_action.coffee index a46e6de40..d53da8ec4 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/ticket_perform_action.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/ticket_perform_action.coffee @@ -333,7 +333,15 @@ class App.UiElement.ticket_perform_action 'relative' ] - if _.include(relative_operators, meta.operator) + upcoming_operator = meta.operator + + if !_.include(config.operator, upcoming_operator) + if Array.isArray(config.operator) + upcoming_operator = config.operator[0] + else + upcoming_operator = null + + if _.include(relative_operators, upcoming_operator) config['name'] = "#{attribute.name}::#{groupAndAttribute}" if attribute.value && attribute.value[groupAndAttribute] config['value'] = _.clone(attribute.value[groupAndAttribute]) diff --git a/public/assets/tests/form_ticket_perform_action.js b/public/assets/tests/form_ticket_perform_action.js index 979298629..ba79b63f8 100644 --- a/public/assets/tests/form_ticket_perform_action.js +++ b/public/assets/tests/form_ticket_perform_action.js @@ -1,5 +1,5 @@ // ticket_perform_action -test( "ticket_perform_action check", function() { +test( "ticket_perform_action check", function(assert) { App.TicketPriority.refresh([ { @@ -251,7 +251,6 @@ test( "ticket_perform_action check", function() { row.find('.js-datepicker').datepicker('setDate') row.find('.js-timepicker').val(date_parsed.getHours() + ':' + date_parsed.getMinutes()).trigger('blur') - params = App.ControllerForm.params(el) test_params = { ticket_perform_action1: { 'ticket.state_id': { @@ -288,7 +287,14 @@ test( "ticket_perform_action check", function() { } } } - deepEqual(params, test_params, 'form param check') + + var done = assert.async() + + setTimeout(function(){ + params = App.ControllerForm.params(el) + deepEqual(params, test_params, 'form param check') + done() + }, 0); // switch pending time to relative @@ -504,3 +510,39 @@ test( "ticket_perform_action backwards check after PR#2862", function() { deepEqual(params, test_params, 'form param check') }); + +test( "ticket_perform_action orphan time fields", function() { + $('#forms').append('