Skip to content

Commit

Permalink
Rename directInstallUrlEnabled to directInstall
Browse files Browse the repository at this point in the history
  • Loading branch information
seratch committed Aug 25, 2021
1 parent 62eafc3 commit 516d5b7
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion examples/oauth/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const app = new App({
// If this is true, /slack/install redirects installers to the Slack authorize URL
// without rendering the web page with "Add to Slack" button.
// This flag is available in @slack/bolt v3.7 or higher
// directInstallUrlEnabled: true,
// directInstall: true,
}
});

Expand Down
4 changes: 2 additions & 2 deletions src/receivers/ExpressReceiver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ interface InstallerOptions {
authVersion?: InstallProviderOptions['authVersion']; // default 'v2'
metadata?: InstallURLOptions['metadata'];
installPath?: string;
directInstallUrlEnabled?: boolean; // see https://api.slack.com/start/distributing/directory#direct_install
directInstall?: boolean; // see https://api.slack.com/start/distributing/directory#direct_install
redirectUriPath?: string;
callbackOptions?: CallbackOptions;
userScopes?: InstallURLOptions['userScopes'];
Expand Down Expand Up @@ -140,7 +140,7 @@ export default class ExpressReceiver implements Receiver {
scopes: scopes!,
userScopes: installerOptions.userScopes,
});
if (installerOptions.directInstallUrlEnabled) {
if (installerOptions.directInstall) {
// If a Slack app sets "Direct Install URL" in the Slack app configruation,
// the installation flow of the app should start with the Slack authorize URL.
// See https://api.slack.com/start/distributing/directory#direct_install for more details.
Expand Down
2 changes: 1 addition & 1 deletion src/receivers/HTTPReceiver.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ describe('HTTPReceiver', function () {
installerOptions: {
authVersion: 'v2',
installPath: '/hiya',
directInstallUrlEnabled: true,
directInstall: true,
metadata,
userScopes,
},
Expand Down
9 changes: 4 additions & 5 deletions src/receivers/HTTPReceiver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export interface HTTPReceiverOptions {

export interface HTTPReceiverInstallerOptions {
installPath?: string;
directInstallUrlEnabled?: boolean; // see https://api.slack.com/start/distributing/directory#direct_install
directInstall?: boolean; // see https://api.slack.com/start/distributing/directory#direct_install
redirectUriPath?: string;
stateStore?: InstallProviderOptions['stateStore']; // default ClearStateStore
authVersion?: InstallProviderOptions['authVersion']; // default 'v2'
Expand Down Expand Up @@ -64,7 +64,7 @@ export default class HTTPReceiver implements Receiver {

private installPath?: string; // always defined when installer is defined

private directInstallUrlEnabled?: boolean; // always defined when installer is defined
private directInstall?: boolean; // always defined when installer is defined

private installRedirectUriPath?: string; // always defined when installer is defined

Expand Down Expand Up @@ -120,8 +120,7 @@ export default class HTTPReceiver implements Receiver {

// Store the remaining instance variables that are related to using the InstallProvider
this.installPath = installerOptions.installPath ?? '/slack/install';
this.directInstallUrlEnabled =
installerOptions.directInstallUrlEnabled !== undefined && installerOptions.directInstallUrlEnabled;
this.directInstall = installerOptions.directInstall !== undefined && installerOptions.directInstall;
this.installRedirectUriPath = installerOptions.redirectUriPath ?? '/slack/oauth_redirect';
this.installUrlOptions = {
scopes: scopes ?? [],
Expand Down Expand Up @@ -394,7 +393,7 @@ export default class HTTPReceiver implements Receiver {
// Generate the URL for the "Add to Slack" button.
const url = await installer.generateInstallUrl(installUrlOptions);

if (this.directInstallUrlEnabled !== undefined && this.directInstallUrlEnabled) {
if (this.directInstall !== undefined && this.directInstall) {
// If a Slack app sets "Direct Install URL" in the Slack app configruation,
// the installation flow of the app should start with the Slack authorize URL.
// See https://api.slack.com/start/distributing/directory#direct_install for more details.
Expand Down
2 changes: 1 addition & 1 deletion src/receivers/SocketModeReceiver.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ describe('SocketModeReceiver', function () {
installerOptions: {
authVersion: 'v2',
installPath: '/hiya',
directInstallUrlEnabled: true,
directInstall: true,
metadata,
userScopes,
},
Expand Down
5 changes: 2 additions & 3 deletions src/receivers/SocketModeReceiver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ interface InstallerOptions {
authVersion?: InstallProviderOptions['authVersion']; // default 'v2'
metadata?: InstallURLOptions['metadata'];
installPath?: string;
directInstallUrlEnabled?: boolean; // see https://api.slack.com/start/distributing/directory#direct_install
directInstall?: boolean; // see https://api.slack.com/start/distributing/directory#direct_install
redirectUriPath?: string;
callbackOptions?: CallbackOptions;
userScopes?: InstallURLOptions['userScopes'];
Expand Down Expand Up @@ -102,8 +102,7 @@ export default class SocketModeReceiver implements Receiver {

// use default or passed in installPath
const installPath = installerOptions.installPath === undefined ? '/slack/install' : installerOptions.installPath;
const directInstallEnabled =
installerOptions.directInstallUrlEnabled !== undefined && installerOptions.directInstallUrlEnabled;
const directInstallEnabled = installerOptions.directInstall !== undefined && installerOptions.directInstall;

const server = createServer(async (req, res) => {
if (req.url !== undefined && req.url.startsWith(redirectUriPath)) {
Expand Down

0 comments on commit 516d5b7

Please sign in to comment.