From 516d5b71a2073f1dcd00dfd1849ba5b7c435453b Mon Sep 17 00:00:00 2001 From: Kazuhiro Sera Date: Wed, 25 Aug 2021 06:38:10 +0900 Subject: [PATCH] Rename directInstallUrlEnabled to directInstall --- examples/oauth/app.js | 2 +- src/receivers/ExpressReceiver.ts | 4 ++-- src/receivers/HTTPReceiver.spec.ts | 2 +- src/receivers/HTTPReceiver.ts | 9 ++++----- src/receivers/SocketModeReceiver.spec.ts | 2 +- src/receivers/SocketModeReceiver.ts | 5 ++--- 6 files changed, 11 insertions(+), 13 deletions(-) diff --git a/examples/oauth/app.js b/examples/oauth/app.js index 89b62afbf..e599fce4c 100644 --- a/examples/oauth/app.js +++ b/examples/oauth/app.js @@ -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, } }); diff --git a/src/receivers/ExpressReceiver.ts b/src/receivers/ExpressReceiver.ts index 5c1577a08..d71939f3a 100644 --- a/src/receivers/ExpressReceiver.ts +++ b/src/receivers/ExpressReceiver.ts @@ -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']; @@ -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. diff --git a/src/receivers/HTTPReceiver.spec.ts b/src/receivers/HTTPReceiver.spec.ts index a9703b3c7..02f2e3573 100644 --- a/src/receivers/HTTPReceiver.spec.ts +++ b/src/receivers/HTTPReceiver.spec.ts @@ -135,7 +135,7 @@ describe('HTTPReceiver', function () { installerOptions: { authVersion: 'v2', installPath: '/hiya', - directInstallUrlEnabled: true, + directInstall: true, metadata, userScopes, }, diff --git a/src/receivers/HTTPReceiver.ts b/src/receivers/HTTPReceiver.ts index 308c4539a..851169dc4 100644 --- a/src/receivers/HTTPReceiver.ts +++ b/src/receivers/HTTPReceiver.ts @@ -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' @@ -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 @@ -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 ?? [], @@ -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. diff --git a/src/receivers/SocketModeReceiver.spec.ts b/src/receivers/SocketModeReceiver.spec.ts index 84a8c531a..cb6eb631c 100644 --- a/src/receivers/SocketModeReceiver.spec.ts +++ b/src/receivers/SocketModeReceiver.spec.ts @@ -203,7 +203,7 @@ describe('SocketModeReceiver', function () { installerOptions: { authVersion: 'v2', installPath: '/hiya', - directInstallUrlEnabled: true, + directInstall: true, metadata, userScopes, }, diff --git a/src/receivers/SocketModeReceiver.ts b/src/receivers/SocketModeReceiver.ts index abbd6112a..3a206a74f 100644 --- a/src/receivers/SocketModeReceiver.ts +++ b/src/receivers/SocketModeReceiver.ts @@ -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']; @@ -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)) {