From 3ffcbf13e9d4bf62e9be8d1c7b9bcd205c0b58ed Mon Sep 17 00:00:00 2001 From: DevPanther Date: Thu, 7 Mar 2024 10:15:46 +0100 Subject: [PATCH] feat: revert test --- src/home/fetch-github/fetch-issues-preview.ts | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/home/fetch-github/fetch-issues-preview.ts b/src/home/fetch-github/fetch-issues-preview.ts index a45636e8..21960918 100644 --- a/src/home/fetch-github/fetch-issues-preview.ts +++ b/src/home/fetch-github/fetch-issues-preview.ts @@ -1,27 +1,26 @@ import { Octokit } from "@octokit/rest"; -import { getGitHubAccessToken } from "../getters/get-github-access-token"; +import { getGitHubAccessToken, getGitHubUserName } from "../getters/get-github-access-token"; import { GitHubIssue } from "../github-types"; import { taskManager } from "../home"; import { displayPopupMessage } from "../rendering/display-popup-modal"; import { TaskNoFull } from "./preview-to-full-mapping"; async function checkPrivateRepoAccess(): Promise { - //const octokit = new Octokit({ auth: await getGitHubAccessToken() }); - // const username = getGitHubUserName(); + const octokit = new Octokit({ auth: await getGitHubAccessToken() }); + const username = getGitHubUserName(); try { - // const response = await octokit.repos.checkCollaborator({ - // owner: "ubiquity", - // repo: "devpool-directory-private", - // username, - // }); + const response = await octokit.repos.checkCollaborator({ + owner: "ubiquity", + repo: "devpool-directory-private", + username, + }); - // if (response.status === 204) { - // // If the response is successful, it means the user has access to the private repository - // return true; - // } - // return false; - return true; + if (response.status === 204) { + // If the response is successful, it means the user has access to the private repository + return true; + } + return false; } catch (error) { if (error.status === 404) { // If the status is 404, it means the user is not a collaborator, hence no access