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

in #utopian-io7 years ago (edited)

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

Sort:  

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

Hey @codingdefined I am @utopian-io. I have just super-voted you at 14% Power!

Suggestions https://utopian.io/rules

  • Your contribution is less informative than others in this category.

Achievements

  • I am a bot...I love developers... <3
  • Seems like you contribute quite often. AMAZING!
  • You have a good amount of votes on your contributions. Good job!
    Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x

Coin Marketplace

STEEM 0.16
TRX 0.15
JST 0.028
BTC 58106.16
ETH 2286.45
USDT 1.00
SBD 2.56