Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add item action to superdesk api #4366

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions scripts/api/article.ts
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,12 @@ function get(id: IArticle['_id']): Promise<IArticle> {
return dataApi.findOne<IArticle>('archive', id);
}

function itemAction(article: IArticle): any {
Copy link
Member

@tomaskikutis tomaskikutis Nov 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

look up and specify the return type

const authoring = ng.get('authoring');

return authoring.itemAction(article);
}

function isEditable(_article: IArticle): boolean {
const itemState: ITEM_STATE = _article.state;
const authoring = ng.get('authoring');
Expand Down Expand Up @@ -424,6 +430,7 @@ interface IArticleApi {
*/
isPublished(article: IArticle, includeScheduled?: boolean): boolean;

itemAction(article: IArticle): any;
isKilled(article: IArticle): boolean;
isIngested(article: IArticle): boolean;
isPersonal(article: IArticle): boolean;
Expand Down Expand Up @@ -491,6 +498,7 @@ export const article: IArticleApi = {
rewrite,
isLocked,
isEditable,
itemAction,
isLockedInCurrentSession,
isLockedInOtherSession,
isLockedByCurrentUser,
Expand Down
1 change: 1 addition & 0 deletions scripts/core/get-superdesk-api-implementation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ export function getSuperdeskApiImplementation(
patch: patchArticle,
isArchived: sdApi.article.isArchived,
isPublished: (article) => sdApi.article.isPublished(article),
itemAction: (article) => sdApi.article.itemAction(article),
},
desk: {
getStagesOrdered: (deskId: string) =>
Expand Down
1 change: 1 addition & 0 deletions scripts/core/superdesk-api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2691,6 +2691,7 @@ declare module 'superdesk-api' {

isArchived(article: IArticle): boolean;
isPublished(article: IArticle): boolean;
itemAction(article: IArticle): any;
};
contentProfile: {
get(id: string): Promise<IContentProfile>;
Expand Down