|
@@ -128,8 +128,8 @@ const ApiResponse = require('../util/apiResponse');
|
|
|
module.exports = function(crowi, app) {
|
|
module.exports = function(crowi, app) {
|
|
|
const Attachment = crowi.model('Attachment');
|
|
const Attachment = crowi.model('Attachment');
|
|
|
const Page = crowi.model('Page');
|
|
const Page = crowi.model('Page');
|
|
|
- const { fileUploadService, attachmentService } = crowi;
|
|
|
|
|
-
|
|
|
|
|
|
|
+ const GlobalNotificationSetting = crowi.model('GlobalNotificationSetting');
|
|
|
|
|
+ const { fileUploadService, attachmentService, globalNotificationService } = crowi;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* Check the user is accessible to the related page
|
|
* Check the user is accessible to the related page
|
|
@@ -463,7 +463,17 @@ module.exports = function(crowi, app) {
|
|
|
pageCreated,
|
|
pageCreated,
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- return res.json(ApiResponse.success(result));
|
|
|
|
|
|
|
+ res.json(ApiResponse.success(result));
|
|
|
|
|
+
|
|
|
|
|
+ if (pageCreated) {
|
|
|
|
|
+ // global notification
|
|
|
|
|
+ try {
|
|
|
|
|
+ await globalNotificationService.fire(GlobalNotificationSetting.EVENT.PAGE_CREATE, page, req.user);
|
|
|
|
|
+ }
|
|
|
|
|
+ catch (err) {
|
|
|
|
|
+ logger.error('Create notification failed', err);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
/**
|