From e6ea12c75c15ae256caf5f422be8ecee692651eb Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Tue, 22 Mar 2016 09:50:35 +0100 Subject: [PATCH 1/5] Do not remove permanent .popover--notifications widget. --- .../app/controllers/_application_controller.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/app/controllers/_application_controller.coffee b/app/assets/javascripts/app/controllers/_application_controller.coffee index 07645cbc2..9132145b2 100644 --- a/app/assets/javascripts/app/controllers/_application_controller.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller.coffee @@ -469,7 +469,9 @@ class App.Controller extends Spine.Controller @userTicketPopupsList.popover('destroy') anyPopoversDestroy: -> - $('.popover').remove() + + # do not remove permanent .popover--notifications widget + $('.popover:not(.popover--notifications)').remove() recentView: (object, o_id) => params = From fe9174da9c5fcf6e8e4fb3bb7f21e5764d1380af Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Tue, 22 Mar 2016 11:50:12 +0100 Subject: [PATCH 2/5] Prevent multiple online notification objects and replace ctrl+alt+y with ctrl+alt+a (because of issues in browsers). --- .../app/controllers/navigation.coffee | 7 +++++ .../widget/keyboard_shortcuts.coffee | 2 +- .../widget/online_notification.coffee | 20 +++++++++----- .../javascripts/app/lib/app_init/track.coffee | 26 ++++++++++++++----- test/browser/keyboard_shortcuts_test.rb | 19 ++++++++++++-- test/browser_test_helper.rb | 3 +++ 6 files changed, 61 insertions(+), 16 deletions(-) diff --git a/app/assets/javascripts/app/controllers/navigation.coffee b/app/assets/javascripts/app/controllers/navigation.coffee index 8b5155af8..768a62fb6 100644 --- a/app/assets/javascripts/app/controllers/navigation.coffee +++ b/app/assets/javascripts/app/controllers/navigation.coffee @@ -49,6 +49,11 @@ class App.Navigation extends App.ControllerWidgetPermanent else @$('.bell').removeClass('show') + release: => + if @notificationWidget + @notificationWidget.remove() + @notificationWidget = undefined + renderMenu: => items = @getItems( navbar: @Config.get( 'NavBar' ) ) @@ -205,6 +210,8 @@ class App.Navigation extends App.ControllerWidgetPermanent @emptyAndClose() ) + if @notificationWidget + @notificationWidget.remove() @notificationWidget = new App.OnlineNotificationWidget() $('#app').append @notificationWidget.el diff --git a/app/assets/javascripts/app/controllers/widget/keyboard_shortcuts.coffee b/app/assets/javascripts/app/controllers/widget/keyboard_shortcuts.coffee index bd69223ed..64e82fe1f 100644 --- a/app/assets/javascripts/app/controllers/widget/keyboard_shortcuts.coffee +++ b/app/assets/javascripts/app/controllers/widget/keyboard_shortcuts.coffee @@ -83,7 +83,7 @@ App.Config.set( $('#global-search').focus() } { - key: 'y' + key: 'a' hotkeys: true description: 'Notifications' callback: (e) -> diff --git a/app/assets/javascripts/app/controllers/widget/online_notification.coffee b/app/assets/javascripts/app/controllers/widget/online_notification.coffee index f03bde6d7..391ce2a16 100644 --- a/app/assets/javascripts/app/controllers/widget/online_notification.coffee +++ b/app/assets/javascripts/app/controllers/widget/online_notification.coffee @@ -44,10 +44,12 @@ class App.OnlineNotificationWidget extends App.Controller @bind 'auth', (user) => if !user @counterUpdate(0) - else - if !@access() - @counterUpdate(0) - return + return + if !@access() + @counterUpdate(0) + return + if !@subscribeId + @subscribeId = App.OnlineNotification.subscribe(@updateContent) if @access() @subscribeId = App.OnlineNotification.subscribe(@updateContent) @@ -69,9 +71,7 @@ class App.OnlineNotificationWidget extends App.Controller access: -> return false if !@Session.get() - return true if @isRole('Agent') - return true if @isRole('Admin') - return false + return true listNavigate: (e) => if e.keyCode is 27 # close on esc @@ -140,7 +140,9 @@ class App.OnlineNotificationWidget extends App.Controller heightPopoverSpacer = 22 heightPopoverHeader = @header.outerHeight(true) isOverflowing = false + heightPopoverContent = 0 @item.each (i, el) => + # accumulate height of items heightPopoverContent += el.clientHeight @@ -206,6 +208,7 @@ class App.OnlineNotificationWidget extends App.Controller @show() show: => + return if !@access() $(window).on 'keydown.notifications', @listNavigate @shown = true @el.show() @@ -230,3 +233,6 @@ class App.OnlineNotificationWidget extends App.Controller id = row.data('id') App.OnlineNotification.destroy(id) @updateHeight() + + remove: => + @el.remove() \ No newline at end of file diff --git a/app/assets/javascripts/app/lib/app_init/track.coffee b/app/assets/javascripts/app/lib/app_init/track.coffee index 5db73b967..160cfb1fa 100644 --- a/app/assets/javascripts/app/lib/app_init/track.coffee +++ b/app/assets/javascripts/app/lib/app_init/track.coffee @@ -15,6 +15,11 @@ class App.Track _instance ?= new _trackSingleton _instance.send() + @force: (value) -> + if _instance == undefined + _instance ?= new _trackSingleton + _instance.force(value) + @_all: -> if _instance == undefined _instance ?= new _trackSingleton @@ -28,6 +33,8 @@ class _trackSingleton # @url = 'http://localhost:3005/api/v1/ui' @url = 'https://log.zammad.com/api/v1/ui' + @forceSending = false + @log('start', 'notice', {}) # start initial submit 30 sec. later to avoid ie10 cookie issues @@ -104,11 +111,10 @@ class _trackSingleton return ) - log: (facility, level, args) -> - return if App.Config.get('developer_mode') - return if !App.Config.get('ui_send_client_stats') + log: (facility, level, args) => + return if !@shouldSend() info = - time: Math.round( new Date().getTime() / 1000 ) + time: Math.round(new Date().getTime() / 1000) facility: facility level: level location: window.location.pathname + window.location.hash @@ -116,8 +122,7 @@ class _trackSingleton @data.push info send: (async = true) => - return if App.Config.get('developer_mode') - return if !App.Config.get('ui_send_client_stats') + return if !@shouldSend() return if _.isEmpty @data newData = _.clone(@data) @data = [] @@ -155,6 +160,15 @@ class _trackSingleton @data.push item ) + force: (value = true) -> + @forceSending = value + + shouldSend: -> + return true if @forceSending + return false if App.Config.get('developer_mode') + return false if !App.Config.get('ui_send_client_stats') + true + _all: -> @data diff --git a/test/browser/keyboard_shortcuts_test.rb b/test/browser/keyboard_shortcuts_test.rb index ad355a9e8..a2dc7f597 100644 --- a/test/browser/keyboard_shortcuts_test.rb +++ b/test/browser/keyboard_shortcuts_test.rb @@ -35,6 +35,21 @@ class KeyboardShortcutsTest < TestCase timeout: 2, ) + # show notifications + shortcut(key: 'a') + watch_for( + css: '.js-notificationsContainer .js-header', + value: 'Notification', + timeout: 10, + ) + + shortcut(key: 'a') + watch_for_disappear( + css: '.js-notificationsContainer .js-header', + value: 'Notification', + timeout: 2, + ) + # go to overviews shortcut(key: 'o') watch_for( @@ -172,7 +187,7 @@ class KeyboardShortcutsTest < TestCase }, ) sleep 5 - shortcut(key: 'y') + shortcut(key: 'a') watch_for( css: '.js-notificationsContainer', value: 'Test Ticket for Shortcuts II', @@ -183,7 +198,7 @@ class KeyboardShortcutsTest < TestCase watch_for( css: '.active.content', value: ticket2[:number], - timeout: 2, + timeout: 3, ) shortcut(key: 'e') diff --git a/test/browser_test_helper.rb b/test/browser_test_helper.rb index d33dff2ae..7d663b5b1 100644 --- a/test/browser_test_helper.rb +++ b/test/browser_test_helper.rb @@ -139,6 +139,9 @@ class TestCase < Test::Unit::TestCase instance.get(params[:url]) end + # submit logs anyway + instance.execute_script('App.Track.force()') + element = instance.find_elements(css: '#login input[name="username"]')[0] if !element From 5907f51808a339388522b173883ee93997719458 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Tue, 22 Mar 2016 13:58:48 +0100 Subject: [PATCH 3/5] Improved timing. --- test/browser/customer_ticket_create_test.rb | 10 ++--- test/browser_test_helper.rb | 44 ++++++++++----------- 2 files changed, 26 insertions(+), 28 deletions(-) diff --git a/test/browser/customer_ticket_create_test.rb b/test/browser/customer_ticket_create_test.rb index b1fa624ee..bbc381a2f 100644 --- a/test/browser/customer_ticket_create_test.rb +++ b/test/browser/customer_ticket_create_test.rb @@ -11,8 +11,8 @@ class CustomerTicketCreateTest < TestCase ) # customer ticket create - click( css: 'a[href="#new"]' ) - click( css: 'a[href="#customer_ticket_new"]' ) + click(css: 'a[href="#new"]') + click(css: 'a[href="#customer_ticket_new"]') sleep 2 select( @@ -28,11 +28,11 @@ class CustomerTicketCreateTest < TestCase css: '.newTicket [data-name="body"]', value: 'some body 123äöü', ) - click( css: '.newTicket button.js-submit' ) + click(css: '.newTicket button.js-submit') sleep 5 # check if ticket is shown - location_check( url: '#ticket/zoom/' ) + location_check(url: '#ticket/zoom/') match( css: '.active div.ticket-article', @@ -51,7 +51,7 @@ class CustomerTicketCreateTest < TestCase type: 'stayOnTab', ) - click( css: '.active .js-submit' ) + click(css: '.active .js-submit') watch_for( css: '.active div.ticket-article', diff --git a/test/browser_test_helper.rb b/test/browser_test_helper.rb index 7d663b5b1..b15c77691 100644 --- a/test/browser_test_helper.rb +++ b/test/browser_test_helper.rb @@ -366,7 +366,6 @@ class TestCase < Test::Unit::TestCase #if element # instance.mouse.move_to(element) #end - sleep 0.2 element.click rescue => e sleep 0.5 @@ -377,15 +376,14 @@ class TestCase < Test::Unit::TestCase #if element # instance.mouse.move_to(element) #end - sleep 0.2 element.click end else - sleep 1 + sleep 0.5 instance.find_elements(partial_link_text: params[:text])[0].click end - sleep 0.4 if !params[:fast] + sleep 0.2 if !params[:fast] sleep params[:wait] if params[:wait] end @@ -520,7 +518,7 @@ class TestCase < Test::Unit::TestCase instance.execute_script("$('#{params[:css]}').blur()") end - sleep 0.5 + sleep 0.2 end =begin @@ -546,11 +544,11 @@ class TestCase < Test::Unit::TestCase element = instance.find_elements(css: "#{params[:css]}.js-shadow + .js-input")[0] element.click element.clear - sleep 1 + sleep 0.5 element.send_keys(params[:value]) - sleep 0.5 + sleep 0.2 element.send_keys(:enter) - sleep 0.5 + sleep 0.2 return end @@ -576,7 +574,7 @@ class TestCase < Test::Unit::TestCase dropdown.select_by(:text, params[:value]) #puts "select2 - #{params.inspect}" end - sleep 0.8 + sleep 0.5 end =begin @@ -671,9 +669,9 @@ class TestCase < Test::Unit::TestCase end instance.action.send_keys(params[:value]).perform if params[:slow] - sleep 2 + sleep 1.5 else - sleep 0.3 + sleep 0.2 end end @@ -760,7 +758,7 @@ class TestCase < Test::Unit::TestCase elsif !params[:should_not_match] raise "not matching '#{params[:value]}' in content '#{text}' but should!" end - sleep 0.8 + sleep 0.2 match end @@ -1218,7 +1216,7 @@ wait untill text in selector disabppears # accept task close warning if instance.find_elements(css: '.modal button.js-submit')[0] - sleep 0.5 + sleep 0.4 instance.find_elements(css: '.modal button.js-submit')[0].click end end @@ -1287,16 +1285,16 @@ wait untill text in selector disabppears # workaround, sometimes focus is not triggered element.send_keys(params[:customer]) - sleep 3.5 + sleep 2.5 # check if pulldown is open, it's not working stable via selenium #instance.execute_script("$('#{params[:css]} .js-recipientDropdown').addClass('open')") #sleep 0.5 element.send_keys(:arrow_down) - sleep 0.3 + sleep 0.2 element.send_keys(:enter) #instance.find_elements(css: params[:css] + ' .recipientList-entry.js-user.is-active')[0].click - sleep 0.6 + sleep 0.4 assert(true, 'ticket_customer_select') end @@ -1548,7 +1546,7 @@ wait untill text in selector disabppears screenshot(browser: instance, comment: 'ticket_create_failed') raise 'no ticket create screen found!' end - sleep 1 + sleep 0.4 if data[:group] if data[:group] == '-NONE-' @@ -1616,16 +1614,16 @@ wait untill text in selector disabppears # workaround, sometimes focus is not triggered element.send_keys(data[:customer]) - sleep 3.5 + sleep 2.5 # check if pulldown is open, it's not working stable via selenium #instance.execute_script("$('.active .newTicket .js-recipientDropdown').addClass('open')") #sleep 0.5 element.send_keys(:arrow_down) - sleep 0.3 + sleep 0.2 element.send_keys(:enter) #instance.find_elements(css: '.active .newTicket .recipientList-entry.js-user.is-active')[0].click - sleep 0.6 + sleep 0.4 end if data[:attachment] @@ -1745,16 +1743,16 @@ wait untill text in selector disabppears # workaround, sometimes focus is not triggered element.send_keys(data[:customer]) - sleep 3.5 + sleep 2.5 # check if pulldown is open, it's not working stable via selenium #instance.execute_script("$('.modal .user_autocompletion .js-recipientDropdown').addClass('open')") #sleep 0.5 element.send_keys(:arrow_down) - sleep 0.6 + sleep 0.4 element.send_keys(:enter) #instance.find_elements(css: '.modal .user_autocompletion .recipientList-entry.js-user.is-active')[0].click - sleep 0.3 + sleep 0.2 click(browser: instance, css: '.modal .js-submit') From 427f4fd1cdc4b6c76fdc292368022a5bb275592d Mon Sep 17 00:00:00 2001 From: Roy Kaldung Date: Tue, 22 Mar 2016 14:38:08 +0100 Subject: [PATCH 4/5] fixed typo --- app/views/mailer/ticket_reminder_reached/en.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/mailer/ticket_reminder_reached/en.html.erb b/app/views/mailer/ticket_reminder_reached/en.html.erb index 3b0576a6d..91830d753 100644 --- a/app/views/mailer/ticket_reminder_reached/en.html.erb +++ b/app/views/mailer/ticket_reminder_reached/en.html.erb @@ -2,7 +2,7 @@ Reminder reached (<%= d 'ticket.title' %>)

