Skip to content

Modular logistics and supply chain operating system (LSOS)

patch notification settings in admin

Ronald A. Richardsonb728b366a071
diff --git a/console/app/controllers/console/admin/notifications.js b/console/app/controllers/console/admin/notifications.js
index a56dfb32..b000bbc0 100644
--- a/console/app/controllers/console/admin/notifications.js
+++ b/console/app/controllers/console/admin/notifications.js
@@ -60,7 +60,7 @@ export default class ConsoleAdminNotificationsController extends Controller {
* @memberof ConsoleAdminNotificationsController
*/
@action onSelectNotifiable(notification, notifiables) {
- const notificationKey = createNotificationKey(notification.definition);
+ const notificationKey = createNotificationKey(notification.definition, notification.name);
const _notificationSettings = { ...this.notificationSettings };
if (!_notificationSettings[notificationKey]) {
diff --git a/console/app/helpers/get-notification-key.js b/console/app/helpers/get-notification-key.js
index bfe4793d..258056e1 100644
--- a/console/app/helpers/get-notification-key.js
+++ b/console/app/helpers/get-notification-key.js
@@ -1,6 +1,6 @@
import { helper } from '@ember/component/helper';
import createNotificationKey from '../utils/create-notification-key';
-export default helper(function getNotificationKey([definition]) {
- return createNotificationKey(definition);
+export default helper(function getNotificationKey([definition, name]) {
+ return createNotificationKey(definition, name);
});
diff --git a/console/app/templates/console/admin/notifications.hbs b/console/app/templates/console/admin/notifications.hbs
index cde2c420..bcb49f92 100644
--- a/console/app/templates/console/admin/notifications.hbs
+++ b/console/app/templates/console/admin/notifications.hbs
@@ -14,7 +14,7 @@
<PowerSelectMultiple
@searchEnabled={{true}}
@options={{this.notifiables}}
- @selected={{get this.notificationSettings (concat (get-notification-key notification.definition) ".notifiables")}}
+ @selected={{get this.notificationSettings (concat (get-notification-key notification.definition notification.name) ".notifiables")}}
@onChange={{fn this.onSelectNotifiable notification}}
@placeholder="Select notifiables..."
@triggerClass="form-select form-input form-input-sm flex-1"
diff --git a/console/app/utils/create-notification-key.js b/console/app/utils/create-notification-key.js
index 8c015aff..eaba03b7 100644
--- a/console/app/utils/create-notification-key.js
+++ b/console/app/utils/create-notification-key.js
@@ -1,6 +1,8 @@
import { camelize } from '@ember/string';
-export default function createNotificationKey(definition) {
+export default function createNotificationKey(definition, name) {
const withoutSlashes = definition.replace(/[\W_]+/g, '');
- return camelize(withoutSlashes);
+ const key = `${camelize(withoutSlashes)}__${camelize(name)}`;
+
+ return key;
}