Skip to content

Commit b7d496d

Browse files
AhmedCodeGuyrrrokhtar
authored andcommitted
feat(notifications): Filter notification preferences by QDC tag (#2596)
* feat(notifications): add QDC tag filtering for notification categories Filter notification preferences to include only those with the QDC tag, excluding marketing and QR-tagged workflows. Also fixed a typo in the comment. * feat(notifications): add QR tag support in category grouping Update the notification categories settings to include QR tag filtering, ensuring workflows with only marker tags (QDC/QR) are grouped under 'uncategorized'. This extends the existing QDC tag logic to handle QR tags consistently.
1 parent d96ca1d commit b7d496d

File tree

1 file changed

+17
-4
lines changed
  • src/components/Notifications/NotificationSettings/Tabs/CategoriesSettingsTab

1 file changed

+17
-4
lines changed

src/components/Notifications/NotificationSettings/Tabs/CategoriesSettingsTab/index.tsx

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import Spinner, { SpinnerSize } from '@/dls/Spinner/Spinner';
1717
import Error from '@/pages/_error';
1818

1919
const MARKETING_TAG = 'marketing';
20+
const QDC_TAG = 'QDC';
21+
const QR_TAG = 'QR';
2022

2123
const CategoriesSettingsTab = () => {
2224
const { t } = useTranslation('notification-settings');
@@ -35,9 +37,12 @@ const CategoriesSettingsTab = () => {
3537
/**
3638
* Group the preferences by tags. We filter out:
3739
*
38-
* 1. critical workflows since they are cannot be skipped.
40+
* 1. critical workflows since they cannot be skipped.
3941
* 2. preferences that don't have tags since they cannot be categorized.
40-
* 3. non-marketing emails
42+
* 3. marketing emails.
43+
* 4. workflows that don't have the QDC tag (filters out QR workflows).
44+
*
45+
* Workflows with only marker tags (QDC/QR) are grouped under 'uncategorized'.
4146
*/
4247
const groupByTags = useMemo(
4348
() =>
@@ -46,9 +51,17 @@ const CategoriesSettingsTab = () => {
4651
(preference) =>
4752
preference.template.critical === false &&
4853
!!preference.template.tags.length &&
49-
!preference.template.tags.includes(MARKETING_TAG),
54+
!preference.template.tags.includes(MARKETING_TAG) &&
55+
preference.template.tags.includes(QDC_TAG),
5056
),
51-
(preference) => preference.template.tags,
57+
// Group by category tags, excluding QDC/QR marker tags
58+
(preference) => {
59+
const categoryTags = preference.template.tags.filter(
60+
(tag) => tag !== QDC_TAG && tag !== QR_TAG,
61+
);
62+
// Take the first category tag; workflows should have exactly one category tag
63+
return categoryTags[0] || 'uncategorized';
64+
},
5265
),
5366
[preferences],
5467
);

0 commit comments

Comments
 (0)