Hi <%= d 'recipient.firstname' %>,


-

ticket needs attachen, reminder reached for Ticket (<%= d 'ticket.title' %>) with customer "<%= d 'ticket.customer.longname' %>".

+

Ticket needs attention, reminder reached for ticket (<%= d 'ticket.title' %>) with customer "<%= d 'ticket.customer.longname' %>".


<% if @objects[:article] %>

From 169386a941c2225de8bf523d0371a80228c08037 Mon Sep 17 00:00:00 2001 From: Roy Kaldung Date: Tue, 22 Mar 2016 14:54:31 +0100 Subject: [PATCH 5/5] changed content of en mails --- app/views/mailer/password_change/en.html.erb | 2 +- app/views/mailer/password_reset/en.html.erb | 2 +- app/views/mailer/signup/en.html.erb | 2 +- app/views/mailer/test_ticket/en.html.erb | 2 +- app/views/mailer/ticket_create/en.html.erb | 2 +- app/views/mailer/ticket_escalation/en.html.erb | 2 +- app/views/mailer/ticket_escalation_warning/en.html.erb | 2 +- app/views/mailer/user_device/en.html.erb | 4 ++-- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/views/mailer/password_change/en.html.erb b/app/views/mailer/password_change/en.html.erb index f48793398..81eb723b5 100644 --- a/app/views/mailer/password_change/en.html.erb +++ b/app/views/mailer/password_change/en.html.erb @@ -2,7 +2,7 @@ Your <%= c 'product_name' %> password has been changed

