wip; DRAFT for visibility into changes

Signed-off-by: Billy Stalnaker <bstalnaker@roadie.com>
This commit is contained in:
Billy Stalnaker
2025-03-19 09:28:14 -04:00
parent ad41ba7dc6
commit 5676296812
14 changed files with 304 additions and 63 deletions
@@ -15,6 +15,7 @@ export const isNotificationsEnabledFor: (
settings: NotificationSettings,
channelId: string,
originId: string,
topicId: string | null,
) => boolean;
// @public (undocumented)
@@ -67,6 +68,10 @@ export type NotificationSettings = {
origins: {
id: string;
enabled: boolean;
topics?: {
id: string;
enabled: boolean;
}[];
}[];
}[];
};
@@ -135,6 +135,10 @@ export type NotificationSettings = {
origins: {
id: string;
enabled: boolean;
topics?: {
id: string;
enabled: boolean;
}[];
}[];
}[];
};
+9 -1
View File
@@ -20,6 +20,7 @@ export const isNotificationsEnabledFor = (
settings: NotificationSettings,
channelId: string,
originId: string,
topicId: string | null,
) => {
const channel = settings.channels.find(c => c.id === channelId);
if (!channel) {
@@ -30,5 +31,12 @@ export const isNotificationsEnabledFor = (
if (!origin) {
return true;
}
return origin.enabled;
if (topicId === null) {
return origin.enabled;
}
const topic = origin.topics?.find(t => t.id === topicId);
if (!topic) {
return origin.enabled;
}
return topic.enabled;
};