|
|
@@ -189,13 +189,12 @@ module.exports = function(crowi, app) {
|
|
|
|
|
|
// app.get('/admin/notification' , admin.notification.index);
|
|
|
actions.notification = {};
|
|
|
- actions.notification.index = function(req, res) {
|
|
|
- var config = crowi.getConfig();
|
|
|
- var UpdatePost = crowi.model('UpdatePost');
|
|
|
- var slackSetting = Config.setupCofigFormData('notification', config);
|
|
|
- var hasSlackIwhUrl = Config.hasSlackIwhUrl(config);
|
|
|
- var hasSlackToken = Config.hasSlackToken(config);
|
|
|
- var slack = crowi.slack;
|
|
|
+ actions.notification.index = async(req, res) => {
|
|
|
+ const config = crowi.getConfig();
|
|
|
+ const UpdatePost = crowi.model('UpdatePost');
|
|
|
+ let slackSetting = Config.setupCofigFormData('notification', config);
|
|
|
+ const hasSlackIwhUrl = Config.hasSlackIwhUrl(config);
|
|
|
+ const hasSlackToken = Config.hasSlackToken(config);
|
|
|
|
|
|
if (!Config.hasSlackIwhUrl(req.config)) {
|
|
|
slackSetting['slack:incomingWebhookUrl'] = '';
|
|
|
@@ -206,14 +205,15 @@ module.exports = function(crowi, app) {
|
|
|
req.session.slackSetting = null;
|
|
|
}
|
|
|
|
|
|
- UpdatePost.findAll()
|
|
|
- .then(function(settings) {
|
|
|
- return res.render('admin/notification', {
|
|
|
- settings,
|
|
|
- slackSetting,
|
|
|
- hasSlackIwhUrl,
|
|
|
- hasSlackToken,
|
|
|
- });
|
|
|
+ const globalNotifications = await GlobalNotificationSetting.Parent.findSettingByPathAndEvent(null, null, null);
|
|
|
+ const userNotifications = await UpdatePost.findAll();
|
|
|
+
|
|
|
+ return res.render('admin/notification', {
|
|
|
+ userNotifications,
|
|
|
+ slackSetting,
|
|
|
+ hasSlackIwhUrl,
|
|
|
+ hasSlackToken,
|
|
|
+ globalNotifications,
|
|
|
});
|
|
|
};
|
|
|
|
|
|
@@ -316,6 +316,7 @@ module.exports = function(crowi, app) {
|
|
|
const notificationSettingId = req.params.id;
|
|
|
const renderVars = {
|
|
|
};
|
|
|
+
|
|
|
return res.render('admin/global-notification-detail', renderVars);
|
|
|
};
|
|
|
|
|
|
@@ -340,7 +341,9 @@ module.exports = function(crowi, app) {
|
|
|
let triggerEvents = [];
|
|
|
const triggerEventKeys = Object.keys(form).filter(key => key.match(/^triggerEvent/));
|
|
|
triggerEventKeys.forEach(key => {
|
|
|
- triggerEvents.push(form[key]);
|
|
|
+ if (form[key]) {
|
|
|
+ triggerEvents.push(form[key]);
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
if (setting) {
|