fix: Organization User Events' Spam (#24468)
* fix: Organization User Events' Spam * fix: derive organizationId from hostname for spam check Instead of only checking the team's parentId or eventType.profile.organizationId, the spam check now first attempts to derive the organization ID from the hostname. This ensures that organization-level spam blocking works correctly based on the domain/subdomain the booker is visiting, which is especially important for multi-tenant deployments where the same event type might be accessible via different organization domains. Changes: - Extract org slug from hostname using getOrgSlug() - Fetch organization by slug using OrganizationRepository - Use hostname-derived orgId for spam check, falling back to team/profile orgId - Maintains backward compatibility when hostname is not available 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
5a59bb86cd
commit
3076aca457
4 files changed
+157
-13
No files matched your search
@@ -58,6 +58,17 @@ const organizationWithSettingsSelect = {
|
||||
},
|
||||
};
|
||||
|
||||
const profileSelect = {
|
||||
id: true,
|
||||
uid: true,
|
||||
userId: true,
|
||||
organizationId: true,
|
||||
username: true,
|
||||
createdAt: true,
|
||||
updatedAt: true,
|
||||
};
|
||||
|
||||
|
||||
export enum LookupTarget {
|
||||
User,
|
||||
Profile,
|
||||
@@ -627,6 +638,15 @@ export class ProfileRepository {
|
||||
return profiles;
|
||||
}
|
||||
|
||||
static async findFirstForUserId({ userId }: { userId: number }) {
|
||||
return prisma.profile.findFirst({
|
||||
where: {
|
||||
userId: userId,
|
||||
},
|
||||
select: profileSelect,
|
||||
});
|
||||
}
|
||||
|
||||
static async findManyForOrg({ organizationId }: { organizationId: number }) {
|
||||
return await prisma.profile.findMany({
|
||||
where: {
|
||||
|
||||
Reference in new issue
Block a user