feat: allow normal users to see userId filter with only themselves as option (#26835)
* feat: allow normal users to see userId filter with only themselves as option Co-Authored-By: [email protected] <[email protected]> * fix: return empty map when canReadOthersBookings is false and currentUser doesn't exist Co-Authored-By: [email protected] <[email protected]> * fix: use generic type parameter for Table to fix type compatibility Co-Authored-By: [email protected] <[email protected]> * perf: disable listSimpleMembers query when canReadOthersBookings is false Co-Authored-By: [email protected] <[email protected]> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
6216b58460
commit
052e99f7ba
6 files changed
+91
-57
No files matched your search
@@ -1,7 +1,5 @@
|
||||
import { expect } from "@playwright/test";
|
||||
|
||||
import { MembershipRole } from "@calcom/prisma/enums";
|
||||
|
||||
import { expect } from "@playwright/test";
|
||||
import { test } from "./lib/fixtures";
|
||||
|
||||
test.describe.configure({ mode: "parallel" });
|
||||
@@ -9,13 +7,17 @@ test.describe.configure({ mode: "parallel" });
|
||||
test.afterEach(({ users }) => users.deleteAll());
|
||||
|
||||
test.describe("Booking Filters", () => {
|
||||
test("Member role should not see the member filter", async ({ page, users }) => {
|
||||
test("Member role should see the member filter with only themselves as option", async ({ page, users }) => {
|
||||
const teamMateName = "team mate 1";
|
||||
await users.create(undefined, {
|
||||
hasTeam: true,
|
||||
isOrg: true,
|
||||
teammates: [{ name: teamMateName }],
|
||||
});
|
||||
const ownerName = "team owner";
|
||||
await users.create(
|
||||
{ name: ownerName },
|
||||
{
|
||||
hasTeam: true,
|
||||
isOrg: true,
|
||||
teammates: [{ name: teamMateName }],
|
||||
}
|
||||
);
|
||||
|
||||
const allUsers = users.get();
|
||||
const memberUser = allUsers.find((user) => user.name === teamMateName);
|
||||
@@ -31,7 +33,15 @@ test.describe("Booking Filters", () => {
|
||||
await page.goto(`/bookings/upcoming`, { waitUntil: "domcontentloaded" });
|
||||
await bookingsGetResponse;
|
||||
await page.locator('[data-testid="add-filter-button"]').click();
|
||||
await expect(page.locator('[data-testid="add-filter-item-userId"]')).toBeHidden();
|
||||
await expect(page.locator('[data-testid="add-filter-item-userId"]')).toBeVisible();
|
||||
|
||||
// Click on the member filter to open options
|
||||
await page.locator('[data-testid="add-filter-item-userId"]').click();
|
||||
|
||||
// Verify only the current user (member) is shown as an option, not the owner
|
||||
const filterOptions = page.getByTestId("select-filter-options-userId");
|
||||
await expect(filterOptions.getByRole("option", { name: teamMateName })).toBeVisible();
|
||||
await expect(filterOptions.getByRole("option", { name: ownerName })).toBeHidden();
|
||||
});
|
||||
|
||||
test("Admin role should see the member filter", async ({ page, users }) => {
|
||||
|
||||
Reference in new issue
Block a user