23 lines
591 B
JavaScript
23 lines
591 B
JavaScript
'use strict';
|
|
|
|
const { pickNotifyFlags } = require('./notifyFlags');
|
|
const { getActionChannelFlags } = require('./notificationSettings');
|
|
|
|
/**
|
|
* Combines per-request notify flags (from admin forms) with dashboard per-action settings.
|
|
*/
|
|
const resolveNotifyFlags = async (source = {}, actionKey) => {
|
|
const request = pickNotifyFlags(source);
|
|
const dashboard = await getActionChannelFlags(actionKey);
|
|
|
|
return {
|
|
sms: request.sms && dashboard.sms,
|
|
email: request.email && dashboard.email,
|
|
bot: request.bot && dashboard.bot
|
|
};
|
|
};
|
|
|
|
module.exports = {
|
|
resolveNotifyFlags
|
|
};
|