Skip to content
This repository has been archived by the owner on Jan 24, 2023. It is now read-only.

Commit

Permalink
Fix issue where gitlab summary tab threw errors in console
Browse files Browse the repository at this point in the history
- fixes #4325
  • Loading branch information
richard-cox committed May 28, 2020
1 parent 5a6fa07 commit 6e7576a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ import {
GitCommitActionBuilders,
gitCommitActionBuilders,
GitCommitActionBuildersConfig,
GitMeta,
GitRepoActionBuilders,
gitRepoActionBuilders,
} from './entity-action-builders/git-action-builder';
Expand Down Expand Up @@ -899,8 +900,9 @@ function generateGitCommitEntity(endpointDefinition: StratosEndpointExtensionDef
endpoint: endpointDefinition,
nonJetstreamRequest: true,
successfulRequestDataMapper: (data, endpointGuid, guid, entityType, endpointType, action) => {
const metadata = (action.metadata as GitMeta[])[0];
return {
...data,
...metadata.scm.convertCommit(metadata.projectName, data),
guid: action.guid
};
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,8 @@ export class GitHubSCM implements GitSCM {
);
}

public convertCommit(projectName: string, commit: any): GitCommit {
return commit;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export class GitLabSCM implements GitSCM {
};
}

private convertCommit(projectName: string, commit: any): GitCommit {
public convertCommit(projectName: string, commit: any): GitCommit {
const emailMD5 = Md5.hashStr(commit.author_email);
const avatarURL = `https://secure.gravatar.com/avatar/${emailMD5}?s=120&d=identicon`;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export interface GitSCM {
getBranch(httpClient: HttpClient, projectName: string, branchId: string): Observable<GitBranch>;
getBranches(httpClient: HttpClient, projectName: string): Observable<GitBranch[]>;
getCommit(httpClient: HttpClient, projectName: string, commitSha: string): Observable<GitCommit>;
convertCommit(projectName: string, commit: any): GitCommit
getCommits(httpClient: HttpClient, projectName: string, commitSha: string): Observable<GitCommit[]>;
getCloneURL(projectName: string): string;
getCommitURL(projectName: string, commitSha: string): string;
Expand Down

0 comments on commit 6e7576a

Please sign in to comment.