diff --git a/litecord/blueprints/users.py b/litecord/blueprints/users.py index 2ed1076..8fbb270 100644 --- a/litecord/blueprints/users.py +++ b/litecord/blueprints/users.py @@ -495,7 +495,7 @@ async def _del_from_table(table: str, user_id: int): @bp.route('/@me/delete', methods=['POST']) async def delete_account(): """Delete own account. - + This removes the account from all tables and forces all currently connected clients to reconnect. """ diff --git a/litecord/user_storage.py b/litecord/user_storage.py index 1f0e2bd..972e16a 100644 --- a/litecord/user_storage.py +++ b/litecord/user_storage.py @@ -291,6 +291,16 @@ class UserStorage: async def get_mutual_guilds(self, user_id: int, peer_id: int) -> List[int]: """Get a list of guilds two separate users have in common.""" + if user_id == peer_id: + # if we are trying to query the mutual guilds with ourselves, we + # only need to give the list of guilds we are on. + + # doing the INTERSECT has some edge-cases that can fuck up testing, + # such as a user querying its own profile card while they are + # not in any guilds. + + return await self.get_user_guilds(user_id) or [0] + mutual_guilds = await self.db.fetch(""" SELECT guild_id FROM members WHERE user_id = $1 INTERSECT