add unsubscribe help text

This commit is contained in:
Simon Larsen
2023-07-21 13:39:38 +01:00
parent dfa8591562
commit 889b6e00c4
22 changed files with 219 additions and 182 deletions

View File

@@ -1,26 +1,25 @@
enum NotificationSettingEventType {
// Incident
SEND_INCIDENT_CREATED_OWNER_NOTIFICATION = "Send incident created notification when I am the owner of the incident",
SEND_INCIDENT_NOTE_POSTED_OWNER_NOTIFICATION = "Send incident note posted notification when I am the owner of the incident",
SEND_INCIDENT_STATE_CHANGED_OWNER_NOTIFICATION = "Send incident state changed notification when I am the owner of the incident",
SEND_INCIDENT_OWNER_ADDED_NOTIFICATION = "Send notification when I am added as a owner to the incident",
SEND_INCIDENT_CREATED_OWNER_NOTIFICATION = 'Send incident created notification when I am the owner of the incident',
SEND_INCIDENT_NOTE_POSTED_OWNER_NOTIFICATION = 'Send incident note posted notification when I am the owner of the incident',
SEND_INCIDENT_STATE_CHANGED_OWNER_NOTIFICATION = 'Send incident state changed notification when I am the owner of the incident',
SEND_INCIDENT_OWNER_ADDED_NOTIFICATION = 'Send notification when I am added as a owner to the incident',
// Monitors
SEND_MONITOR_OWNER_ADDED_NOTIFICATION = "Send notification when I am added as a owner to the monitor",
SEND_MONITOR_CREATED_OWNER_NOTIFICATION = "Send monitor created notification when I am the owner of the monitor",
SEND_MONITOR_STATUS_CHANGED_OWNER_NOTIFICATION = "Send monitor status changed notification when I am the owner of the monitor",
SEND_MONITOR_OWNER_ADDED_NOTIFICATION = 'Send notification when I am added as a owner to the monitor',
SEND_MONITOR_CREATED_OWNER_NOTIFICATION = 'Send monitor created notification when I am the owner of the monitor',
SEND_MONITOR_STATUS_CHANGED_OWNER_NOTIFICATION = 'Send monitor status changed notification when I am the owner of the monitor',
// Scheduled Maintenance
SEND_SCHEDULED_MAINTENANCE_CREATED_OWNER_NOTIFICATION = "Send scheduled maintenance created notification when I am the owner of the scheduled maintenance",
SEND_SCHEDULED_MAINTENANCE_NOTE_POSTED_OWNER_NOTIFICATION = "Send scheduled maintenance note posted notification when I am the owner of the scheduled maintenance",
SEND_SCHEDULED_MAINTENANCE_OWNER_ADDED_NOTIFICATION = "Send notification when I am added as a owner to the scheduled maintenance",
SEND_SCHEDULED_MAINTENANCE_STATE_CHANGED_OWNER_NOTIFICATION = "Send scheduled maintenance state changed notification when I am the owner of the scheduled maintenance",
SEND_SCHEDULED_MAINTENANCE_CREATED_OWNER_NOTIFICATION = 'Send scheduled maintenance created notification when I am the owner of the scheduled maintenance',
SEND_SCHEDULED_MAINTENANCE_NOTE_POSTED_OWNER_NOTIFICATION = 'Send scheduled maintenance note posted notification when I am the owner of the scheduled maintenance',
SEND_SCHEDULED_MAINTENANCE_OWNER_ADDED_NOTIFICATION = 'Send notification when I am added as a owner to the scheduled maintenance',
SEND_SCHEDULED_MAINTENANCE_STATE_CHANGED_OWNER_NOTIFICATION = 'Send scheduled maintenance state changed notification when I am the owner of the scheduled maintenance',
// Status Page
SEND_STATUS_PAGE_ANNOUNCEMENT_CREATED_OWNER_NOTIFICATION = "Send status page announcement created notification when I am the owner of the status page",
SEND_STATUS_PAGE_CREATED_OWNER_NOTIFICATION = "Send status page created notification when I am the owner of the status page",
SEND_STATUS_PAGE_OWNER_ADDED_NOTIFICATION = "Send notification when I am added as a owner to the status page",
SEND_STATUS_PAGE_ANNOUNCEMENT_CREATED_OWNER_NOTIFICATION = 'Send status page announcement created notification when I am the owner of the status page',
SEND_STATUS_PAGE_CREATED_OWNER_NOTIFICATION = 'Send status page created notification when I am the owner of the status page',
SEND_STATUS_PAGE_OWNER_ADDED_NOTIFICATION = 'Send notification when I am added as a owner to the status page',
}
export default NotificationSettingEventType;

