Conversation
includeTeams now matches canViewWebsite: websites the user owns, plus websites with no owner in any team the user belongs to, at any role. The Websites page passes it when no team is selected, and hides the edit action on rows the user cannot update.
|
@yolk3d is attempting to deploy a commit to the Umami Software Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
Greptile SummaryThis PR includes unowned team websites in a user’s personal website list for every team membership role while preserving the API’s default behavior.
Confidence Score: 5/5The PR appears safe to merge; no actionable correctness, security, or repository-rule issues were identified. The team-inclusive query remains scoped to the authenticated or administratively authorized target user, matches existing view authorization, and supplies the membership data required for row-level edit gating.
|
| Filename | Overview |
|---|---|
| src/queries/prisma/website.ts | Broadens team-inclusive listing to all memberships while restricting team matches to unowned websites and returning the caller’s role. |
| src/app/(main)/websites/WebsitesPage.tsx | Enables team-inclusive results only for the personal Websites view. |
| src/app/(main)/websites/WebsitesDataTable.tsx | Propagates the optional includeTeams request parameter through the existing query hook. |
| src/app/(main)/websites/WebsitesTable.tsx | Applies row-level update permission checks before rendering the settings action. |
| tests/api/websites.spec.ts | Covers team-view-only visibility, endpoint consistency, isolation, unchanged defaults, and membership removal. |
| src/queries/prisma/website.test.ts | Pins the ownership and team-membership query structure, including the required null user owner condition. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Websites page] --> B{Team selected?}
B -->|Yes| C[Request selected team's websites]
B -->|No| D[Request user websites with includeTeams]
D --> E[Owned websites]
D --> F[Unowned websites in teams where user is a member]
E --> G[Combined paginated list]
F --> G
G --> H{Caller can update row?}
H -->|Owner or permitted team role| I[Show edit action]
H -->|View-only team role| J[Hide edit action]
Reviews (1): Last reviewed commit: "Include team websites for all team roles..." | Re-trigger Greptile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
I run Umami for several sites that belong to teams, and each client is a view-only member of their own team. They can open their site, but when they sign in the Websites page is empty, because it only lists websites they own. Team owners have the same gap: team sites only appear after switching to that team.
What changed
includeTeamsnow follows the same rule ascanViewWebsite: websites the user owns, plus websites with no owner in any team they belong to, at any role. Before, it only matched team-owner and team-manager, and it also listed team websites that still had an owner, which those members can't open.includeTeamswhen no team is selected. Team views are unchanged, and so is the API default withoutincludeTeams.includeTeamsdescription and regenerated the API client.Related to #4052. The concern there was that account and team context don't mix anywhere yet. This leaves the API default alone and only mixes them on the personal Websites list.
Testing
/api/websites,/api/me/websitesand/api/users/{userId}/websiteswithincludeTeams. They don't see another team's website or websites owned by other users, the default list is unchanged, the list agrees withGET /api/websites/{websiteId}, and the website drops off once they leave the team.userId: null. A website with bothuserIdandteamIdset can't be created through the API, so that case is only covered there.pnpm test:api:runagainst the test compose stack: Postgres 276 passed, ClickHouse 275 passed and 1 skipped (session deletion). Both full runs also end with atokensfixture teardown timeout outside any test. It happened too in a run where the new tests failed before sending a request, and not in a single-spec run, so I don't think it comes from this change, but I haven't checked it against a cleandev.pnpm buildpasses.pnpm lintandtscreport errors that already exist ondev, none in files changed here.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.