users: return empty profile if no mutual guilds

This commit is contained in:
Luna 2019-02-05 17:28:00 -03:00
parent d2f004b080
commit 73e83c2b81
1 changed files with 6 additions and 3 deletions

View File

@ -378,14 +378,17 @@ async def get_library():
async def get_profile(peer_id: int):
"""Get a user's profile."""
user_id = await token_check()
# TODO: check if they have any mutual guilds,
# and return empty profile if they don't.
peer = await app.storage.get_user(peer_id)
if not peer:
return '', 404
mutuals = await app.user_storage.get_mutual_guilds(user_id, peer_id)
# don't return a proper card if no guilds are being shared.
if not mutuals:
return '', 404
# actual premium status is determined by that
# column being NULL or not
peer_premium = await app.db.fetchval("""