Skip to content

Commit

Permalink
feat: display author of changes in workflow tab
Browse files Browse the repository at this point in the history
Made code changes for GitHub backend as part of this commit
  • Loading branch information
reshmar committed Sep 4, 2021
1 parent 7ed5675 commit 92584e1
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/netlify-cms-backend-github/src/API.ts
Original file line number Diff line number Diff line change
Expand Up @@ -581,12 +581,14 @@ export default class API {
};
const status = labelToStatus(label.name, this.cmsLabelPrefix);
const updatedAt = pullRequest.updated_at;
const pullRequestAuthor = pullRequest.user.login;
return {
collection,
slug,
status,
diffs: diffs.map(d => ({ path: d.path, newFile: d.newFile, id: d.sha })),
updatedAt,
pullRequestAuthor,
};
}

Expand Down
1 change: 1 addition & 0 deletions packages/netlify-cms-core/src/backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,7 @@ export class Backend {
label: collection && selectFileEntryLabel(collection, slug),
mediaFiles,
updatedOn: entryData.updatedAt,
author: entryData.pullRequestAuthor,
status: entryData.status,
meta: { path: prepareMetaPath(path, collection) },
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,14 @@ function WorkflowCard({
allowPublish,
canPublish,
onPublish,
postAuthor,
t,
}) {
return (
<WorkflowCardContainer>
<WorkflowLink to={editLink}>
<CardCollection>{collectionLabel}</CardCollection>
{postAuthor}
<CardTitle>{title}</CardTitle>
{(timestamp || authorLastChange) && <CardDate date={timestamp} author={authorLastChange} />}
<CardBody>{body}</CardBody>
Expand Down Expand Up @@ -168,6 +170,7 @@ WorkflowCard.propTypes = {
allowPublish: PropTypes.bool.isRequired,
canPublish: PropTypes.bool.isRequired,
onPublish: PropTypes.func.isRequired,
postAuthor: PropTypes.string,
t: PropTypes.func.isRequired,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ class WorkflowList extends React.Component {

const allowPublish = collection?.get('publish');
const canPublish = ownStatus === status.last() && !entry.get('isPersisting', false);
const postAuthor = entry.get('author');

return (
<DragSource
Expand All @@ -244,6 +245,7 @@ class WorkflowList extends React.Component {
allowPublish={allowPublish}
canPublish={canPublish}
onPublish={this.requestPublish.bind(this, collectionName, slug, ownStatus)}
postAuthor={postAuthor}
/>
</div>,
)
Expand Down
1 change: 1 addition & 0 deletions packages/netlify-cms-lib-util/src/implementation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export interface UnpublishedEntryDiff {
}

export interface UnpublishedEntry {
pullRequestAuthor?: string;
slug: string;
collection: string;
status: string;
Expand Down

0 comments on commit 92584e1

Please sign in to comment.