spee.ch/server/utils/isApprovedChannel.js
2018-09-20 13:34:53 -04:00

11 lines
417 B
JavaScript

const { publishing: { approvedChannels } } = require('@config/siteConfig');
function isApprovedChannel (channel, channels = approvedChannels) {
const { name, shortId: short, longId: long } = channel;
return Boolean(
(long && channels.find(chan => chan.longId === long)) ||
(name && short && channels.find(chan => chan.name === name && chan.shortId === short))
);
}
module.exports = isApprovedChannel;