DB migrations
Google button
This commit is contained in:
@@ -14,7 +14,9 @@ router.post('hooks.unfurl', async ctx => {
|
||||
throw new AuthenticationError('Invalid token');
|
||||
|
||||
// TODO: Everything from here onwards will get moved to an async job
|
||||
const user = await User.find({ where: { slackId: event.user } });
|
||||
const user = await User.find({
|
||||
where: { service: 'slack', serviceId: event.user },
|
||||
});
|
||||
if (!user) return;
|
||||
|
||||
const auth = await Authentication.find({
|
||||
@@ -55,7 +57,8 @@ router.post('hooks.slack', async ctx => {
|
||||
|
||||
const user = await User.find({
|
||||
where: {
|
||||
slackId: user_id,
|
||||
service: 'slack',
|
||||
serviceId: user_id,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ describe('#hooks.unfurl', async () => {
|
||||
event: {
|
||||
type: 'link_shared',
|
||||
channel: 'Cxxxxxx',
|
||||
user: user.slackId,
|
||||
user: user.serviceId,
|
||||
message_ts: '123456789.9875',
|
||||
links: [
|
||||
{
|
||||
@@ -55,7 +55,7 @@ describe('#hooks.slack', async () => {
|
||||
const res = await server.post('/api/hooks.slack', {
|
||||
body: {
|
||||
token: process.env.SLACK_VERIFICATION_TOKEN,
|
||||
user_id: user.slackId,
|
||||
user_id: user.serviceId,
|
||||
text: 'dsfkndfskndsfkn',
|
||||
},
|
||||
});
|
||||
@@ -70,7 +70,7 @@ describe('#hooks.slack', async () => {
|
||||
const res = await server.post('/api/hooks.slack', {
|
||||
body: {
|
||||
token: process.env.SLACK_VERIFICATION_TOKEN,
|
||||
user_id: user.slackId,
|
||||
user_id: user.serviceId,
|
||||
text: document.title,
|
||||
},
|
||||
});
|
||||
@@ -98,7 +98,7 @@ describe('#hooks.slack', async () => {
|
||||
const res = await server.post('/api/hooks.slack', {
|
||||
body: {
|
||||
token: 'wrong-verification-token',
|
||||
user_id: user.slackId,
|
||||
user_id: user.serviceId,
|
||||
text: 'Welcome',
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user