fix: Skip trial button visibility (#23034)

* fix: flaky e2e

* fix: skip trial button visibility

* fix type error

* fix test

* update

* Update skipTeamTrials.test.ts

* fix test
This commit is contained in:
Anik Dhabal Babu authored and GitHub committed 2025-08-26 17:25:37 +05:30
1 parent ce646c590f
commit bb3ba88f18
9 files changed
+65 -43

No files matched your search

+7
View File
@@ -46,5 +46,12 @@ export function useHasActiveTeamPlan() {
return { isPending, hasActiveTeamPlan: !!data?.isActive, isTrial: !!data?.isTrial };
}
export function useHasActiveTeamPlanAsOwner() {
if (IS_SELF_HOSTED) return { isPending: false, hasActiveTeamPlan: true, isTrial: false };
const { data, isPending } = trpc.viewer.teams.hasActiveTeamPlan.useQuery({ ownerOnly: true });
return { isPending, hasActiveTeamPlan: !!data?.isActive, isTrial: !!data?.isTrial };
}
export default useHasPaidPlan;
@@ -461,6 +461,21 @@ export class MembershipRepository {
})) as unknown as Promise<MembershipDTOFromSelect<TSelect>[]>;
}
static async findAllAcceptedTeamMemberships(userId: number, where?: Prisma.MembershipWhereInput) {
const teams = await prisma.team.findMany({
where: {
members: {
some: {
userId,
accepted: true,
...(where ?? {}),
},
},
},
});
return teams;
}
async findTeamAdminsByTeamId({ teamId }: { teamId: number }) {
return await this.prismaClient.membership.findMany({
where: {