From 6d43806e86f34b0a0e1dfa44a32f234afbb1f05b Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Mon, 8 Feb 2016 22:38:52 +0100 Subject: [PATCH] Reworked function of profile notification settings. --- .../controllers/_profile/notification.coffee | 21 +++++++++++++------ .../app/views/profile/notification.jst.eco | 14 ++++++------- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/app/assets/javascripts/app/controllers/_profile/notification.coffee b/app/assets/javascripts/app/controllers/_profile/notification.coffee index d63c79618..3d46d3098 100644 --- a/app/assets/javascripts/app/controllers/_profile/notification.coffee +++ b/app/assets/javascripts/app/controllers/_profile/notification.coffee @@ -80,16 +80,25 @@ class Index extends App.Controller params.notification_config[area[0]] = {} if !params.notification_config[area[0]][area[1]] params.notification_config[area[0]][area[1]] = {} - if value is 'online' - params.notification_config[area[0]][area[1]][area[2]] = { - email: false - online: true - } - else + if value is 'email' params.notification_config[area[0]][area[1]][area[2]] = { email: true online: true } + + # validation + if !params['notification_config']['matrix'] + @log('error', 'invalid notification_config, matrix is missing') + return + + # check missing channels + for key, value of params['notification_config']['matrix'] + if !value.channel + value.channel = { + email: false + online: true + } + if !params.notification_config.group_ids || _.isEmpty(params.notification_config.group_ids) params.notification_config.group_ids = ['-'] @formDisable(e) diff --git a/app/assets/javascripts/app/views/profile/notification.jst.eco b/app/assets/javascripts/app/views/profile/notification.jst.eco index 9b50578a7..d666030d2 100644 --- a/app/assets/javascripts/app/views/profile/notification.jst.eco +++ b/app/assets/javascripts/app/views/profile/notification.jst.eco @@ -10,16 +10,16 @@ <%- @T('My Tickets') %> - <%- @T('Not Assigned') %> - <%- @T('All Tickets') %> - <%- @T('Email Notification') %> + <%- @T('Not Assigned') %> * + <%- @T('All Tickets') %> * + <%- @T('Notify also via Email') %> <% if @config.matrix: %> <% for key, value of @config.matrix: %> - <%= value.name %> + <%- @T(value.name) %> @@ -51,13 +51,13 @@ <% if @groups: %> -

<%- @T( 'Limit Groups' ) %>

+

* <%- @T( 'Limit Groups' ) %>

<% for group in @groups: %>
<%- @T('Group') %> - <%- @T('Not Assigned & All Tickets') %> + <%- @T('Not Assigned') %> & <%- @T('All Tickets') %>