View File

@@ -49,7 +49,6 @@ import Email from 'Common/Types/Email';
import EmailTemplateType from 'Common/Types/Email/EmailTemplateType';
import UserService from './UserService';
import UserNotificationRuleService from './UserNotificationRuleService';
import UserNotificationSetting from 'Model/Models/UserNotificationSetting';
import UserNotificationSettingService from './UserNotificationSettingService';
export class Service extends DatabaseService<Model> {
@@ -648,7 +647,10 @@ export class Service extends DatabaseService<Model> {
user.email!
);
await UserNotificationSettingService.addDefaultNotificationSettingsForUser(user.id!, createdItem.id!);
await UserNotificationSettingService.addDefaultNotificationSettingsForUser(
user.id!,
createdItem.id!
);
}
return createdItem;

View File

@@ -202,7 +202,10 @@ export class TeamMemberService extends DatabaseService<TeamMember> {
updateBy.data.hasAcceptedInvitation &&
item.user?.isEmailVerified
) {
await UserNotificationSettingService.addDefaultNotificationSettingsForUser(item.userId!, item.projectId!)
await UserNotificationSettingService.addDefaultNotificationSettingsForUser(
item.userId!,
item.projectId!
);
await UserNotificationRuleService.addDefaultNotifictionRuleForUser(
item.projectId!,
item.userId!,

View File

@@ -13,104 +13,120 @@ export class Service extends DatabaseService<Model> {
super(Model, postgresDatabase);
}
public async addDefaultNotificationSettingsForUser(userId: ObjectID, projectId: ObjectID): Promise<void> {
const incidentCreatedNotificationEvent: PositiveNumber = await this.countBy({
query: {
userId,
projectId,
eventType: NotificationSettingEventType.SEND_INCIDENT_CREATED_OWNER_NOTIFICATION
},
props: {
isRoot: true,
}
});
public async addDefaultNotificationSettingsForUser(
userId: ObjectID,
projectId: ObjectID
): Promise<void> {
const incidentCreatedNotificationEvent: PositiveNumber =
await this.countBy({
query: {
userId,
projectId,
eventType:
NotificationSettingEventType.SEND_INCIDENT_CREATED_OWNER_NOTIFICATION,
},
props: {
isRoot: true,
},
});
if (incidentCreatedNotificationEvent.toNumber() === 0) {
const item = new UserNotificationSetting();
item.userId = userId;
item.projectId = projectId;
item.eventType = NotificationSettingEventType.SEND_INCIDENT_CREATED_OWNER_NOTIFICATION;
item.eventType =
NotificationSettingEventType.SEND_INCIDENT_CREATED_OWNER_NOTIFICATION;
item.alertByEmail = true;
await this.create({
data: item,
props: {
isRoot: true,
}
},
});
}
// check monitor state changed notification
const monitorStateChangedNotificationEvent: PositiveNumber = await this.countBy({
query: {
userId,
projectId,
eventType: NotificationSettingEventType.SEND_MONITOR_STATUS_CHANGED_OWNER_NOTIFICATION
},
props: {
isRoot: true,
}
});
const monitorStateChangedNotificationEvent: PositiveNumber =
await this.countBy({
query: {
userId,
projectId,
eventType:
NotificationSettingEventType.SEND_MONITOR_STATUS_CHANGED_OWNER_NOTIFICATION,
},
props: {
isRoot: true,
},
});
if (monitorStateChangedNotificationEvent.toNumber() === 0) {
const item = new UserNotificationSetting();
item.userId = userId;
item.projectId = projectId;
item.eventType = NotificationSettingEventType.SEND_MONITOR_STATUS_CHANGED_OWNER_NOTIFICATION;
item.eventType =
NotificationSettingEventType.SEND_MONITOR_STATUS_CHANGED_OWNER_NOTIFICATION;
item.alertByEmail = true;
await this.create({
data: item,
props: {
isRoot: true,
}
},
});
}
// check incident state changed notification
const incidentStateChangedNotificationEvent: PositiveNumber = await this.countBy({
query: {
userId,
projectId,
eventType: NotificationSettingEventType.SEND_INCIDENT_STATE_CHANGED_OWNER_NOTIFICATION
},
props: {
isRoot: true,
}
});
const incidentStateChangedNotificationEvent: PositiveNumber =
await this.countBy({
query: {
userId,
projectId,
eventType:
NotificationSettingEventType.SEND_INCIDENT_STATE_CHANGED_OWNER_NOTIFICATION,
},
props: {
isRoot: true,
},
});
if (incidentStateChangedNotificationEvent.toNumber() === 0) {
const item = new UserNotificationSetting();
item.userId = userId;
item.projectId = projectId;
item.eventType = NotificationSettingEventType.SEND_INCIDENT_STATE_CHANGED_OWNER_NOTIFICATION;
item.eventType =
NotificationSettingEventType.SEND_INCIDENT_STATE_CHANGED_OWNER_NOTIFICATION;
item.alertByEmail = true;
await this.create({
data: item,
props: {
isRoot: true,
}
},
});
}
}
protected override async onBeforeCreate(createBy: CreateBy<Model>): Promise<OnCreate<Model>> {
// check if the same event for same user is added.
protected override async onBeforeCreate(
createBy: CreateBy<Model>
): Promise<OnCreate<Model>> {
// check if the same event for same user is added.
if (!createBy.data.projectId) {
throw new BadDataException("ProjectId is required for UserNotificationSetting");
throw new BadDataException(
'ProjectId is required for UserNotificationSetting'
);
}
if (!createBy.data.userId) {
throw new BadDataException("UserId is required for UserNotificationSetting");
throw new BadDataException(
'UserId is required for UserNotificationSetting'
);
}
if (!createBy.data.eventType) {
throw new BadDataException("EventType is required for UserNotificationSetting");
throw new BadDataException(
'EventType is required for UserNotificationSetting'
);
}
const count: PositiveNumber = await this.countBy({
@@ -121,17 +137,19 @@ export class Service extends DatabaseService<Model> {
},
props: {
isRoot: true,
}
})
},
});
if (count.toNumber() > 0) {
throw new BadDataException("Notification Setting of the same event type already exists for the user.");
throw new BadDataException(
'Notification Setting of the same event type already exists for the user.'
);
}
return {
createBy,
carryForward: undefined
}
carryForward: undefined,
};
}
}

