From 79dafb29dfcbaf6835ce9a4b92fad0d1392c88af Mon Sep 17 00:00:00 2001 From: dzonidoo Date: Thu, 11 Jul 2024 12:15:06 +0200 Subject: [PATCH] chages after review --- client/extensions/tga-sign-off/src/utils.ts | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/client/extensions/tga-sign-off/src/utils.ts b/client/extensions/tga-sign-off/src/utils.ts index 87c5302..6398bc5 100644 --- a/client/extensions/tga-sign-off/src/utils.ts +++ b/client/extensions/tga-sign-off/src/utils.ts @@ -1,4 +1,4 @@ -import {IArticle, IAuthor, IUser} from 'superdesk-api'; +import {IArticle, IUser} from 'superdesk-api'; import {IPublishSignOff} from './interfaces'; import {superdesk} from './superdesk'; @@ -45,17 +45,13 @@ export function hasUserSignedOff(item: IArticle): boolean { return false; } -function getAuthorsWithEditorRole(authors: Array): Array { - return authors.filter(author => author.role === 'editor'); -} - export function getListAuthorIds(item: IArticle): Array { - const authorsWithEditorRole = getAuthorsWithEditorRole(item.authors ?? []); + const {notNullOrUndefined} = superdesk.helpers; - // @ts-ignore - return authorsWithEditorRole + return (item.authors ?? []) + .filter(author => author.role === 'editor') .map((author) => author.parent) - .filter((authorId) => authorId != null); + .filter(notNullOrUndefined); } export function loadUsersFromPublishSignOff(item: IArticle): Promise<{[userId: string]: IUser}> {