Skip to content

Support GitHub Enterprise avatars via Enterprise REST service and optionally Gravatar #4497

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

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
25 changes: 25 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,30 @@
"type": "boolean",
"default": false,
"description": "%githubPullRequests.showPullRequestNumberInTree.description%"
},
"githubPullRequests.defaultGravatarsStyle": {
"type": "string",
"default": "none",
"enum": [
"none",
"identicon",
"mp",
"monsterid",
"retro",
"robohash",
"wavatar"
],
"enumDescriptions": [
"%githubPullRequests.defaultGravatarsStyle.none%",
"%githubPullRequests.defaultGravatarsStyle.identicon%",
"%githubPullRequests.defaultGravatarsStyle.mp%",
"%githubPullRequests.defaultGravatarsStyle.monsterid%",
"%githubPullRequests.defaultGravatarsStyle.retro%",
"%githubPullRequests.defaultGravatarsStyle.robohash%",
"%githubPullRequests.defaultGravatarsStyle.wavatar%"
],
"description": "%githubPullRequests.defaultGravatarsStyle.description%",
"scope": "window"
}
}
},
Expand Down Expand Up @@ -2355,6 +2379,7 @@
"fast-deep-equal": "^3.1.3",
"lru-cache": "6.0.0",
"marked": "^4.0.10",
"p-queue": "^6.6.2",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"ssh-config": "4.1.1",
Expand Down
8 changes: 8 additions & 0 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@
"githubPullRequests.defaultCommentType.description": "The default comment type to use when submitting a comment and there is no active review",
"githubPullRequests.defaultCommentType.single": "Submits the comment as a single comment that will be immediately visible to other users",
"githubPullRequests.defaultCommentType.review": "Submits the comment as a review comment that will be visible to other users once the review is submitted",
"githubPullRequests.defaultGravatarsStyle.description":"Specifies the style of the gravatar default (fallback) images",
"githubPullRequests.defaultGravatarsStyle.none":"Disables Gravatar integration for GitHub Enterprise repositories",
"githubPullRequests.defaultGravatarsStyle.identicon":"A geometric pattern",
"githubPullRequests.defaultGravatarsStyle.mp":"A simple, cartoon-style silhouetted outline of a person (does not vary by email hash)",
"githubPullRequests.defaultGravatarsStyle.monsterid":"A monster with different colors, faces, etc",
"githubPullRequests.defaultGravatarsStyle.retro":"8-bit arcade-style pixelated faces",
"githubPullRequests.defaultGravatarsStyle.robohash":"A robot with different colors, faces, etc",
"githubPullRequests.defaultGravatarsStyle.wavatar":"A face with differing features and backgrounds",
"githubPullRequests.setAutoMerge.description": "Checks the \"Auto-merge\" checkbox in the \"Create Pull Request\" view.",
"githubIssues.ignoreMilestones.description": "An array of milestones titles to never show issues from.",
"githubIssues.createIssueTriggers.description": "Strings that will cause the 'Create issue from comment' code action to show.",
Expand Down
6 changes: 5 additions & 1 deletion src/common/remote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/

import { Repository } from '../api/api';
import { getEnterpriseUri } from '../github/utils';
import { getEnterpriseUri, isEnterprise } from '../github/utils';
import { AuthProvider, GitHubServerType } from './authentication';
import { Protocol } from './protocol';

Expand All @@ -28,6 +28,10 @@ export class Remote {
return this.host === getEnterpriseUri()?.authority ? AuthProvider['github-enterprise'] : AuthProvider.github;
}

public get isEnterprise(): boolean {
return isEnterprise(this.authProviderId);
}

constructor(
public readonly remoteName: string,
public readonly url: string,
Expand Down
1 change: 1 addition & 0 deletions src/common/settingKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const DEFAULT_DELETION_METHOD = 'defaultDeletionMethod';
export const SELECT_LOCAL_BRANCH = 'selectLocalBranch';
export const SELECT_REMOTE = 'selectRemote';
export const REMOTES = 'remotes';
export const DEFAULT_GRAVATAR_STYLE = 'defaultGravatarsStyle';

export const ISSUES_SETTINGS_NAMESPACE = 'githubIssues';
export const ASSIGN_WHEN_WORKING = 'assignWhenWorking';
Expand Down
3 changes: 2 additions & 1 deletion src/gitExtensionIntegration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { RemoteSource, RemoteSourceProvider } from './@types/git';
import { AuthProvider } from './common/authentication';
import { OctokitCommon } from './github/common';
import { CredentialStore, GitHub } from './github/credentials';
import { isEnterprise } from './github/utils';

interface Repository {
readonly full_name: string;
Expand Down Expand Up @@ -39,7 +40,7 @@ export class GithubRemoteSourceProvider implements RemoteSourceProvider {
private userReposCache: RemoteSource[] = [];

constructor(private readonly credentialStore: CredentialStore, private readonly authProviderId: AuthProvider = AuthProvider.github) {
if (authProviderId === AuthProvider['github-enterprise']) {
if (isEnterprise(authProviderId)) {
this.name = 'GitHub Enterprise';
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/github/activityBarViewProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ export class PullRequestViewProvider extends WebviewViewBase implements vscode.W
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src vscode-resource: https:; script-src 'nonce-${nonce}'; style-src vscode-resource: 'unsafe-inline' http: https: data:;">
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src vscode-resource: https: data:; script-src 'nonce-${nonce}'; style-src vscode-resource: 'unsafe-inline' http: https: data:;">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Active Pull Request</title>
Expand Down
Loading