wip; DRAFT for visibility into changes
Signed-off-by: Billy Stalnaker <bstalnaker@roadie.com>
This commit is contained in:
@@ -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;
|
||||
}[];
|
||||
}[];
|
||||
}[];
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user