wip; need to fix a test; and write more
Signed-off-by: Billy Stalnaker <bstalnaker@roadie.com>
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
---
|
||||
'@backstage/plugin-scaffolder-backend-module-notifications': patch
|
||||
'@backstage/plugin-notifications-backend': patch
|
||||
'@backstage/plugin-notifications-common': patch
|
||||
'@backstage/plugin-notifications': patch
|
||||
---
|
||||
|
||||
Adds ability for user to turn on/off notifications for specific topics within an origin.
|
||||
@@ -19,7 +19,7 @@ exports.up = async function up(knex) {
|
||||
});
|
||||
|
||||
await knex.schema.table('user_settings', table => {
|
||||
table.dropUnique('user_settings_unique_idx');
|
||||
table.dropUnique([], 'user_settings_unique_idx');
|
||||
});
|
||||
|
||||
await knex.schema.alterTable('user_settings', table => {
|
||||
@@ -31,7 +31,7 @@ exports.up = async function up(knex) {
|
||||
|
||||
exports.down = async function down(knex) {
|
||||
await knex.schema.table('user_settings', table => {
|
||||
table.dropUnique('user_settings_unique_idx');
|
||||
table.dropUnique([], 'user_settings_unique_idx');
|
||||
});
|
||||
|
||||
await knex.schema.alterTable('user_settings', table => {
|
||||
|
||||
@@ -159,6 +159,7 @@ const notificationSettings: NotificationSettings = {
|
||||
{
|
||||
id: 'plugin-test',
|
||||
enabled: true,
|
||||
topics: [],
|
||||
},
|
||||
{
|
||||
id: 'abcd-origin',
|
||||
|
||||
@@ -307,7 +307,7 @@ describe.each(databases.eachSupportedId())('createRouter (%s)', databaseId => {
|
||||
expect(notifications).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('should not send to user entity if disabled in settings', async () => {
|
||||
it('should not send to user entity if origin is disabled in settings', async () => {
|
||||
const client = await database.getClient();
|
||||
await client('user_settings').insert({
|
||||
user: 'user:default/mock',
|
||||
@@ -502,7 +502,9 @@ describe.each(databases.eachSupportedId())('createRouter (%s)', databaseId => {
|
||||
channels: [
|
||||
{
|
||||
id: 'Web',
|
||||
origins: [{ enabled: false, id: 'external:test-service' }],
|
||||
origins: [
|
||||
{ enabled: false, id: 'external:test-service', topics: [] },
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
@@ -5,6 +5,12 @@
|
||||
```ts
|
||||
import { Config } from '@backstage/config';
|
||||
|
||||
// @public (undocumented)
|
||||
export type ChannelSetting = {
|
||||
id: string;
|
||||
origins: OriginSetting[];
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export const getProcessorFiltersFromConfig: (
|
||||
config: Config,
|
||||
@@ -63,17 +69,7 @@ export type NotificationReadSignal = {
|
||||
|
||||
// @public (undocumented)
|
||||
export type NotificationSettings = {
|
||||
channels: {
|
||||
id: string;
|
||||
origins: {
|
||||
id: string;
|
||||
enabled: boolean;
|
||||
topics?: {
|
||||
id: string;
|
||||
enabled: boolean;
|
||||
}[];
|
||||
}[];
|
||||
}[];
|
||||
channels: ChannelSetting[];
|
||||
};
|
||||
|
||||
// @public
|
||||
@@ -90,4 +86,17 @@ export type NotificationStatus = {
|
||||
unread: number;
|
||||
read: number;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export type OriginSetting = {
|
||||
id: string;
|
||||
enabled: boolean;
|
||||
topics?: TopicSetting[];
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export type TopicSetting = {
|
||||
id: string;
|
||||
enabled: boolean;
|
||||
};
|
||||
```
|
||||
|
||||
@@ -208,6 +208,7 @@ export function useNotificationsApi<T>(
|
||||
// @public (undocumented)
|
||||
export const UserNotificationSettingsCard: (props: {
|
||||
originNames?: Record<string, string>;
|
||||
topicNames?: Record<string, string>;
|
||||
}) => React_2.JSX.Element;
|
||||
|
||||
// (No @packageDocumentation comment for this package)
|
||||
|
||||
Reference in New Issue
Block a user