From 2a1a38f9867a8db57a0f6cefa2be6e3a3df2604b Mon Sep 17 00:00:00 2001 From: smartdev58 <30475578+smartdev58@users.noreply.github.com> Date: Thu, 15 Dec 2022 02:06:26 +0200 Subject: [PATCH] chore: Add feature flags for campaigns and website channel (#5778) Co-authored-by: Tejaswini Chile Co-authored-by: Pranav Raj S --- .../layout/config/sidebarItems/primaryMenu.js | 1 + .../dashboard/components/widgets/ChannelItem.vue | 3 +++ config/features.yml | 4 ++++ .../20221029202300_add_two_features_to_accounts.rb | 13 +++++++++++++ .../platform/api/v1/accounts_controller_spec.rb | 1 - 5 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20221029202300_add_two_features_to_accounts.rb diff --git a/app/javascript/dashboard/components/layout/config/sidebarItems/primaryMenu.js b/app/javascript/dashboard/components/layout/config/sidebarItems/primaryMenu.js index fa4633ec1..01c2cf107 100644 --- a/app/javascript/dashboard/components/layout/config/sidebarItems/primaryMenu.js +++ b/app/javascript/dashboard/components/layout/config/sidebarItems/primaryMenu.js @@ -29,6 +29,7 @@ const primaryMenuItems = accountId => [ icon: 'megaphone', key: 'campaigns', label: 'CAMPAIGNS', + featureFlag: 'campaigns', toState: frontendURL(`accounts/${accountId}/campaigns`), toStateName: 'settings_account_campaigns', roles: ['administrator'], diff --git a/app/javascript/dashboard/components/widgets/ChannelItem.vue b/app/javascript/dashboard/components/widgets/ChannelItem.vue index 07a984f04..23388f617 100644 --- a/app/javascript/dashboard/components/widgets/ChannelItem.vue +++ b/app/javascript/dashboard/components/widgets/ChannelItem.vue @@ -67,6 +67,9 @@ export default { if (Object.keys(this.enabledFeatures).length === 0) { return false; } + if (key === 'website') { + return this.enabledFeatures.channel_website; + } if (key === 'facebook') { return this.enabledFeatures.channel_facebook; } diff --git a/config/features.yml b/config/features.yml index 4a0cec325..c8be5b261 100644 --- a/config/features.yml +++ b/config/features.yml @@ -1,6 +1,8 @@ # DO NOT change the order of features EVER - name: inbound_emails enabled: true +- name: channel_website + enabled: true - name: channel_email enabled: true - name: channel_facebook @@ -13,6 +15,8 @@ enabled: false - name: email_continuity_on_api_channel enabled: false +- name: campaigns + enabled: true - name: help_center enabled: true - name: agent_bots diff --git a/db/migrate/20221029202300_add_two_features_to_accounts.rb b/db/migrate/20221029202300_add_two_features_to_accounts.rb new file mode 100644 index 000000000..bda92e159 --- /dev/null +++ b/db/migrate/20221029202300_add_two_features_to_accounts.rb @@ -0,0 +1,13 @@ +class AddTwoFeaturesToAccounts < ActiveRecord::Migration[6.1] + def change + Account.find_in_batches do |account_batch| + account_batch.each do |account| + account.enable_features( + 'campaigns', + 'channel_website' + ) + account.save! + end + end + end +end diff --git a/spec/controllers/platform/api/v1/accounts_controller_spec.rb b/spec/controllers/platform/api/v1/accounts_controller_spec.rb index 7295c47c1..c335035d5 100644 --- a/spec/controllers/platform/api/v1/accounts_controller_spec.rb +++ b/spec/controllers/platform/api/v1/accounts_controller_spec.rb @@ -55,7 +55,6 @@ RSpec.describe 'Platform Accounts API', type: :request do ip_lookup: true, help_center: true, disable_branding: false - } }, headers: { api_access_token: platform_app.access_token.token }, as: :json json_response = JSON.parse(response.body)