fix: Old Instagram inbox warnings (#11318)
We have added warnings for existing Instagram messenger inboxes via https://github.com/chatwoot/chatwoot/pull/11303. There is an issue with finding the correct Instagram/messenger inbox. This PR will fixes that issue.
This commit is contained in:
@@ -129,6 +129,13 @@ export const getters = {
|
||||
item.channel_type === INBOX_TYPES.FB
|
||||
);
|
||||
},
|
||||
getInstagramInboxByInstagramId: $state => instagramId => {
|
||||
return $state.records.find(
|
||||
item =>
|
||||
item.instagram_id === instagramId &&
|
||||
item.channel_type === INBOX_TYPES.INSTAGRAM
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
const sendAnalyticsEvent = channelType => {
|
||||
|
||||
@@ -63,4 +63,12 @@ export default [
|
||||
channel_type: 'Channel::Sms',
|
||||
provider: 'default',
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
channel_id: 7,
|
||||
name: 'Test Instagram 1',
|
||||
channel_type: 'Channel::Instagram',
|
||||
instagram_id: 123456789,
|
||||
provider: 'default',
|
||||
},
|
||||
];
|
||||
|
||||
@@ -26,7 +26,7 @@ describe('#getters', () => {
|
||||
|
||||
it('dialogFlowEnabledInboxes', () => {
|
||||
const state = { records: inboxList };
|
||||
expect(getters.dialogFlowEnabledInboxes(state).length).toEqual(6);
|
||||
expect(getters.dialogFlowEnabledInboxes(state).length).toEqual(7);
|
||||
});
|
||||
|
||||
it('getInbox', () => {
|
||||
@@ -81,4 +81,16 @@ describe('#getters', () => {
|
||||
instagram_id: 123456789,
|
||||
});
|
||||
});
|
||||
|
||||
it('getInstagramInboxByInstagramId', () => {
|
||||
const state = { records: inboxList };
|
||||
expect(getters.getInstagramInboxByInstagramId(state)(123456789)).toEqual({
|
||||
id: 7,
|
||||
channel_id: 7,
|
||||
name: 'Test Instagram 1',
|
||||
channel_type: 'Channel::Instagram',
|
||||
instagram_id: 123456789,
|
||||
provider: 'default',
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user