My Hive Posts

    Displaying only Non Private Repo of the User in Utopian.IO

    Fixing Issue #75 - Projects list displays private projects by @inertia

    Analyzing the Bug

    When we search for the user repository it gives all the information about the repo along with the information that it is a private repo or public repo. It actually has a boolean field (true and false). If it is true that means it is a private repo whereas if it is false it means it is a public repo. So we need to show only public repository in the user profile and not private repo.

    image.png

    Fixing the Bug

    To fix the bug we need to check if the repository is not private using flag (private === false). So in the below code at first we are checking if the repo owner id is the github account id and also if the repo is private or not.

    res.json(repos.filter(repo => repo.owner.login === user.github.account && repo.private === false));

    Commit : https://github.com/utopian-io/api.utopian.io/pull/23/commits/ad0911f03fd1c5e5b6db47e80a0d2df433271556 Pull request : https://github.com/utopian-io/api.utopian.io/pull/23

    image.png



    Open Source Contribution posted via Utopian.io