diff --git a/Common/Server/Services/IncidentService.ts b/Common/Server/Services/IncidentService.ts index b301eb0fc4..329c5e7594 100644 --- a/Common/Server/Services/IncidentService.ts +++ b/Common/Server/Services/IncidentService.ts @@ -680,7 +680,6 @@ ${onUpdate.updateBy.data.rootCause || "No root cause provided."} }); } - if (onUpdate.updateBy.data.description) { // add incident feed. const createdByUserId: ObjectID | undefined | null = diff --git a/Dashboard/src/Components/Incident/IncidentFeed.tsx b/Dashboard/src/Components/Incident/IncidentFeed.tsx index d559b0d474..c11ab3247b 100644 --- a/Dashboard/src/Components/Incident/IncidentFeed.tsx +++ b/Dashboard/src/Components/Incident/IncidentFeed.tsx @@ -36,14 +36,11 @@ const IncidentFeedElement: FunctionComponent = ( const [error, setError] = React.useState(undefined); const [feedItems, setFeedItems] = React.useState([]); - const [showPublicNoteModal, setShowPublicNoteModal] = React.useState( - false, - ); - - const [showPrivateNoteModal, setShowPrivateNoteModal] = React.useState( - false, - ); + const [showPublicNoteModal, setShowPublicNoteModal] = + React.useState(false); + const [showPrivateNoteModal, setShowPrivateNoteModal] = + React.useState(false); type GetFeedItemsFromIncidentFeeds = ( incidentFeeds: IncidentFeed[], @@ -237,16 +234,16 @@ const IncidentFeedElement: FunctionComponent = ( buttonStyle: ButtonStyleType.NORMAL, icon: IconProp.Team, onClick: () => { - setShowPublicNoteModal(true); - } + setShowPublicNoteModal(true); + }, }, { title: "Add Private Note", buttonStyle: ButtonStyleType.NORMAL, icon: IconProp.Lock, onClick: () => { - setShowPrivateNoteModal(true); - } + setShowPrivateNoteModal(true); + }, }, { title: "Refresh", @@ -268,111 +265,112 @@ const IncidentFeedElement: FunctionComponent = ( /> )} {showPublicNoteModal && ( - { - setShowPublicNoteModal(false); - }} - submitButtonText="Save" - onBeforeCreate={async (model: IncidentPublicNote) => { - model.incidentId = props.incidentId!; - return model; - }} - onSuccess={() => { - setShowPublicNoteModal(false); - fetchItems().catch((err: unknown) => { - setError(API.getFriendlyMessage(err as Exception)); - }); - }} - formProps={{ - name: "create-scheduled-maintenance-state-timeline", - modelType: IncidentPublicNote, - id: "create-scheduled-maintenance-state-timeline", - fields: [ - { - field: { - note: true, + { + setShowPublicNoteModal(false); + }} + submitButtonText="Save" + onBeforeCreate={async (model: IncidentPublicNote) => { + model.incidentId = props.incidentId!; + return model; + }} + onSuccess={() => { + setShowPublicNoteModal(false); + fetchItems().catch((err: unknown) => { + setError(API.getFriendlyMessage(err as Exception)); + }); + }} + formProps={{ + name: "create-scheduled-maintenance-state-timeline", + modelType: IncidentPublicNote, + id: "create-scheduled-maintenance-state-timeline", + fields: [ + { + field: { + note: true, + }, + fieldType: FormFieldSchemaType.Markdown, + description: + "Post a public note about this state change to the status page.", + title: "Public Note", + required: true, }, - fieldType: FormFieldSchemaType.Markdown, - description: - "Post a public note about this state change to the status page.", - title: "Public Note", - required: true, - }, - { - field: { - postedAt: true, + { + field: { + postedAt: true, + }, + fieldType: FormFieldSchemaType.DateTime, + description: + "The date and time this note was posted. By default, it will be the current date and time.", + title: "Posted At", + required: true, + defaultValue: OneUptimeDate.getCurrentDate(), }, - fieldType: FormFieldSchemaType.DateTime, - description: - "The date and time this note was posted. By default, it will be the current date and time.", - title: "Posted At", - required: true, - defaultValue: OneUptimeDate.getCurrentDate(), - }, - { - field: { - shouldStatusPageSubscribersBeNotifiedOnNoteCreated: true, + { + field: { + shouldStatusPageSubscribersBeNotifiedOnNoteCreated: true, + }, + fieldType: FormFieldSchemaType.Checkbox, + description: + "Should status page subscribers be notified when this note is posted?", + title: "Notify Status Page Subscribers", + required: false, + defaultValue: true, }, - fieldType: FormFieldSchemaType.Checkbox, - description: "Should status page subscribers be notified when this note is posted?", - title: "Notify Status Page Subscribers", - required: false, - defaultValue: true, - }, - ], - formType: FormType.Create, - }} - /> - )} - - {showPrivateNoteModal && ( - { - setShowPrivateNoteModal(false); - }} - submitButtonText="Save" - onBeforeCreate={async (model: IncidentInternalNote) => { - model.incidentId = props.incidentId!; - return model; - }} - onSuccess={() => { - setShowPrivateNoteModal(false); - fetchItems().catch((err: unknown) => { - setError(API.getFriendlyMessage(err as Exception)); - }); - }} - formProps={{ - name: "create-incident-internal-note", - modelType: IncidentInternalNote, - id: "create-incident-internal-note", - fields: [ - { - field: { - note: true, + ], + formType: FormType.Create, + }} + /> + )} + + {showPrivateNoteModal && ( + { + setShowPrivateNoteModal(false); + }} + submitButtonText="Save" + onBeforeCreate={async (model: IncidentInternalNote) => { + model.incidentId = props.incidentId!; + return model; + }} + onSuccess={() => { + setShowPrivateNoteModal(false); + fetchItems().catch((err: unknown) => { + setError(API.getFriendlyMessage(err as Exception)); + }); + }} + formProps={{ + name: "create-incident-internal-note", + modelType: IncidentInternalNote, + id: "create-incident-internal-note", + fields: [ + { + field: { + note: true, + }, + fieldType: FormFieldSchemaType.Markdown, + description: + "Post a private note about this incident. This note will be visible only to the team members of this incident.", + title: "Private Note", + required: true, }, - fieldType: FormFieldSchemaType.Markdown, - description: - "Post a private note about this incident. This note will be visible only to the team members of this incident.", - title: "Private Note", - required: true, - } - ], - formType: FormType.Create, - }} - /> - )} + ], + formType: FormType.Create, + }} + /> + )} );