Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Commit a468538

Browse files
authored
Fix: pick action bot user based on workspace (#195)
1 parent b2cf992 commit a468538

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

actions/slack/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"packageManager": "pnpm@8.15.6",
1111
"dependencies": {
1212
"@tegonhq/sdk": "^0.1.3",
13-
"@trigger.dev/sdk": "3.0.0-beta.55",
13+
"@trigger.dev/sdk": "3.0.0-beta.56",
1414
"axios": "^1.6.7",
1515
"form-data": "^4.0.0"
1616
},

apps/server/src/modules/action-event/action-event.utils.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,17 @@ export const prepareTriggerPayload = async (
3434
prisma: PrismaService,
3535
actionId: string,
3636
) => {
37-
const action = await prisma.action.findFirst({
37+
const action = await prisma.action.findUnique({
3838
where: {
3939
id: actionId,
4040
},
4141
});
4242

43-
const actionUser = await prisma.user.findFirst({
44-
where: { username: action.slug },
43+
const actionUser = await prisma.usersOnWorkspaces.findFirst({
44+
where: { workspaceId: action.workspaceId, user: { username: action.slug } },
4545
});
4646

47-
const accessToken = await generateKeyForUserId(actionUser.id);
47+
const accessToken = await generateKeyForUserId(actionUser.userId);
4848

4949
const integrationMap = await getIntegrationAccountsFromActions(
5050
prisma,

apps/server/src/modules/webhook/webhook.service.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,11 @@ export default class WebhookService {
8888

8989
// TODO (actons): Send all integration accounts based on the ask
9090
actionEntities.map(async (actionEntity: ActionEntity) => {
91-
const actionUser = await this.prisma.user.findFirst({
92-
where: { username: actionEntity.action.slug },
91+
const actionUser = await this.prisma.usersOnWorkspaces.findFirst({
92+
where: {
93+
workspaceId: actionEntity.action.workspaceId,
94+
user: { username: actionEntity.action.slug },
95+
},
9396
});
9497
const accessToken = await generateKeyForUserId(actionUser.id);
9598

0 commit comments

Comments
 (0)