Add notification feature for status page subscribers

This commit is contained in:
Simon Larsen 2024-01-30 07:05:05 +00:00
parent 144795d412
commit 5367953ab0
No known key found for this signature in database
GPG Key ID: AB45983AA9C81CDE
4 changed files with 43 additions and 4 deletions

View File

@ -43,6 +43,7 @@ RunCron(
await IncidentPublicNoteService.findBy({
query: {
isStatusPageSubscribersNotifiedOnNoteCreated: false,
shouldStatusPageSubscribersBeNotifiedOnNoteCreated: true,
createdAt: QueryHelper.lessThan(
OneUptimeDate.getCurrentDate()
),

View File

@ -171,6 +171,19 @@ const PublicNote: FunctionComponent<PageComponentProps> = (
description:
'This note is visible on your Status Page. This is in Markdown.',
},
{
field: {
shouldStatusPageSubscribersBeNotifiedOnNoteCreated: true,
},
title: 'Notify Status Page Subscribers',
stepId: 'more',
description:
'Should status page subscribers be notified?',
fieldType: FormFieldSchemaType.Checkbox,
defaultValue: true,
required: false,
},
{
field: {
postedAt: true,

View File

@ -760,10 +760,7 @@ export default class Incident extends BaseModel {
Permission.CanReadProjectIncident,
],
update: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CanEditProjectIncident,
],
})
@TableColumn({

View File

@ -363,6 +363,34 @@ export default class IncidentPublicNote extends BaseModel {
})
public isStatusPageSubscribersNotifiedOnNoteCreated?: boolean = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CanCreateIncidentPublicNote,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CanReadIncidentPublicNote,
],
update: [],
})
@TableColumn({
isDefaultValueColumn: true,
type: TableColumnType.Boolean,
title: 'Should subscribers be notified?',
description: 'Should subscribers be notified about this note?',
})
@Column({
type: ColumnType.Boolean,
default: true,
})
public shouldStatusPageSubscribersBeNotifiedOnNoteCreated?: boolean = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,