From 9a84d690797d2403c23d7d5e7b8f4057db62e73e Mon Sep 17 00:00:00 2001 From: F-G Fernandez <26927750+frgfm@users.noreply.github.com> Date: Mon, 4 Dec 2023 17:03:51 +0100 Subject: [PATCH] refactor: Updated waitlist route --- src/app/api/api_v1/endpoints/repos.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/app/api/api_v1/endpoints/repos.py b/src/app/api/api_v1/endpoints/repos.py index 1754ce8..02d2b46 100644 --- a/src/app/api/api_v1/endpoints/repos.py +++ b/src/app/api/api_v1/endpoints/repos.py @@ -158,13 +158,15 @@ async def add_repo_to_waitlist( user=Security(get_current_user, scopes=[UserScope.ADMIN, UserScope.USER]), ) -> None: telemetry_client.capture(user.id, event="repo-waitlist", properties={"repo_id": repo_id}) - # Check if repo exists - repo = await repos.get(repo_id, strict=False) - if repo is None: - gh_repo = gh_client.get_repo(repo_id) - # Notify slack - slack_client.notify( - f"New guideline request for <{gh_repo['html_url']}|{gh_repo['full_name']}> " - f"({gh_repo['stargazers_count']} :star:, {gh_repo['forks']} forks) :pray:", - [], - ) + gh_repo = gh_client.get_repo(repo_id) + # Notify slack + slack_client.notify( + f"Request from :pray:", + [ + ( + "Repo", + f"<{gh_repo['html_url']}|{gh_repo['full_name']}> " + f"({gh_repo['stargazers_count']} :star:, {gh_repo['forks']} :fork_and_knife:)", + ), + ], + )