mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-10-31 11:08:04 +00:00 
			
		
		
		
	chore: Add feature flags for campaigns and website channel (#5778)
Co-authored-by: Tejaswini Chile <tejaswini@chatwoot.com> Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
This commit is contained in:
		| @@ -29,6 +29,7 @@ const primaryMenuItems = accountId => [ | |||||||
|     icon: 'megaphone', |     icon: 'megaphone', | ||||||
|     key: 'campaigns', |     key: 'campaigns', | ||||||
|     label: 'CAMPAIGNS', |     label: 'CAMPAIGNS', | ||||||
|  |     featureFlag: 'campaigns', | ||||||
|     toState: frontendURL(`accounts/${accountId}/campaigns`), |     toState: frontendURL(`accounts/${accountId}/campaigns`), | ||||||
|     toStateName: 'settings_account_campaigns', |     toStateName: 'settings_account_campaigns', | ||||||
|     roles: ['administrator'], |     roles: ['administrator'], | ||||||
|   | |||||||
| @@ -67,6 +67,9 @@ export default { | |||||||
|       if (Object.keys(this.enabledFeatures).length === 0) { |       if (Object.keys(this.enabledFeatures).length === 0) { | ||||||
|         return false; |         return false; | ||||||
|       } |       } | ||||||
|  |       if (key === 'website') { | ||||||
|  |         return this.enabledFeatures.channel_website; | ||||||
|  |       } | ||||||
|       if (key === 'facebook') { |       if (key === 'facebook') { | ||||||
|         return this.enabledFeatures.channel_facebook; |         return this.enabledFeatures.channel_facebook; | ||||||
|       } |       } | ||||||
|   | |||||||
| @@ -1,6 +1,8 @@ | |||||||
| # DO NOT change the order of features EVER | # DO NOT change the order of features EVER | ||||||
| - name: inbound_emails | - name: inbound_emails | ||||||
|   enabled: true |   enabled: true | ||||||
|  | - name: channel_website | ||||||
|  |   enabled: true | ||||||
| - name: channel_email | - name: channel_email | ||||||
|   enabled: true |   enabled: true | ||||||
| - name: channel_facebook | - name: channel_facebook | ||||||
| @@ -13,6 +15,8 @@ | |||||||
|   enabled: false |   enabled: false | ||||||
| - name: email_continuity_on_api_channel | - name: email_continuity_on_api_channel | ||||||
|   enabled: false |   enabled: false | ||||||
|  | - name: campaigns | ||||||
|  |   enabled: true | ||||||
| - name: help_center | - name: help_center | ||||||
|   enabled: true |   enabled: true | ||||||
| - name: agent_bots | - name: agent_bots | ||||||
|   | |||||||
							
								
								
									
										13
									
								
								db/migrate/20221029202300_add_two_features_to_accounts.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								db/migrate/20221029202300_add_two_features_to_accounts.rb
									
									
									
									
									
										Normal file
									
								
							| @@ -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 | ||||||
| @@ -55,7 +55,6 @@ RSpec.describe 'Platform Accounts API', type: :request do | |||||||
|           ip_lookup: true, |           ip_lookup: true, | ||||||
|           help_center: true, |           help_center: true, | ||||||
|           disable_branding: false |           disable_branding: false | ||||||
|  |  | ||||||
|         } }, headers: { api_access_token: platform_app.access_token.token }, as: :json |         } }, headers: { api_access_token: platform_app.access_token.token }, as: :json | ||||||
|  |  | ||||||
|         json_response = JSON.parse(response.body) |         json_response = JSON.parse(response.body) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 smartdev58
					smartdev58