From 879c1ac79a3d6d2ef3fe68f1b0230b61adbb2001 Mon Sep 17 00:00:00 2001 From: Eric Tendian Date: Wed, 25 Sep 2024 22:12:18 -0500 Subject: [PATCH] Allow notification subscriptions to be enabled/disabled --- .../notification-subscription-form.js | 1 + app/models/transcript-subscription.js | 1 + .../notification-subscription-form.hbs | 17 ++++++++++++++--- .../notification-subscription-list.hbs | 10 +++++++++- 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/app/components/notification-subscription-form.js b/app/components/notification-subscription-form.js index 209c4da..cf448bd 100644 --- a/app/components/notification-subscription-form.js +++ b/app/components/notification-subscription-form.js @@ -114,6 +114,7 @@ export default class NotificationSubscriptionFormComponent extends Component { } let data = { name: formdata.get('name'), + enabled: formdata.get('enabled') == 'on', keywords: formdata.get('keywords').split('\n'), ignore_keywords: formdata.get('ignore_keywords').split('\n'), topic: formdata.getAll('topic').join('|'), diff --git a/app/models/transcript-subscription.js b/app/models/transcript-subscription.js index 0f3ae1e..0a2a31b 100644 --- a/app/models/transcript-subscription.js +++ b/app/models/transcript-subscription.js @@ -2,6 +2,7 @@ import Model, { attr } from '@ember-data/model'; export default class TranscriptSubscriptionModel extends Model { @attr name; + @attr enabled; @attr keywords; @attr ignore_keywords; @attr location; diff --git a/app/templates/components/notification-subscription-form.hbs b/app/templates/components/notification-subscription-form.hbs index 7cd4d5d..0cc05ae 100644 --- a/app/templates/components/notification-subscription-form.hbs +++ b/app/templates/components/notification-subscription-form.hbs @@ -1,8 +1,19 @@

{{if @subscription "Edit" "Add a new"}} subscription

-
- - +
+
+ + +
+
+
+ + +
+
diff --git a/app/templates/components/notification-subscription-list.hbs b/app/templates/components/notification-subscription-list.hbs index de63ee7..5a95fb3 100644 --- a/app/templates/components/notification-subscription-list.hbs +++ b/app/templates/components/notification-subscription-list.hbs @@ -9,7 +9,12 @@
-
{{subscription.name}}
+
+ {{#unless subscription.enabled}} + Disabled + {{/unless}} + {{subscription.name}} +
@@ -58,6 +63,9 @@

Will notify via:

+ {{#unless subscription.enabled}} +

Note: Notifications are currently disabled. Please edit and re-enable the subscription to receive them.

+ {{/unless}}