fix: Match search requests from Slack using Integration for non-Slack teams (#1599)
* Match slack hook requests to integration
This commit is contained in:
@@ -10,6 +10,8 @@ import {
|
||||
Group,
|
||||
GroupUser,
|
||||
Attachment,
|
||||
Authentication,
|
||||
Integration,
|
||||
} from "../models";
|
||||
|
||||
let count = 0;
|
||||
@@ -68,6 +70,33 @@ export async function buildUser(overrides: Object = {}) {
|
||||
});
|
||||
}
|
||||
|
||||
export async function buildIntegration(overrides: Object = {}) {
|
||||
if (!overrides.teamId) {
|
||||
const team = await buildTeam();
|
||||
overrides.teamId = team.id;
|
||||
}
|
||||
|
||||
const user = await buildUser({ teamId: overrides.teamId });
|
||||
|
||||
const authentication = await Authentication.create({
|
||||
service: "slack",
|
||||
userId: user.id,
|
||||
teamId: user.teamId,
|
||||
token: "fake-access-token",
|
||||
scopes: ["example", "scopes", "here"],
|
||||
});
|
||||
|
||||
return Integration.create({
|
||||
type: "post",
|
||||
service: "slack",
|
||||
settings: {
|
||||
serviceTeamId: "slack_team_id",
|
||||
},
|
||||
authenticationId: authentication.id,
|
||||
...overrides,
|
||||
});
|
||||
}
|
||||
|
||||
export async function buildCollection(overrides: Object = {}) {
|
||||
count++;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user