Skip to content
This repository has been archived by the owner on Mar 25, 2022. It is now read-only.

Commit

Permalink
Add custom trigger when deleting feed settings
Browse files Browse the repository at this point in the history
  • Loading branch information
miklosaubert committed Feb 5, 2019
1 parent 7901807 commit 23b1bbc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/slackapp/feed-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,13 @@ const deleteFeedSettings = (slackapp) => async (bot, message) => {
if (team.incoming_webhook && team.incoming_webhook.channel_id === channelId) {
team.incoming_webhook = null;
}
const deletedFeed = team.feeds && team.feeds.find((f) => f.channelId === channelId);
team.feeds = (team.feeds || []).filter((f) => f.channelId !== channelId);
slackapp.saveTeamAsync = slackapp.saveTeamAsync || promisify(slackapp.saveTeam);
await slackapp.saveTeamAsync(team);
if (deletedFeed) {
slackapp.trigger('feed_settings_deleted', [{ businessUnitId: deletedFeed.businessUnitId }]);
}
showIntroMessage(message, bot);
};

Expand Down

0 comments on commit 23b1bbc

Please sign in to comment.