Skip to content

Commit

Permalink
chages after review
Browse files Browse the repository at this point in the history
  • Loading branch information
dzonidoo committed Jul 11, 2024
1 parent c4004c7 commit 79dafb2
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions client/extensions/tga-sign-off/src/utils.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -45,17 +45,13 @@ export function hasUserSignedOff(item: IArticle): boolean {
return false;
}

function getAuthorsWithEditorRole(authors: Array<IAuthor>): Array<IAuthor> {
return authors.filter(author => author.role === 'editor');
}

export function getListAuthorIds(item: IArticle): Array<IUser['_id']> {
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}> {
Expand Down

0 comments on commit 79dafb2

Please sign in to comment.