bugfix: filter flows on folder to ensure is displaying only for the logged user (#2897)

* 🐛 (generalBugs-shard-5.spec.ts): fix test to wait for elements to be interactable before performing actions to prevent flakiness

* 🐛 (folders.py): fix issue where all flows were being returned instead of only flows from the current user in the specified folder
This commit is contained in:
Cristhian Zanforlin Lousa 2024-07-23 14:06:16 -03:00 committed by GitHub
commit 7ffcdd2b68
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -107,6 +107,8 @@ def read_folder(
folder = session.exec(select(Folder).where(Folder.id == folder_id, Folder.user_id == current_user.id)).first()
if not folder:
raise HTTPException(status_code=404, detail="Folder not found")
flows_from_current_user_in_folder = [flow for flow in folder.flows if flow.user_id == current_user.id]
folder.flows = flows_from_current_user_in_folder
return folder
except Exception as e:
if "No result found" in str(e):