From 79018070b497b489fff2968c1eb0666a5c6efe11 Mon Sep 17 00:00:00 2001 From: Miklos Aubert Date: Fri, 1 Feb 2019 14:24:55 +0100 Subject: [PATCH] Add custom trigger when opening feed settings --- app/slackapp/feed-settings.js | 3 ++- app/slackapp/index.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/slackapp/feed-settings.js b/app/slackapp/feed-settings.js index 6875ce6..4833134 100644 --- a/app/slackapp/feed-settings.js +++ b/app/slackapp/feed-settings.js @@ -102,7 +102,7 @@ const showIntroMessage = (message, bot) => { } }; -const showFeedSettings = (bot, message) => { +const showFeedSettings = (slackapp) => (bot, message) => { const team = bot.team_info; const { starFilter = 'all', canReply } = getChannelFeedSettingsOrDefault(team, message.channel); const sourceMessage = { @@ -135,6 +135,7 @@ const showFeedSettings = (bot, message) => { console.log(err, res); } }); + slackapp.trigger('feed_settings_dialog_opened', [bot]); }; const handleNewFeedSettings = async (bot, message, slackapp) => { diff --git a/app/slackapp/index.js b/app/slackapp/index.js index cf2248e..185709e 100644 --- a/app/slackapp/index.js +++ b/app/slackapp/index.js @@ -124,7 +124,7 @@ const setupAppHandlers = (slackapp, apiClient, enableReviewQueries) => { const action = message.actions[0].value; const actionHandlers = { ['step_1_write_reply']: handleReplyButton, - ['open_feed_settings']: feedSettings.showFeedSettings, + ['open_feed_settings']: feedSettings.showFeedSettings(slackapp), ['delete_feed_settings']: feedSettings.deleteFeedSettings(slackapp), }; await actionHandlers[action](bot, message);