View File

@@ -124,7 +124,10 @@ export class Service extends DatabaseService<Model> {
user.email!
);
await UserNotificationSettingService.addDefaultNotificationSettingsForUser(user.id!, member.projectId!);
await UserNotificationSettingService.addDefaultNotificationSettingsForUser(
user.id!,
member.projectId!
);
}
}
}

View File

@@ -374,7 +374,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.HOME_NOT_OPERATIONAL_MONITORS
PageMap.HOME_NOT_OPERATIONAL_MONITORS
] as Route
}
/>
@@ -394,8 +394,8 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap
.HOME_ONGOING_SCHEDULED_MAINTENANCE_EVENTS
PageMap
.HOME_ONGOING_SCHEDULED_MAINTENANCE_EVENTS
] as Route
}
/>
@@ -423,7 +423,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.MONITORS_INOPERATIONAL
PageMap.MONITORS_INOPERATIONAL
] as Route
}
/>
@@ -506,7 +506,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.MONITOR_VIEW_STATUS_TIMELINE
PageMap.MONITOR_VIEW_STATUS_TIMELINE
] as Route
}
/>
@@ -538,7 +538,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.MONITOR_VIEW_INCIDENTS
PageMap.MONITOR_VIEW_INCIDENTS
] as Route
}
/>
@@ -556,7 +556,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.MONITOR_VIEW_CUSTOM_FIELDS
PageMap.MONITOR_VIEW_CUSTOM_FIELDS
] as Route
}
/>
@@ -736,7 +736,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.STATUS_PAGE_VIEW_DELETE
PageMap.STATUS_PAGE_VIEW_DELETE
] as Route
}
/>
@@ -754,7 +754,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.STATUS_PAGE_VIEW_BRANDING
PageMap.STATUS_PAGE_VIEW_BRANDING
] as Route
}
/>
@@ -772,7 +772,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.STATUS_PAGE_VIEW_CUSTOM_HTML_CSS
PageMap.STATUS_PAGE_VIEW_CUSTOM_HTML_CSS
] as Route
}
/>
@@ -790,7 +790,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.STATUS_PAGE_VIEW_ADVANCED_OPTIONS
PageMap.STATUS_PAGE_VIEW_ADVANCED_OPTIONS
] as Route
}
/>
@@ -808,7 +808,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.STATUS_PAGE_VIEW_CUSTOM_FIELDS
PageMap.STATUS_PAGE_VIEW_CUSTOM_FIELDS
] as Route
}
/>
@@ -825,7 +825,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.STATUS_PAGE_VIEW_OWNERS
PageMap.STATUS_PAGE_VIEW_OWNERS
] as Route
}
/>
@@ -857,7 +857,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.STATUS_PAGE_VIEW_EMAIL_SUBSCRIBERS
PageMap.STATUS_PAGE_VIEW_EMAIL_SUBSCRIBERS
] as Route
}
/>
@@ -875,8 +875,8 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap
.STATUS_PAGE_VIEW_AUTHENTICATION_SETTINGS
PageMap
.STATUS_PAGE_VIEW_AUTHENTICATION_SETTINGS
] as Route
}
/>
@@ -894,7 +894,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.STATUS_PAGE_VIEW_CUSTOM_SMTP
PageMap.STATUS_PAGE_VIEW_CUSTOM_SMTP
] as Route
}
/>
@@ -912,7 +912,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.STATUS_PAGE_VIEW_SETTINGS
PageMap.STATUS_PAGE_VIEW_SETTINGS
] as Route
}
/>
@@ -930,7 +930,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.STATUS_PAGE_VIEW_PRIVATE_USERS
PageMap.STATUS_PAGE_VIEW_PRIVATE_USERS
] as Route
}
/>
@@ -948,7 +948,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.STATUS_PAGE_VIEW_SMS_SUBSCRIBERS
PageMap.STATUS_PAGE_VIEW_SMS_SUBSCRIBERS
] as Route
}
/>
@@ -966,7 +966,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.STATUS_PAGE_VIEW_HEADER_STYLE
PageMap.STATUS_PAGE_VIEW_HEADER_STYLE
] as Route
}
/>
@@ -984,7 +984,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.STATUS_PAGE_VIEW_FOOTER_STYLE
PageMap.STATUS_PAGE_VIEW_FOOTER_STYLE
] as Route
}
/>
@@ -1002,7 +1002,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.STATUS_PAGE_VIEW_NAVBAR_STYLE
PageMap.STATUS_PAGE_VIEW_NAVBAR_STYLE
] as Route
}
/>
@@ -1020,7 +1020,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.STATUS_PAGE_VIEW_WEBHOOK_SUBSCRIBERS
PageMap.STATUS_PAGE_VIEW_WEBHOOK_SUBSCRIBERS
] as Route
}
/>
@@ -1038,7 +1038,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.STATUS_PAGE_VIEW_EMBEDDED
PageMap.STATUS_PAGE_VIEW_EMBEDDED
] as Route
}
/>
@@ -1056,7 +1056,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.STATUS_PAGE_VIEW_RESOURCES
PageMap.STATUS_PAGE_VIEW_RESOURCES
] as Route
}
/>
@@ -1074,7 +1074,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.STATUS_PAGE_VIEW_DOMAINS
PageMap.STATUS_PAGE_VIEW_DOMAINS
] as Route
}
/>
@@ -1091,7 +1091,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.STATUS_PAGE_VIEW_GROUPS
PageMap.STATUS_PAGE_VIEW_GROUPS
] as Route
}
/>
@@ -1109,7 +1109,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.STATUS_PAGE_VIEW_ANNOUNCEMENTS
PageMap.STATUS_PAGE_VIEW_ANNOUNCEMENTS
] as Route
}
/>
@@ -1177,7 +1177,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.INCIDENT_VIEW_STATE_TIMELINE
PageMap.INCIDENT_VIEW_STATE_TIMELINE
] as Route
}
/>
@@ -1194,7 +1194,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.INCIDENT_INTERNAL_NOTE
PageMap.INCIDENT_INTERNAL_NOTE
] as Route
}
/>
@@ -1212,7 +1212,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.INCIDENT_VIEW_CUSTOM_FIELDS
PageMap.INCIDENT_VIEW_CUSTOM_FIELDS
] as Route
}
/>
@@ -1230,8 +1230,8 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap
.ON_CALL_DUTY_POLICY_VIEW_CUSTOM_FIELDS
PageMap
.ON_CALL_DUTY_POLICY_VIEW_CUSTOM_FIELDS
] as Route
}
/>
@@ -1279,7 +1279,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.SCHEDULED_MAINTENANCE_EVENTS
PageMap.SCHEDULED_MAINTENANCE_EVENTS
] as Route
}
/>
@@ -1297,7 +1297,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.ONGOING_SCHEDULED_MAINTENANCE_EVENTS
PageMap.ONGOING_SCHEDULED_MAINTENANCE_EVENTS
] as Route
}
/>
@@ -1315,7 +1315,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.SCHEDULED_MAINTENANCE_VIEW
PageMap.SCHEDULED_MAINTENANCE_VIEW
] as Route
}
/>
@@ -1333,8 +1333,8 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap
.SCHEDULED_MAINTENANCE_VIEW_CUSTOM_FIELDS
PageMap
.SCHEDULED_MAINTENANCE_VIEW_CUSTOM_FIELDS
] as Route
}
/>
@@ -1352,7 +1352,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.SCHEDULED_MAINTENANCE_VIEW_DELETE
PageMap.SCHEDULED_MAINTENANCE_VIEW_DELETE
] as Route
}
/>
@@ -1370,7 +1370,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.SCHEDULED_MAINTENANCE_VIEW_OWNERS
PageMap.SCHEDULED_MAINTENANCE_VIEW_OWNERS
] as Route
}
/>
@@ -1388,8 +1388,8 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap
.SCHEDULED_MAINTENANCE_VIEW_STATE_TIMELINE
PageMap
.SCHEDULED_MAINTENANCE_VIEW_STATE_TIMELINE
] as Route
}
/>
@@ -1407,7 +1407,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.SCHEDULED_MAINTENANCE_INTERNAL_NOTE
PageMap.SCHEDULED_MAINTENANCE_INTERNAL_NOTE
] as Route
}
/>
@@ -1425,7 +1425,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.SCHEDULED_MAINTENANCE_PUBLIC_NOTE
PageMap.SCHEDULED_MAINTENANCE_PUBLIC_NOTE
] as Route
}
/>
@@ -1525,7 +1525,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.SETTINGS_MONITORS_STATUS
PageMap.SETTINGS_MONITORS_STATUS
] as Route
}
/>
@@ -1543,7 +1543,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.SETTINGS_INCIDENTS_STATE
PageMap.SETTINGS_INCIDENTS_STATE
] as Route
}
/>
@@ -1561,7 +1561,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.SETTINGS_SCHEDULED_MAINTENANCE_STATE
PageMap.SETTINGS_SCHEDULED_MAINTENANCE_STATE
] as Route
}
/>
@@ -1589,7 +1589,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.SETTINGS_INCIDENTS_SEVERITY
PageMap.SETTINGS_INCIDENTS_SEVERITY
] as Route
}
/>
@@ -1659,7 +1659,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.SETTINGS_MONITOR_CUSTOM_FIELDS
PageMap.SETTINGS_MONITOR_CUSTOM_FIELDS
] as Route
}
/>
@@ -1677,7 +1677,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.SETTINGS_STATUS_PAGE_CUSTOM_FIELDS
PageMap.SETTINGS_STATUS_PAGE_CUSTOM_FIELDS
] as Route
}
/>
@@ -1695,8 +1695,8 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap
.SETTINGS_SCHEDULED_MAINTENANCE_CUSTOM_FIELDS
PageMap
.SETTINGS_SCHEDULED_MAINTENANCE_CUSTOM_FIELDS
] as Route
}
/>
@@ -1714,7 +1714,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.SETTINGS_INCIDENT_CUSTOM_FIELDS
PageMap.SETTINGS_INCIDENT_CUSTOM_FIELDS
] as Route
}
/>
@@ -1732,8 +1732,8 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap
.SETTINGS_ON_CALL_DUTY_POLICY_CUSTOM_FIELDS
PageMap
.SETTINGS_ON_CALL_DUTY_POLICY_CUSTOM_FIELDS
] as Route
}
/>
@@ -1763,7 +1763,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.SETTINGS_BILLING_INVOICES
PageMap.SETTINGS_BILLING_INVOICES
] as Route
}
/>
@@ -1843,7 +1843,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.ON_CALL_DUTY_EXECUTION_LOGS
PageMap.ON_CALL_DUTY_EXECUTION_LOGS
] as Route
}
/>
@@ -1861,7 +1861,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.ON_CALL_DUTY_EXECUTION_LOGS_TIMELINE
PageMap.ON_CALL_DUTY_EXECUTION_LOGS_TIMELINE
] as Route
}
/>
@@ -1894,7 +1894,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.ON_CALL_DUTY_POLICY_VIEW
PageMap.ON_CALL_DUTY_POLICY_VIEW
] as Route
}
/>
@@ -1912,7 +1912,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.ON_CALL_DUTY_POLICY_VIEW_DELETE
PageMap.ON_CALL_DUTY_POLICY_VIEW_DELETE
] as Route
}
/>
@@ -1930,7 +1930,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.ON_CALL_DUTY_POLICY_VIEW_ESCALATION
PageMap.ON_CALL_DUTY_POLICY_VIEW_ESCALATION
] as Route
}
/>
@@ -1948,8 +1948,8 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap
.ON_CALL_DUTY_POLICY_VIEW_EXECUTION_LOGS
PageMap
.ON_CALL_DUTY_POLICY_VIEW_EXECUTION_LOGS
] as Route
}
/>
@@ -1967,8 +1967,8 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap
.ON_CALL_DUTY_POLICY_VIEW_EXECUTION_LOG_VIEW
PageMap
.ON_CALL_DUTY_POLICY_VIEW_EXECUTION_LOG_VIEW
] as Route
}
/>
@@ -2080,7 +2080,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.USER_SETTINGS_NOTIFICATION_LOGS
PageMap.USER_SETTINGS_NOTIFICATION_LOGS
] as Route
}
/>
@@ -2098,8 +2098,8 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap
.USER_SETTINGS_NOTIFICATION_LOGS_TIMELINE
PageMap
.USER_SETTINGS_NOTIFICATION_LOGS_TIMELINE
] as Route
}
/>
@@ -2117,16 +2117,13 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap
.USER_SETTINGS_NOTIFICATION_SETTINGS
PageMap.USER_SETTINGS_NOTIFICATION_SETTINGS
] as Route
}
/>
}
/>
<PageRoute
path={
RouteMap[
@@ -2138,7 +2135,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.USER_SETTINGS_NOTIFICATION_METHODS
PageMap.USER_SETTINGS_NOTIFICATION_METHODS
] as Route
}
/>
@@ -2156,7 +2153,7 @@ const App: FunctionComponent = () => {
{...commonPageProps}
pageRoute={
RouteMap[
PageMap.USER_SETTINGS_ON_CALL_RULES
PageMap.USER_SETTINGS_ON_CALL_RULES
] as Route
}
/>

View File

@@ -1,9 +1,6 @@
import Route from 'Common/Types/API/Route';
import Page from 'CommonUI/src/Components/Page/Page';
import React, {
FunctionComponent,
ReactElement,
} from 'react';
import React, { FunctionComponent, ReactElement } from 'react';
import PageMap from '../../Utils/PageMap';
import RouteMap, { RouteUtil } from '../../Utils/RouteMap';
import PageComponentProps from '../PageComponentProps';
@@ -18,13 +15,9 @@ import FieldType from 'CommonUI/src/Components/Types/FieldType';
import NotificationSettingEventType from 'Common/Types/NotificationSetting/NotificationSettingEventType';
import DropdownUtil from 'CommonUI/src/Utils/Dropdown';
const Settings: FunctionComponent<PageComponentProps> = (
_props: PageComponentProps
): ReactElement => {
const getModelTable: Function = (options: {
eventOptions: Array<NotificationSettingEventType>;
title: string;
@@ -47,8 +40,7 @@ const Settings: FunctionComponent<PageComponentProps> = (
}}
createVerb={'Add'}
id="notification-settings"
name={`User Settings > Notification Rules > ${options.title
}`}
name={`User Settings > Notification Rules > ${options.title}`}
isDeleteable={true}
isEditable={true}
isCreateable={true}
@@ -70,14 +62,18 @@ const Settings: FunctionComponent<PageComponentProps> = (
fieldType: FormFieldSchemaType.Dropdown,
required: true,
placeholder: 'Select an event type',
dropdownOptions: DropdownUtil.getDropdownOptionsFromArray(options.eventOptions),
dropdownOptions:
DropdownUtil.getDropdownOptionsFromArray(
options.eventOptions
),
},
{
field: {
alertByEmail: true,
},
title: 'Alert By Email',
description: 'Select if you want to be alerted by email.',
description:
'Select if you want to be alerted by email.',
fieldType: FormFieldSchemaType.Toggle,
required: false,
},
@@ -95,7 +91,8 @@ const Settings: FunctionComponent<PageComponentProps> = (
alertByCall: true,
},
title: 'Alert By Call',
description: 'Select if you want to be alerted by call.',
description:
'Select if you want to be alerted by call.',
fieldType: FormFieldSchemaType.Toggle,
required: false,
},
@@ -156,7 +153,9 @@ const Settings: FunctionComponent<PageComponentProps> = (
{
title: 'Notification Settings',
to: RouteUtil.populateRouteParams(
RouteMap[PageMap.USER_SETTINGS_NOTIFICATION_SETTINGS] as Route
RouteMap[
PageMap.USER_SETTINGS_NOTIFICATION_SETTINGS
] as Route
),
},
]}
@@ -164,9 +163,13 @@ const Settings: FunctionComponent<PageComponentProps> = (
>
<div>
{getModelTable({
eventOptions: [NotificationSettingEventType.SEND_INCIDENT_NOTE_POSTED_OWNER_NOTIFICATION, NotificationSettingEventType.SEND_INCIDENT_OWNER_ADDED_NOTIFICATION, NotificationSettingEventType.SEND_INCIDENT_CREATED_OWNER_NOTIFICATION, NotificationSettingEventType.SEND_INCIDENT_STATE_CHANGED_OWNER_NOTIFICATION],
title:
'Incident Notifications',
eventOptions: [
NotificationSettingEventType.SEND_INCIDENT_NOTE_POSTED_OWNER_NOTIFICATION,
NotificationSettingEventType.SEND_INCIDENT_OWNER_ADDED_NOTIFICATION,
NotificationSettingEventType.SEND_INCIDENT_CREATED_OWNER_NOTIFICATION,
NotificationSettingEventType.SEND_INCIDENT_STATE_CHANGED_OWNER_NOTIFICATION,
],
title: 'Incident Notifications',
description:
'Here are the list of notification methods we will use when an event happens on an incident.',
})}
@@ -174,36 +177,44 @@ const Settings: FunctionComponent<PageComponentProps> = (
<div>
{getModelTable({
eventOptions: [NotificationSettingEventType.SEND_MONITOR_OWNER_ADDED_NOTIFICATION, NotificationSettingEventType.SEND_MONITOR_CREATED_OWNER_NOTIFICATION, NotificationSettingEventType.SEND_MONITOR_STATUS_CHANGED_OWNER_NOTIFICATION, NotificationSettingEventType.SEND_INCIDENT_STATE_CHANGED_OWNER_NOTIFICATION],
title:
'Monitor Notifications',
eventOptions: [
NotificationSettingEventType.SEND_MONITOR_OWNER_ADDED_NOTIFICATION,
NotificationSettingEventType.SEND_MONITOR_CREATED_OWNER_NOTIFICATION,
NotificationSettingEventType.SEND_MONITOR_STATUS_CHANGED_OWNER_NOTIFICATION,
NotificationSettingEventType.SEND_INCIDENT_STATE_CHANGED_OWNER_NOTIFICATION,
],
title: 'Monitor Notifications',
description:
'Here are the list of notification methods we will use when an event happens on a monitor.',
})}
</div>
<div>
{getModelTable({
eventOptions: [NotificationSettingEventType.SEND_STATUS_PAGE_CREATED_OWNER_NOTIFICATION, NotificationSettingEventType.SEND_STATUS_PAGE_OWNER_ADDED_NOTIFICATION, NotificationSettingEventType.SEND_INCIDENT_CREATED_OWNER_NOTIFICATION],
title:
'Status Page Notifications',
eventOptions: [
NotificationSettingEventType.SEND_STATUS_PAGE_CREATED_OWNER_NOTIFICATION,
NotificationSettingEventType.SEND_STATUS_PAGE_OWNER_ADDED_NOTIFICATION,
NotificationSettingEventType.SEND_INCIDENT_CREATED_OWNER_NOTIFICATION,
],
title: 'Status Page Notifications',
description:
'Here are the list of notification methods we will use when an event happens on a status page.',
})}
</div>
<div>
{getModelTable({
eventOptions: [NotificationSettingEventType.SEND_SCHEDULED_MAINTENANCE_NOTE_POSTED_OWNER_NOTIFICATION, NotificationSettingEventType.SEND_SCHEDULED_MAINTENANCE_OWNER_ADDED_NOTIFICATION, NotificationSettingEventType.SEND_SCHEDULED_MAINTENANCE_CREATED_OWNER_NOTIFICATION, NotificationSettingEventType.SEND_SCHEDULED_MAINTENANCE_STATE_CHANGED_OWNER_NOTIFICATION],
title:
'Scheduled Maintenance Notifications',
eventOptions: [
NotificationSettingEventType.SEND_SCHEDULED_MAINTENANCE_NOTE_POSTED_OWNER_NOTIFICATION,
NotificationSettingEventType.SEND_SCHEDULED_MAINTENANCE_OWNER_ADDED_NOTIFICATION,
NotificationSettingEventType.SEND_SCHEDULED_MAINTENANCE_CREATED_OWNER_NOTIFICATION,
NotificationSettingEventType.SEND_SCHEDULED_MAINTENANCE_STATE_CHANGED_OWNER_NOTIFICATION,
],
title: 'Scheduled Maintenance Notifications',
description:
'Here are the list of notification methods we will use when an event happens on an incident.',
})}
</div>
</Page>
);
};

View File

@@ -10,7 +10,6 @@ import Link from 'Common/Types/Link';
import Navigation from 'CommonUI/src/Utils/Navigation';
const DashboardSideMenu: FunctionComponent = (): ReactElement => {
let subItemMenuLink: Link | undefined = undefined;
if (

View File

@@ -323,7 +323,6 @@ const RouteMap: Dictionary<Route> = {
`/dashboard/${RouteParams.ProjectID}/user-settings/notification-settings`
),
[PageMap.USER_SETTINGS_NOTIFICATION_METHODS]: new Route(
`/dashboard/${RouteParams.ProjectID}/settings/notification-methods`
),

View File

@@ -342,7 +342,6 @@ import UserNotificationSettingService, {
Service as UserNotificationSettingServiceType,
} from 'CommonServer/Services/UserNotificationSettingService';
const app: ExpressApplication = Express.getExpressApp();
const APP_NAME: string = 'api';
@@ -664,7 +663,6 @@ app.use(
).getRouter()
);
app.use(
`/${APP_NAME.toLocaleLowerCase()}`,
new BaseAPI<UserNotificationLog, UserNotificationLogServiceType>(
@@ -673,7 +671,6 @@ app.use(
).getRouter()
);
app.use(
`/${APP_NAME.toLocaleLowerCase()}`,
new BaseAPI<UserNotificationSetting, UserNotificationSettingServiceType>(
@@ -682,7 +679,6 @@ app.use(
).getRouter()
);
app.use(
`/${APP_NAME.toLocaleLowerCase()}`,
new BaseAPI<

View File

@@ -254,7 +254,6 @@ class UserNotificationSetting extends BaseModel {
})
public alertByEmail?: boolean = undefined;
@ColumnAccessControl({
create: [Permission.CurrentUser],
read: [Permission.CurrentUser],
@@ -278,7 +277,6 @@ class UserNotificationSetting extends BaseModel {
default: false,
})
public alertByCall?: boolean = undefined;
}
export default UserNotificationSetting;

View File

@@ -31,6 +31,7 @@
{{> InfoBlock info="You will be notified when the status of this incident changes."}}
{{> OwnerInfo this }}
{{> UnsubscribeOwnerEmail this }}
{{> Footer this }}

View File

@@ -28,6 +28,7 @@
{{> InfoBlock info="You will be notified when the status of this incident changes."}}
{{> OwnerInfo this }}
{{> UnsubscribeOwnerEmail this }}
{{> Footer this }}

View File

@@ -29,6 +29,7 @@
{{> InfoBlock info="You will be notified when the status of this incident changes."}}
{{> OwnerInfo this }}
{{> UnsubscribeOwnerEmail this }}
{{> Footer this }}

View File

@@ -26,6 +26,7 @@
{{> InfoBlock info="You will be notified when the status of this monitor changes."}}
{{> OwnerInfo this }}
{{> UnsubscribeOwnerEmail this }}
{{> Footer this }}

View File

@@ -29,6 +29,7 @@
{{> InfoBlock info="You will be notified when the status of this monitor changes."}}
{{> OwnerInfo this }}
{{> UnsubscribeOwnerEmail this }}
{{> Footer this }}

View File

@@ -0,0 +1,2 @@
{{> TitleBlock title="How do I unsubscribe from this email?"}}
{{> InfoBlock info="You can go to OneUptime Dashboard > More > User Settings > Notification Settings to unsubscribe from this email."}}

View File

@@ -30,6 +30,7 @@
{{> InfoBlock info="You will be notified when the status of this scheduled maintenance changes."}}
{{> OwnerInfo this }}
{{> UnsubscribeOwnerEmail this }}
{{> Footer this }}

View File

@@ -26,6 +26,7 @@
{{> InfoBlock info="You will be notified when the status of this scheduled maintenance changes."}}
{{> OwnerInfo this }}
{{> UnsubscribeOwnerEmail this }}
{{> Footer this }}

View File

@@ -28,6 +28,7 @@
{{> InfoBlock info="You will be notified when the status of this scheduled maintenance changes."}}
{{> OwnerInfo this }}
{{> UnsubscribeOwnerEmail this }}
{{> Footer this }}

View File

@@ -12,6 +12,7 @@
{{> OwnerInfo this }}
{{> UnsubscribeOwnerEmail this }}
{{> Footer this }}

View File

@@ -25,6 +25,7 @@
{{> InfoBlock info="You will be notified when new announcements are posted on the status page."}}
{{> OwnerInfo this }}
{{> UnsubscribeOwnerEmail this }}
{{> Footer this }}