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:
1 parent
ce646c590f
commit
bb3ba88f18
9 files changed
+65
-43
No files matched your search
@@ -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: {
|
||||
|
||||
Reference in new issue
Block a user