diff --git a/app/javascript/dashboard/routes/dashboard/settings/campaigns/AddCampaign.vue b/app/javascript/dashboard/routes/dashboard/settings/campaigns/AddCampaign.vue index cf56f66e9..267188592 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/campaigns/AddCampaign.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/campaigns/AddCampaign.vue @@ -237,7 +237,7 @@ export default { if (this.isOngoingType) { return this.$store.getters['inboxes/getWebsiteInboxes']; } - return this.$store.getters['inboxes/getTwilioInboxes']; + return this.$store.getters['inboxes/getTwilioSMSInboxes']; }, sendersAndBotList() { return [ diff --git a/app/javascript/dashboard/routes/dashboard/settings/campaigns/EditCampaign.vue b/app/javascript/dashboard/routes/dashboard/settings/campaigns/EditCampaign.vue index 592a09fe7..deb3b56b6 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/campaigns/EditCampaign.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/campaigns/EditCampaign.vue @@ -161,7 +161,7 @@ export default { if (this.isOngoingType) { return this.$store.getters['inboxes/getWebsiteInboxes']; } - return this.$store.getters['inboxes/getTwilioInboxes']; + return this.$store.getters['inboxes/getTwilioSMSInboxes']; }, pageTitle() { return `${this.$t('CAMPAIGN.EDIT.TITLE')} - ${ diff --git a/app/javascript/dashboard/store/modules/inboxes.js b/app/javascript/dashboard/store/modules/inboxes.js index 6094608e6..b02d35f3f 100644 --- a/app/javascript/dashboard/store/modules/inboxes.js +++ b/app/javascript/dashboard/store/modules/inboxes.js @@ -73,6 +73,11 @@ export const getters = { item => item.channel_type === INBOX_TYPES.TWILIO ); }, + getTwilioSMSInboxes($state) { + return $state.records.filter( + item => item.channel_type === INBOX_TYPES.TWILIO && item.medium === 'sms' + ); + }, }; export const actions = { diff --git a/app/javascript/dashboard/store/modules/specs/inboxes/fixtures.js b/app/javascript/dashboard/store/modules/specs/inboxes/fixtures.js index 3a245aa2f..9db92b00a 100644 --- a/app/javascript/dashboard/store/modules/specs/inboxes/fixtures.js +++ b/app/javascript/dashboard/store/modules/specs/inboxes/fixtures.js @@ -49,10 +49,10 @@ export default [ name: 'Test Widget 5', channel_type: 'Channel::TwilioSms', avatar_url: null, + medium: 'sms', page_id: null, widget_color: '#68BC00', website_token: 'randomid125', enable_auto_assignment: true, }, - ]; diff --git a/app/javascript/dashboard/store/modules/specs/inboxes/getters.spec.js b/app/javascript/dashboard/store/modules/specs/inboxes/getters.spec.js index f70e372cb..f49d68e89 100644 --- a/app/javascript/dashboard/store/modules/specs/inboxes/getters.spec.js +++ b/app/javascript/dashboard/store/modules/specs/inboxes/getters.spec.js @@ -19,6 +19,11 @@ describe('#getters', () => { expect(getters.getTwilioInboxes(state).length).toEqual(1); }); + it('getTwilioSMSInboxes', () => { + const state = { records: inboxList }; + expect(getters.getTwilioSMSInboxes(state).length).toEqual(1); + }); + it('getInbox', () => { const state = { records: inboxList,