fix 500 error

master
Aevann 2024-04-06 06:35:44 +02:00
parent 1a60e5a7a2
commit a6a442c91d
1 changed files with 5 additions and 2 deletions

View File

@ -76,6 +76,9 @@ def private_chat(v, chat_id):
g.db.add(membership)
g.db.commit() #to clear notif count
if chat.id == 1:
sorted_memberships = None
else:
query = g.db.query(ChatMembership).filter_by(chat_id=chat.id)
sorted_memberships = [query.filter_by(user_id=chat.owner_id).one()] + query.filter(ChatMembership.user_id != chat.owner_id).join(ChatMembership.user).order_by(func.lower(User.username)).all()