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

refactor(workspace, users, billing): remove default workspace + rename #9360

Merged
merged 4 commits into from
Jan 6, 2025

Conversation

AMoreaux
Copy link
Contributor

@AMoreaux AMoreaux commented Jan 6, 2025

Replaced user-based parameterization with workspace-focused logic across seed scripts, mocks, and billing services. Removed redundant user references and standardized to workspace to align with updated business rules. Adjusted mock data and tests to reflect these changes.

Fix #9295

Replaced user-based parameterization with workspace-focused logic across seed scripts, mocks, and billing services. Removed redundant `user` references and standardized to `workspace` to align with updated business rules. Adjusted mock data and tests to reflect these changes.
@AMoreaux AMoreaux requested a review from FelixMalfait January 6, 2025 09:17
@AMoreaux AMoreaux self-assigned this Jan 6, 2025
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This PR refactors the codebase to standardize workspace terminology and remove user-based parameterization in favor of workspace-focused logic.

  • Renamed mockDefaultWorkspace to mockCurrentWorkspace across front-end components and tests for consistent terminology
  • Removed workspaceId parameter from seedUsers function and updated user deletion logic to use workspace associations
  • Modified BillingSubscriptionService to accept Workspace instead of User parameter in applyBillingSubscription method
  • Updated billing resolver methods to use workspace-focused logic, removing unnecessary user parameters
  • Simplified user-workspace relationship handling in database operations by removing direct workspace references

11 file(s) reviewed, 2 comment(s)
Edit PR Review Bot Settings | Greptile

Comment on lines +32 to 35
setCurrentWorkspace(mockCurrentWorkspace);
setCurrentWorkspaceMember(mockedWorkspaceMemberData);
setCurrentUser(mockedUserData);
setSupportChat({ supportDriver: 'front', supportFrontChatId: '1234' });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: setCurrentWorkspace, setCurrentWorkspaceMember, and setCurrentUser are called in a potentially unsafe order. Consider wrapping these state updates in a useEffect to ensure consistent state updates across re-renders

Removed UserAuthGuard from the billingPortalSession query to fix improper authorization logic. WorkspaceAuthGuard alone ensures the correct level of access in this context.
@FelixMalfait
Copy link
Member

Great! Spotted one error:
Screenshot 2025-01-06 at 11 16 41

Removed the unused workspaceId parameter from the seedUsers function call. This change aligns the function call with its definition and prevents potential issues caused by passing extraneous arguments.
Copy link
Member

@FelixMalfait FelixMalfait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! (besides red test)

@AMoreaux AMoreaux merged commit 3eb7ec9 into main Jan 6, 2025
23 checks passed
@AMoreaux AMoreaux deleted the fix/remove-remaining-default-workspace branch January 6, 2025 11:33
Copy link
Contributor

github-actions bot commented Jan 6, 2025

Fails
🚫

node failed.

Log

�[31mError: �[39m SyntaxError: Unexpected token C in JSON at position 0
    at JSON.parse (<anonymous>)
�[90m    at parseJSONFromBytes (node:internal/deps/undici/undici:5584:19)�[39m
�[90m    at successSteps (node:internal/deps/undici/undici:5555:27)�[39m
�[90m    at fullyReadBody (node:internal/deps/undici/undici:1665:9)�[39m
�[90m    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)�[39m
�[90m    at async specConsumeBody (node:internal/deps/undici/undici:5564:7)�[39m
danger-results://tmp/danger-results-448a4a73.json

Generated by 🚫 dangerJS against 6f450b8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cleanup defaultWorkspace
2 participants