fix 500 error when all members leave group

master
Aevann 2023-07-07 03:37:17 +03:00
parent 5d5d3d9978
commit f28f7b836c
1 changed files with 5 additions and 0 deletions

View File

@ -189,4 +189,9 @@ def group_reject(v:User, group_name, user_id):
g.db.delete(membership)
count = g.db.query(GroupMembership).filter_by(group_name=group.name).count()
if not count:
g.db.commit() #need it to fix "Dependency rule tried to blank-out primary key column 'group_memberships.group_name' on instance"
g.db.delete(group)
return {"message": msg}