Skip to content

Commit

Permalink
fix non-author commit event.
Browse files Browse the repository at this point in the history
  • Loading branch information
rebornix committed Jan 11, 2019
1 parent 60e39c3 commit a52791e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion preview-src/pullRequestOverviewRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ export function renderCommit(timelineEvent: CommitEvent): HTMLElement {

const message: HTMLDivElement = document.createElement('div');
message.className = 'message';
if (timelineEvent.author.url && timelineEvent.author.avatarUrl) {
if (timelineEvent.author && timelineEvent.author.url && timelineEvent.author.avatarUrl) {
const userIcon = renderUserIcon(timelineEvent.author.url, timelineEvent.author.avatarUrl);
commitMessage.appendChild(userIcon);

Expand Down
4 changes: 4 additions & 0 deletions src/github/queries.gql
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ fragment Commit on Commit {
url
}
}
committer {
avatarUrl
name
}
url
oid
message
Expand Down
2 changes: 1 addition & 1 deletion src/github/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export function parseGraphQLTimelineEvents(events: any[]): TimelineEvent[] {

if (event.event === EventType.Committed) {
event.sha = event.oid;
event.author = event.author.user;
event.author = event.author.user || { login: event.committer.name, avatarUrl: event.committer.avatarUrl };
event.htmlUrl = event.url;
}
});
Expand Down

0 comments on commit a52791e

Please sign in to comment.