Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API: Get all workspaces of user returns every workspace as default #587

Closed
muntaxir4 opened this issue Dec 9, 2024 · 8 comments · Fixed by #647
Closed

API: Get all workspaces of user returns every workspace as default #587

muntaxir4 opened this issue Dec 9, 2024 · 8 comments · Fixed by #647
Assignees
Labels

Comments

@muntaxir4
Copy link
Contributor

Describe the bug
All returned workspaces from /workspace contains isDefault: true, whereas only one workspace should be a default one. This happens when a user becomes a member of host's default workpsace.

Endpoints Affected

  • /workspace
  • /workspace/:workspaceSlug

To Reproduce
Steps to reproduce the behavior:

  1. User1 invites User2 to their default workspace.
  2. User2 requests to view all of their accessible workspaces from /workpsace. Each of the workspace has isDefault set to true.

Expected behavior
A single Default workspace of User2 should have isDefault:true.

@muntaxir4 muntaxir4 added type: bug Something isn't working scope: api Everything related to the API labels Dec 9, 2024
@muntaxir4 muntaxir4 changed the title API: Get all workpspaces of user returns every workspace as default API: Get all workspaces of user returns every workspace as default Dec 10, 2024
@rajdip-b rajdip-b moved this to Todo in keyshade-api Dec 10, 2024
@zaheer-Khan3260
Copy link
Contributor

Hey @rajdip-b, Please assign it to me.

@muntaxir4
Copy link
Contributor Author

Hey @rajdip-b, Please assign it to me.

You can take up this issue using /attempt

@rajdip-b rajdip-b moved this from Todo to In progress in keyshade-api Dec 11, 2024
@csehatt741
Copy link
Contributor

@zaheer-Khan3260, @muntaxir4, any progress here?

I can take a look at this issue, just assign it to me, please.

@rajdip-b
Copy link
Member

Sure you ca go for it.

@csehatt741
Copy link
Contributor

I`ve managed to reproduce this issue locally.

Do you mean only the default workspace of User2 should have isDefault: true, while the default workspace of User1 should have isDefault: false?

@rajdip-b
Copy link
Member

Yes. Every user has a default workspace. If you get invited to someone else's default workspace, you still own a default workspace of your own.

The issue is, right now we are just fetching every workspace without processing the ownerId field.

So, what we want is, before sending out the workspace, we want to do a pre-processing that checks the following clause:

workspace.isDefault = workspace.isDefault && workspace.ownerId == user.id

@rajdip-b
Copy link
Member

🎉 This issue has been resolved in version 2.10.0-stage.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@rajdip-b
Copy link
Member

🎉 This issue has been resolved in version 2.10.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@rajdip-b rajdip-b moved this from Queued for release to Done in keyshade-api Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants