Skip to content

Commit d311536

Browse files
committed
Rework centralized config strings
1 parent b1d859a commit d311536

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/common/settingKeys.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export const DEFAULT_DELETION_METHOD = 'defaultDeletionMethod';
2727
export const SELECT_LOCAL_BRANCH = 'selectLocalBranch';
2828
export const SELECT_REMOTE = 'selectRemote';
2929
export const REMOTES = 'remotes';
30+
export const DEFAULT_GRAVATAR_STYLE = 'defaultGravatarsStyle';
3031

3132
export const ISSUES_SETTINGS_NAMESPACE = 'githubIssues';
3233
export const ASSIGN_WHEN_WORKING = 'assignWhenWorking';

src/github/avatars.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { OctokitResponse, RequestParameters, ResponseHeaders } from '@octokit/ty
1010
import PQueue from 'p-queue';
1111
import * as vscode from 'vscode';
1212
import Logger from '../common/logger';
13+
import { DEFAULT_GRAVATAR_STYLE, PR_SETTINGS_NAMESPACE } from '../common/settingKeys';
1314
import * as Common from '../common/timelineEvent';
1415
import { IAccount, Issue, ITeam, PullRequest } from './interface';
1516
import { LoggingOctokit } from './loggingOctokit';
@@ -23,8 +24,8 @@ function isGravatarEnabled() {
2324

2425
function getGravatarStyle() {
2526
return vscode.workspace
26-
.getConfiguration('githubPullRequests')
27-
.get<string>('defaultGravatarsStyle', GRAVATAR_STYLE_NONE);
27+
.getConfiguration(PR_SETTINGS_NAMESPACE)
28+
.get<string>(DEFAULT_GRAVATAR_STYLE, GRAVATAR_STYLE_NONE);
2829
}
2930

3031
function generateGravatarUrl(gravatarId: string | undefined, size: number = 200): string | undefined {
@@ -168,7 +169,7 @@ export class Avatars {
168169
const serverDate = headers.date ? new Date(headers.date) : new Date();
169170
const expireAt = serverDate.setSeconds(
170171
serverDate.getSeconds() +
171-
(cacheControlDirectives['s-maxage'] ?? cacheControlDirectives['max-age'] ?? 0),
172+
(cacheControlDirectives['s-maxage'] ?? cacheControlDirectives['max-age'] ?? 0),
172173
);
173174
if (expireAt - Date.now() > 0) {
174175
Logger.appendLine('Cache fresh hit', LOGGER_COMPONENT);
@@ -249,7 +250,7 @@ export class Avatars {
249250
await vscode.workspace.fs.writeFile(cacheResult.uri, cacheResult.content);
250251
return convertBinaryToDataUri(cacheResult.content, cacheResult.contentType);
251252
},
252-
(reason: RequestError) => {
253+
(reason: RequestError) => {
253254
if (reason.status !== 304) {
254255
Logger.warn(`REST request failed: ${reason.message}`, LOGGER_COMPONENT);
255256
return;

0 commit comments

Comments
 (0)