mirror of https://gitlab.com/litecord/litecord.git
users: return empty profile if no mutual guilds
This commit is contained in:
parent
d2f004b080
commit
73e83c2b81
|
|
@ -378,14 +378,17 @@ async def get_library():
|
||||||
async def get_profile(peer_id: int):
|
async def get_profile(peer_id: int):
|
||||||
"""Get a user's profile."""
|
"""Get a user's profile."""
|
||||||
user_id = await token_check()
|
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)
|
peer = await app.storage.get_user(peer_id)
|
||||||
|
|
||||||
if not peer:
|
if not peer:
|
||||||
return '', 404
|
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
|
# actual premium status is determined by that
|
||||||
# column being NULL or not
|
# column being NULL or not
|
||||||
peer_premium = await app.db.fetchval("""
|
peer_premium = await app.db.fetchval("""
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue