Fixed user ownership check if habit_lists
This commit is contained in:
parent
e57cc58b3e
commit
fce1593e32
@ -324,7 +324,7 @@ def habitList_update_slot(id: int, slot: int):
|
||||
|
||||
|
||||
def get_habitLists(user_id: int):
|
||||
query = (f"SELECT habit_lists.*, habit_users.user_id, habit_users.accepted FROM habit_lists JOIN habit_users ON habit_lists.id = habit_users.list_id "
|
||||
query = (f"SELECT habit_lists.*, habit_users.accepted FROM habit_lists JOIN habit_users ON habit_lists.id = habit_users.list_id "
|
||||
f"WHERE habit_users.user_id = {user_id};")
|
||||
conn = con3()
|
||||
cursor = conn.cursor()
|
||||
|
||||
@ -54,10 +54,9 @@ class User(UserMixin):
|
||||
raw_habitLists = get_habitLists(self.id)
|
||||
habitLists = []
|
||||
for habitList in raw_habitLists:
|
||||
user_id = habitList[5]
|
||||
accepted = habitList[6]
|
||||
habitList = HabitList(habitList[0], habitList[1], habitList[2], habitList[3])
|
||||
if accepted == 1 or habitList.get_users()[0].id == user_id:
|
||||
if accepted == 1:
|
||||
habitLists.append(habitList)
|
||||
|
||||
return habitLists
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user