Hi <%= d 'user.firstname' %>,


-

the password for your <%= c 'product_name' %> account <%= d 'user.login' %> has been changed recently.

+

The password for your <%= c 'product_name' %> account <%= d 'user.login' %> has been changed recently.


This activity is not known to you? If not, contact your system administrator.


diff --git a/app/views/mailer/password_reset/en.html.erb b/app/views/mailer/password_reset/en.html.erb index 33dbecf6b..92513020d 100644 --- a/app/views/mailer/password_reset/en.html.erb +++ b/app/views/mailer/password_reset/en.html.erb @@ -10,6 +10,6 @@ Reset your <%= c 'product_name' %> password

This link takes you to a page where you can change your password.


-

If you don't want to reset your password, please ignore this message. Your password will not be reset.

+

If you don't want to reset your password, please ignore this message. Your password will not be reseted.


Your <%= c 'product_name' %> Team

diff --git a/app/views/mailer/signup/en.html.erb b/app/views/mailer/signup/en.html.erb index f0818eb3a..9d0ee059e 100644 --- a/app/views/mailer/signup/en.html.erb +++ b/app/views/mailer/signup/en.html.erb @@ -2,7 +2,7 @@ Confirm your <%= c 'product_name' %> account, <%= d 'user.firstname' %> <%= d 'u

