The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/apps/meteor/app/livechat/server/lib/contacts/isVerifiedChannelInSource.ts

25 lines
579 B

import type { ILivechatContactChannel, ILivechatVisitor, IOmnichannelSource } from '@rocket.chat/core-typings';
export const isVerifiedChannelInSource = (
channel: ILivechatContactChannel,
visitorId: ILivechatVisitor['_id'],
source: IOmnichannelSource,
) => {
if (!channel.verified) {
return false;
}
if (channel.visitor.visitorId !== visitorId) {
return false;
}
if (channel.visitor.source.type !== source.type) {
return false;
}
if ((source.id || channel.visitor.source.id) && channel.visitor.source.id !== source.id) {
return false;
}
return true;
};