diff --git a/x-pack/plugins/security_solution/server/lib/note/saved_object.ts b/x-pack/plugins/security_solution/server/lib/note/saved_object.ts index a3291709b02c9..0b043d4e2fdd0 100644 --- a/x-pack/plugins/security_solution/server/lib/note/saved_object.ts +++ b/x-pack/plugins/security_solution/server/lib/note/saved_object.ts @@ -32,7 +32,6 @@ import { noteSavedObjectType } from './saved_object_mappings'; import { pickSavedTimeline } from '../timeline/pick_saved_timeline'; import { convertSavedObjectToSavedTimeline } from '../timeline/convert_saved_object_to_savedtimeline'; import { timelineSavedObjectType } from '../timeline/saved_object_mappings'; -import { TimelineStatus } from '../../../common/types/timeline'; export interface Note { deleteNote: (request: FrameworkRequest, noteIds: string[]) => Promise; @@ -149,10 +148,10 @@ export const persistNote = async ( note.timelineId == null ? await (async () => { const timelineResult = convertSavedObjectToSavedTimeline( - await savedObjectsClient.create(timelineSavedObjectType, { - ...pickSavedTimeline(null, {}, request.user), - status: TimelineStatus.draft, - }) + await savedObjectsClient.create( + timelineSavedObjectType, + pickSavedTimeline(null, {}, request.user) + ) ); note.timelineId = timelineResult.savedObjectId; return timelineResult.version; diff --git a/x-pack/plugins/security_solution/server/lib/timeline/pick_saved_timeline.ts b/x-pack/plugins/security_solution/server/lib/timeline/pick_saved_timeline.ts index d3d7783dc9385..6c664f55eccf8 100644 --- a/x-pack/plugins/security_solution/server/lib/timeline/pick_saved_timeline.ts +++ b/x-pack/plugins/security_solution/server/lib/timeline/pick_saved_timeline.ts @@ -27,7 +27,7 @@ export const pickSavedTimeline = ( savedTimeline.updatedBy = userInfo?.username ?? UNAUTHENTICATED_USER; } - if (savedTimeline.status === TimelineStatus.draft) { + if (savedTimeline.status === TimelineStatus.draft || savedTimeline.status == null) { savedTimeline.status = !isEmpty(savedTimeline.title) ? TimelineStatus.active : TimelineStatus.draft;