|
|
@@ -14,6 +14,7 @@ module.exports = function(crowi, app) {
|
|
|
, Config = models.Config
|
|
|
, GlobalNotificationSetting = models.GlobalNotificationSetting
|
|
|
, GlobalNotificationMailSetting = models.GlobalNotificationMailSetting
|
|
|
+ , GlobalNotificationSlackSetting = models.GlobalNotificationSlackSetting
|
|
|
, PluginUtils = require('../plugins/plugin-utils')
|
|
|
, pluginUtils = new PluginUtils()
|
|
|
, ApiResponse = require('../util/apiResponse')
|
|
|
@@ -206,7 +207,7 @@ module.exports = function(crowi, app) {
|
|
|
req.session.slackSetting = null;
|
|
|
}
|
|
|
|
|
|
- const globalNotifications = await GlobalNotificationSetting.Parent.findAll();
|
|
|
+ const globalNotifications = await GlobalNotificationSetting.findAll();
|
|
|
const userNotifications = await UpdatePost.findAll();
|
|
|
|
|
|
return res.render('admin/notification', {
|
|
|
@@ -319,7 +320,7 @@ module.exports = function(crowi, app) {
|
|
|
|
|
|
if (notificationSettingId) {
|
|
|
try {
|
|
|
- renderVars.setting = await GlobalNotificationSetting.Parent.findOne({_id: notificationSettingId});
|
|
|
+ renderVars.setting = await GlobalNotificationSetting.findOne({_id: notificationSettingId});
|
|
|
}
|
|
|
catch (err) {
|
|
|
logger.error(`Error in finding a global notification setting with {_id: ${notificationSettingId}}`);
|
|
|
@@ -339,7 +340,7 @@ module.exports = function(crowi, app) {
|
|
|
setting.toEmail = form.toEmail;
|
|
|
break;
|
|
|
// case 'slack':
|
|
|
- // setting = new GlobalNotificationSetting.Slack(crowi);
|
|
|
+ // setting = new GlobalNotificationSlackSetting(crowi);
|
|
|
// setting.slackChannels = form.slackChannels;
|
|
|
// break;
|
|
|
default:
|
|
|
@@ -357,7 +358,7 @@ module.exports = function(crowi, app) {
|
|
|
|
|
|
actions.globalNotification.update = async(req, res) => {
|
|
|
const form = req.form.notificationGlobal;
|
|
|
- const setting = await GlobalNotificationSetting.Parent.findOne({_id: form.id});
|
|
|
+ const setting = await GlobalNotificationSetting.findOne({_id: form.id});
|
|
|
|
|
|
switch (form.notifyToType) {
|
|
|
case 'mail':
|
|
|
@@ -1157,10 +1158,10 @@ module.exports = function(crowi, app) {
|
|
|
|
|
|
try {
|
|
|
if (isEnabled) {
|
|
|
- await GlobalNotificationSetting.Parent.disable(id);
|
|
|
+ await GlobalNotificationSetting.disable(id);
|
|
|
}
|
|
|
else {
|
|
|
- await GlobalNotificationSetting.Parent.enable(id);
|
|
|
+ await GlobalNotificationSetting.enable(id);
|
|
|
}
|
|
|
|
|
|
return res.json(ApiResponse.success());
|
|
|
@@ -1174,7 +1175,7 @@ module.exports = function(crowi, app) {
|
|
|
const id = req.query.id;
|
|
|
|
|
|
try {
|
|
|
- await GlobalNotificationSetting.Parent.findOneAndRemove({_id: id});
|
|
|
+ await GlobalNotificationSetting.findOneAndRemove({_id: id});
|
|
|
return res.json(ApiResponse.success());
|
|
|
}
|
|
|
catch (err) {
|