From 80b535df0f8bcdb8f547af7032bb794d481f894d Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Wed, 21 Mar 2018 11:28:52 +0100 Subject: [PATCH] Fixed issue #1859 - Login fails after fast logout right after previous login. --- .rubocop.yml | 9 +++++-- Gemfile | 4 +-- .../controllers/agent_ticket_create.coffee | 26 +++++++++++++------ .../widget/online_notification.coffee | 2 +- .../app/lib/app_post/task_manager.coffee | 5 +++- .../app/models/_application_model.coffee | 14 +++++----- 6 files changed, 39 insertions(+), 21 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 6e91d3296..2815b6e48 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -35,7 +35,12 @@ Style/IfUnlessModifier: StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier' Enabled: false -Style/TrailingCommaInLiteral: +Style/TrailingCommaInArrayLiteral: + Description: 'Checks for trailing comma in array and hash literals.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas' + Enabled: false + +Style/TrailingCommaInHashLiteral: Description: 'Checks for trailing comma in array and hash literals.' StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas' Enabled: false @@ -199,7 +204,7 @@ Metrics/ModuleLength: Metrics/BlockLength: Enabled: false -Lint/RescueWithoutErrorClass: +Style/RescueStandardError: Enabled: false Rails/ApplicationRecord: diff --git a/Gemfile b/Gemfile index c980c2377..3a0084fb5 100644 --- a/Gemfile +++ b/Gemfile @@ -1,8 +1,8 @@ source 'https://rubygems.org' # core - base -ruby '2.4.2' -gem 'rails', '5.1.4' +ruby '2.4.3' +gem 'rails', '5.1.5' # core - rails additions gem 'activerecord-session_store' diff --git a/app/assets/javascripts/app/controllers/agent_ticket_create.coffee b/app/assets/javascripts/app/controllers/agent_ticket_create.coffee index 2d5db5aac..ee07ee658 100644 --- a/app/assets/javascripts/app/controllers/agent_ticket_create.coffee +++ b/app/assets/javascripts/app/controllers/agent_ticket_create.coffee @@ -16,6 +16,8 @@ class App.TicketCreate extends App.Controller @formId = App.ControllerForm.formId() + @queueKey = "TicketCreate#{@taskKey}" + # remember split info if exists @split = '' if @ticket_id && @article_id @@ -30,7 +32,7 @@ class App.TicketCreate extends App.Controller # rerender view, e. g. on langauge change @bind('ui:rerender', => return if !@authenticateCheck() - @render() + @renderQueue() ) # listen to rerender sidebars @@ -126,13 +128,13 @@ class App.TicketCreate extends App.Controller "#ticket/create/id/#{@id}" show: => - @navupdate "#ticket/create/id/#{@id}#{@split}", type: 'menu' + @navupdate("#ticket/create/id/#{@id}#{@split}", type: 'menu') @autosaveStart() - @bind('ticket_create_rerender', (template) => @render(template)) + @bind('ticket_create_rerender', (template) => @renderQueue(template)) hide: => @autosaveStop() - @unbind('ticket_create_rerender', (template) => @render(template)) + @unbind('ticket_create_rerender', (template) => @renderQueue(template)) changed: => formCurrent = @formParam( @$('.ticket-create') ) @@ -174,9 +176,9 @@ class App.TicketCreate extends App.Controller if _.isEmpty(params.ticket_id) && _.isEmpty(params.article_id) if !_.isEmpty(params.customer_id) - @render(options: { customer_id: params.customer_id }) + @renderQueue(options: { customer_id: params.customer_id }) return - @render() + @renderQueue() return # fetch split ticket data @@ -213,11 +215,19 @@ class App.TicketCreate extends App.Controller t.attachments = data.attachments # render page - @render(options: t) + @renderQueue(options: t) ) - render: (template = {}) -> + renderQueue: (template = {}) => + localeRender = => + @render(options: template) + @render() + App.QueueManager.add(@queueKey, localeRender) + return if !@formMeta + App.QueueManager.run(@queueKey) + render: (template = {}) -> + return if !@formMeta # get params params = @prefilledParams || {} if template && !_.isEmpty(template.options) diff --git a/app/assets/javascripts/app/controllers/widget/online_notification.coffee b/app/assets/javascripts/app/controllers/widget/online_notification.coffee index 8f7b99f2f..dc3375c90 100644 --- a/app/assets/javascripts/app/controllers/widget/online_notification.coffee +++ b/app/assets/javascripts/app/controllers/widget/online_notification.coffee @@ -155,7 +155,7 @@ class App.OnlineNotificationWidget extends App.Controller fetch: => load = => @fetchedData = true - App.OnlineNotification.fetchFull(load, clear: true) + App.OnlineNotification.fetchFull(load, clear: true, force: true) toggle: => if @shown diff --git a/app/assets/javascripts/app/lib/app_post/task_manager.coffee b/app/assets/javascripts/app/lib/app_post/task_manager.coffee index 596c18f9c..affb98afc 100644 --- a/app/assets/javascripts/app/lib/app_post/task_manager.coffee +++ b/app/assets/javascripts/app/lib/app_post/task_manager.coffee @@ -175,7 +175,10 @@ class _taskManagerSingleton extends App.Controller @queueRunning = true loop param = @queue.shift() - @executeSingel(param) + try + @executeSingel(param) + catch e + @log 'error', 'executeSingel task:', param.key, e if !@queue[0] @queueRunning = false break diff --git a/app/assets/javascripts/app/models/_application_model.coffee b/app/assets/javascripts/app/models/_application_model.coffee index 1f262cbe6..0a88e7f27 100644 --- a/app/assets/javascripts/app/models/_application_model.coffee +++ b/app/assets/javascripts/app/models/_application_model.coffee @@ -302,7 +302,7 @@ set new attributes of model (remove already available attributes) url: url processData: true, success: (data, status, xhr) => - @FULL_FETCH[ data.id ] = false + @FULL_FETCH[id] = false App.Log.debug('Model', "got #{@className}.find(#{id}) from server", data) @@ -315,15 +315,15 @@ set new attributes of model (remove already available attributes) App[@className].refresh(data) # execute callbacks - if @FULL_CALLBACK[ data.id ] - for key, callback of @FULL_CALLBACK[ data.id ] + if @FULL_CALLBACK[data.id] + for key, callback of @FULL_CALLBACK[data.id] callback( @_fillUp( App[@className].find(data.id) ) ) - delete @FULL_CALLBACK[ data.id ][ key ] - if _.isEmpty @FULL_CALLBACK[ data.id ] - delete @FULL_CALLBACK[ data.id ] + delete @FULL_CALLBACK[data.id][key] + if _.isEmpty @FULL_CALLBACK[data.id] + delete @FULL_CALLBACK[data.id] error: (xhr, statusText, error) => - @FULL_FETCH[ data.id ] = false + @FULL_FETCH[id] = false App.Log.error('Model', statusText, error, url) ) subscribeId