From ca0b136e62b50da72bdaf605196d0989b6ab268d Mon Sep 17 00:00:00 2001 From: vishnuoruphones Date: Sat, 13 Jul 2024 15:15:02 +0530 Subject: [PATCH] feat : test try for org repo --- server/src/controllers/user/subscribeRepo.ts | 23 ++++++-------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/server/src/controllers/user/subscribeRepo.ts b/server/src/controllers/user/subscribeRepo.ts index 0679cac..f78a48b 100644 --- a/server/src/controllers/user/subscribeRepo.ts +++ b/server/src/controllers/user/subscribeRepo.ts @@ -25,22 +25,13 @@ export const subscribeRepo = async ( const baseGithubUrl = parts.slice(0, 4).join('/'); const user = await getUserByGithubUrl(baseGithubUrl); const repoName = parts[4].toLowerCase(); - let webHook; - if (user) { - webHook = await addWebhookForPersonalRepo( - accessToken, - owner, - repoName, - REPO_WEBHOOK_URL, - ); - } else { - webHook = await addWebhookForOrganizationRepo( - accessToken, - owner, - repoName, - REPO_WEBHOOK_URL, - ); - } + let webHook = await addWebhookForPersonalRepo( + accessToken, + owner, + repoName, + REPO_WEBHOOK_URL, + ); + if (!webHook) throw Error('Issue In Creating Webhook'); if (webHook.active) { await updateRepoSubscription(baseGithubUrl, repoLink, req.body.token);