Hi <%= d 'user.firstname' %>,


-

confirm your email address to complete your <%= c 'product_name' %> account. It's easy, just click the link below.

+

Confirm your email address to complete your <%= c 'product_name' %> account. It's easy, just click the link below.


<%= c 'http_type' %>://<%= c 'fqdn' %>/#email_verify/<%= d 'token.name' %>


diff --git a/app/views/mailer/test_ticket/en.html.erb b/app/views/mailer/test_ticket/en.html.erb index b3443445d..4b6db281e 100644 --- a/app/views/mailer/test_ticket/en.html.erb +++ b/app/views/mailer/test_ticket/en.html.erb @@ -2,7 +2,7 @@ Test Ticket!

Dear <%= d 'agent.firstname' %>,


-

this is a Test Ticket. I'm a customer and I need some help! :)

+

This is a test ticket. I'm a customer and I need some help! :)


<%= d 'customer.fullname' %>


diff --git a/app/views/mailer/ticket_create/en.html.erb b/app/views/mailer/ticket_create/en.html.erb index 76f663000..06cb4bb28 100644 --- a/app/views/mailer/ticket_create/en.html.erb +++ b/app/views/mailer/ticket_create/en.html.erb @@ -2,7 +2,7 @@ New Ticket (<%= d 'ticket.title' %>)

