fix: use graceful filtering for previously hard failing blocked users in team events (#26446)
* init * typefix * -- * fix test * update index * cleanup * rm unnecessary comments * improvements * add tests * test fixes * fixes * fixes * fixes * add try catch to make booking fail-open * Update packages/features/watchlist/operations/check-user-blocking.ts Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> * fix type --------- Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
27623926fc
commit
59fca85d92
20 files changed
+1573
-37
No files matched your search
@@ -911,6 +911,22 @@ export class ProfileRepository {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the first organization ID the user belongs to, or null if none.
|
||||
* Used for org-specific blocking on personal events.
|
||||
*
|
||||
* TODO: When we support checking against multiple orgs, update this to return
|
||||
* all org IDs and check if user is blocked in ANY of them.
|
||||
*/
|
||||
static async findFirstOrganizationIdForUser({ userId }: { userId: number }): Promise<number | null> {
|
||||
const profile = await prisma.profile.findFirst({
|
||||
where: { userId },
|
||||
select: { organizationId: true },
|
||||
});
|
||||
|
||||
return profile?.organizationId ?? null;
|
||||
}
|
||||
|
||||
static async findManyForOrg({ organizationId }: { organizationId: number }) {
|
||||
return await prisma.profile.findMany({
|
||||
where: {
|
||||
|
||||
Reference in new issue
Block a user