Skip to content
This repository was archived by the owner on Oct 11, 2022. It is now read-only.

Commit 4b6df61

Browse files
authored
Merge pull request #2999 from withspectrum/revert-2998-fix-alpha-slack-redirecting
Revert "Attempt fallback to allow alpha redirects for slack connections"
2 parents 92330b3 + 321967c commit 4b6df61

File tree

2 files changed

+8
-21
lines changed

2 files changed

+8
-21
lines changed

api/routes/api/slackImporter.js

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,8 @@ slackRouter.get('/', (req: any, res: any) => {
1313
const code = req.query.code;
1414
const communityId = req.query.state;
1515
const connectedBy = req.user.id;
16-
const clientUrl = req.query.clientUrl;
1716
const returnURI = IS_PROD
18-
? clientUrl.indexOf('alpha') >= 0
19-
? 'https://alpha.spectrum.chat/api/slack'
20-
: 'https://spectrum.chat/api/slack'
17+
? 'https://spectrum.chat/api/slack'
2118
: 'http://localhost:3001/api/slack';
2219

2320
// generate an oauth token. This token will be used to communicate with the Slack API to get user information, and we'll store the token in the db record to allow for the user to access their Slack team info in the future.
@@ -40,9 +37,7 @@ slackRouter.get('/', (req: any, res: any) => {
4037
.then(community => community.slug)
4138
.then(slug => {
4239
return IS_PROD
43-
? clientUrl.indexOf('alpha') >= 0
44-
? res.redirect(`https://alpha.spectrum.chat/${slug}/settings`)
45-
: res.redirect(`https://spectrum.chat/${slug}/settings`)
40+
? res.redirect(`https://spectrum.chat/${slug}/settings`)
4641
: res.redirect(`http://localhost:3000/${slug}/settings`);
4742
});
4843
});
@@ -52,11 +47,8 @@ slackRouter.get('/onboarding', (req: any, res: any) => {
5247
const code = req.query.code;
5348
const communityId = req.query.state;
5449
const connectedBy = req.user.id;
55-
const clientUrl = req.query.clientUrl;
5650
const returnURI = IS_PROD
57-
? clientUrl.indexOf('alpha') >= 0
58-
? 'https://alpha.spectrum.chat/api/slack/onboarding'
59-
: 'https://spectrum.chat/api/slack/onboarding'
51+
? 'https://spectrum.chat/api/slack/onboarding'
6052
: 'http://localhost:3001/api/slack/onboarding';
6153

6254
// generate an oauth token. This token will be used to communicate with the Slack API to get user information, and we'll store the token in the db record to allow for the user to access their Slack team info in the future.
@@ -79,11 +71,7 @@ slackRouter.get('/onboarding', (req: any, res: any) => {
7971
.then(community => community.id)
8072
.then(id => {
8173
return IS_PROD
82-
? clientUrl.indexOf('alpha') >= 0
83-
? res.redirect(
84-
`https://alpha.spectrum.chat/new/community?s=2&id=${id}`
85-
)
86-
: res.redirect(`https://spectrum.chat/new/community?s=2&id=${id}`)
74+
? res.redirect(`https://spectrum.chat/new/community?s=2&id=${id}`)
8775
: res.redirect(`http://localhost:3000/new/community?s=2&id=${id}`);
8876
});
8977
});

src/views/communitySettings/components/slack/connectSlack.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
} from 'src/components/settingsViews/style';
1010
import { Button } from 'src/components/buttons';
1111
import Icon from 'src/components/icons';
12-
import { CLIENT_URL } from 'src/api/constants';
1312

1413
type Props = {
1514
community: GetSlackSettingsType,
@@ -23,17 +22,17 @@ class ImportSlackTeam extends React.Component<Props> {
2322
const url = isOnboarding
2423
? `https://slack.com/oauth/authorize?client_id=201769987287.271382863153&scope=users:read.email%20users:read%20chat:write:bot%20groups:read%20channels:read&state=${
2524
community.id
26-
}&clientUrl=${CLIENT_URL}&redirect_uri=${
25+
}&redirect_uri=${
2726
process.env.NODE_ENV === 'development'
2827
? 'http://localhost:3001/api/slack/onboarding'
29-
: `${CLIENT_URL}/api/slack/onboarding`
28+
: 'https://spectrum.chat/api/slack/onboarding'
3029
}`
3130
: `https://slack.com/oauth/authorize?client_id=201769987287.271382863153&scope=users:read.email%20users:read%20chat:write:bot%20groups:read%20channels:read&state=${
3231
community.id
33-
}&clientUrl=${CLIENT_URL}&redirect_uri=${
32+
}&redirect_uri=${
3433
process.env.NODE_ENV === 'development'
3534
? 'http://localhost:3001/api/slack'
36-
: `${CLIENT_URL}/api/slack`
35+
: 'https://spectrum.chat/api/slack'
3736
}`;
3837

3938
return (

0 commit comments

Comments
 (0)