Hi <%= d 'recipient.firstname' %>,


-

a new Ticket (<%= d 'ticket.title' %>) has been created by "<%= d 'ticket.updated_by.longname' %>".

+

A new ticket (<%= d 'ticket.title' %>) has been created by "<%= d 'ticket.updated_by.longname' %>".


<%= t 'Group' %>: <%= d 'ticket.group.name' %>
diff --git a/app/views/mailer/ticket_escalation/en.html.erb b/app/views/mailer/ticket_escalation/en.html.erb index ac382fdf7..017472a7e 100644 --- a/app/views/mailer/ticket_escalation/en.html.erb +++ b/app/views/mailer/ticket_escalation/en.html.erb @@ -2,7 +2,7 @@ Ticket is escalated (<%= d 'ticket.title' %>)

Hi <%= d 'recipient.firstname' %>,


-

Ticket (<%= d 'ticket.title' %>) from "<%= d 'ticket.customer.longname' %>" is escalated since "<%= d 'ticket.escalation_time' %>"!

+

A ticket (<%= d 'ticket.title' %>) from "<%= d 'ticket.customer.longname' %>" is escalated since "<%= d 'ticket.escalation_time' %>"!


<% if @objects[:article] %>

diff --git a/app/views/mailer/ticket_escalation_warning/en.html.erb b/app/views/mailer/ticket_escalation_warning/en.html.erb index 7914b6fa1..d376e0c20 100644 --- a/app/views/mailer/ticket_escalation_warning/en.html.erb +++ b/app/views/mailer/ticket_escalation_warning/en.html.erb @@ -2,7 +2,7 @@ Ticket will escalated (<%= d 'ticket.title' %>)

Hi <%= d 'recipient.firstname' %>,


-

Ticket (<%= d 'ticket.title' %>) from "<%= d 'ticket.customer.longname' %>" will escalated at "<%= d 'ticket.escalation_time' %>"!

+

a ticket (<%= d 'ticket.title' %>) from "<%= d 'ticket.customer.longname' %>" will escalate at "<%= d 'ticket.escalation_time' %>"!


<% if @objects[:article] %>

diff --git a/app/views/mailer/user_device/en.html.erb b/app/views/mailer/user_device/en.html.erb index 57a33213b..6733edf7a 100644 --- a/app/views/mailer/user_device/en.html.erb +++ b/app/views/mailer/user_device/en.html.erb @@ -2,10 +2,10 @@

Hi <%= d 'user.firstname' %>,


-

it looks like you signed into your <%= c 'product_name' %> account using a new device on "<%= d 'user_device.created_at' %>":

+

It looks like you signed into your <%= c 'product_name' %> account using a new device on "<%= d 'user_device.created_at' %>":


-Your Location: <%= d 'user_device.location' %>
+Your location: <%= d 'user_device.location' %>
Your IP: <%= d 'user_device.ip' %>